Results 1 to 2 of 2

Thread: QMainWindow && QToolBox

  1. #1
    Join Date
    Nov 2006
    Posts
    96

    Default QMainWindow && QToolBox

    Hi, I have a problem: I have a main window where I add centralWidget().
    The class inherits QMainWindow.

    Qt Code:
    1. QToolBox *m_pToolbox = new QToolBox();
    2. QTabWidget *m_pTabVnos = new QTabWidget();
    3. m_pToolbox->addItem(m_pTabVnos,trUtf8("Insert));
    4. setCentralWidget(m_pToolbox);
    To copy to clipboard, switch view to plain text mode 

    Now I want this widget not to resize itself through all the central widget.
    I want this QToolBox to be 1/3 of the width of the central widget (like in kpdf program).
    The rest of the space (so 2/3 of the width) will be empty or now.

    How can I do that?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMainWindow && QToolBox

    Create a widget with a horizontal layout and two child widgets - the toolbox and an empty widget (like QWidget). If you want to have 1:2 proportions, set horizontal stretches of respective widgets to 1 and 2. Finally set the widget containing the two mentioned child widgets as a central widget for your main window.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.