Results 1 to 4 of 4

Thread: QToolBar and DockWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QToolBar and DockWidget

    Do you add
    • the tool button to the toolbar
    • the toolbar to the main window
    ?
    J-P Nurmi

  2. #2
    Join Date
    Aug 2007
    Posts
    275
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Default Re: QToolBar and DockWidget

    yes i think by doing this

    Qt Code:
    1. //Toolbar
    2. toolBar = new QToolBar(this);
    3. QToolButton *btnZoom = new QToolButton(toolBar);
    4. btnZoom->setText("Zoom"); btnZoom->setCheckable(true);
    5. btnZoom->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    To copy to clipboard, switch view to plain text mode 

    toolBar = new QToolBar(this); // this should attached the toolbar to QMainWindow
    QToolButton *btnZoom = new QToolButton(toolBar); // this should attached toolButton to toolBar

    byt the way this class inherits QMainWindow

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QToolBar and DockWidget

    They get created as child widgets at location (0,0) but that's all. Use QMainWindow::addToolBar() and QToolBar::addWidget() to get them actually managed.
    J-P Nurmi

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
  •  
Qt is a trademark of The Qt Company.