Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Correct use of Widgets

Correct use of Widgets

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 567 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aidoru
    wrote on last edited by aidoru
    #1

    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

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved