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. Dock Widgets Example Question
Qt 6.11 is out! See what's new in the release blog

Dock Widgets Example Question

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.6k Views 1 Watching
  • 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.
  • W Offline
    W Offline
    webphone
    wrote on last edited by
    #1

    I read http://doc.qt.nokia.com/latest/mainwindows-dockwidgets.html and would like to create an UI exactly like it.

    Except:

    1. centralWidget "Letter" put on right hand side, 2 DockWidgets "Customers" and "Paragraphs" put on left hand side.
    2. There is a bottom DockWidget.

    However, the following code put "Customers" on left hand side, "Letter" on the central, "Paragraphs" on the right hand side.

    How should I change the code to fix the layout problem?

    @
    QFrame *frame = new QFrame( this );
    QLayout *layout = new QVBoxLayout( frame );
    frame->setLayout( layout );
    layout->addWidget( &m_Main );
    setCentralWidget( frame );

    m_A = new A( this );
    addDockWidget( Qt::LeftDockWidgetArea, m_A );
    
    m_B = new B( this );
    addDockWidget( Qt::LeftDockWidgetArea, m_B );
    
    m_C = new C( this );
    addDockWidget( Qt::BottomDockWidgetArea, m_C );
    

    @

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Dock widgets are freely placeable in the dock areas (either by code or by dragging the widget around). I don't understand the problem you see.

      The letter is in the example placed in the central widget because it makes sense. You should probably be able to place the letter in a dock widget as well if that is what you want. I don't know what the effect will be though. I never tested the approach without a central widget.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        bq. I don’t know what the effect will be though. I never tested the approach without a central widget.

        I have tried this some time ago and it is not possible without central widget. There should be an empty widget at least

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0
        • W Offline
          W Offline
          webphone
          wrote on last edited by
          #4

          Sorry, I am very new to QT. How should the above code (empty central widget) be changed?

          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