Inheriting directly from QDockWidget makes it so I can't place widgets in designer
Unsolved
General and Desktop
-
does anybody know why I can't place widgets on my QDockWidget when its the topmost parent?
I have it the top most parent because I want it to be a custom widget and not a custom window.
http://imgur.com/a/gl9lp -
QDockWidget has its own layout and you put a widget in it via the method
setWidget
. So in your case make the top most widget inherit a QWidget instead of QDockWidget and add it to the dock from code. -
the top most widget is the TileMapWidget that inherits from DockWidget though.
and I need it to be a DockWidget so that when I add it I can dock it.QDockWidget *MainWindow::loadDockWindow(Qt::DockWidgetArea dockArea, QDockWidget *widget) { if (widget == NULL) addDockWidget(dockArea, widget); if (!widget->isVisible()) widget->show(); else widget->hide(); return widget; }
-
Well, for whatever reason your dockwidget .ui file is missing the contents widget. Either recreate it via wizard or just manually fix the file in text editor:
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>TileMapWidget</class> <widget class="QDockWidget" name="TileMapWidget"> <widget class="QWidget" name="dockWidgetContents"/> </widget> </ui>
-
thankyou Chris Kawa.