ui/qt/window.cpp

changeset 108
77254bd6dccb
parent 103
6606616eca9f
child 109
c3dfcb8f0be7
--- a/ui/qt/window.cpp	Sat Apr 05 17:57:04 2025 +0200
+++ b/ui/qt/window.cpp	Sun Jul 20 22:04:39 2025 +0200
@@ -28,6 +28,7 @@
 
 #include <cx/mempool.h>
 #include "../common/context.h"
+#include "../common/object.h"
 
 #include "window.h"
 #include "menu.h"
@@ -39,9 +40,7 @@
 #include <QPushButton>
 
 static UiObject* create_window(const char *title, void *window_data, bool simple) {
-    CxMempool *mp = cxMempoolCreateSimple(256);
-    UiObject *obj = (UiObject*)cxCalloc(mp->allocator, 1, sizeof(UiObject));
-    obj->ctx = uic_context(obj, mp);
+    UiObject *obj = uic_object_new_toplevel();
     obj->window = window_data;
     obj->next = NULL;
     
@@ -51,8 +50,10 @@
     
     if(!simple) {
         ui_add_menus(obj, window);
-        //QToolBar *toolbar = ui_create_toolbar(obj);
-        //window->addToolBar(Qt::TopToolBarArea, toolbar);
+        QToolBar *toolbar = ui_create_toolbar(obj);
+        if(toolbar) {
+            window->addToolBar(Qt::TopToolBarArea, toolbar);
+        }
     }
     
     QBoxLayout *box = new QVBoxLayout();

mercurial