Correct use of Widgets
General and Desktop
2
Posts
2
Posters
570
Views
1
Watching
-
wrote on 9 Sept 2015, 09:32 last edited by aidoru 9 Sept 2015, 09:34
Hello,
I created a qt application project where I have:- A main widget
- Inside the main widget I have a OpenGLWidget and a DockWidget.
To manage the OpenGLWidget I created a sub-class and promoted the widget to use it.
To manage the DockWidget I Didn't create any sub-classes and I manage it in the main widget class:
MainWidget::MainWidget(QWidget *parent) : QWidget(parent) { ui.setupUi(this); ui.dockWidget = new QDockWidget(tr("MyDockWidget"), this); ui.dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); ................................... ........................
But I don't think it is the correct use because with that code it created 2 dock widget: dockWidget (and that is ok) and another dock widget called as my main widget.
Could someone tell me which is the correct use of a dock widget created in designer?
Thank you
-
If you created it in the designer there is no need to create one manually. Just use the one created in the designer, you can access it via ui->dockWidget (or what ever name you gave the widget in the designer).
1/2