Results 1 to 8 of 8

Thread: Toolbar in dockwidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Location
    Saint-Petersburg
    Posts
    50
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Toolbar in dockwidget

    setWidget() don't help me!

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

    Default Re: Toolbar in dockwidget

    Try this:
    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char* argv[])
    4. {
    5. QApplication app(argc, argv);
    6. QMainWindow window;
    7.  
    8. QDockWidget* dock = new QDockWidget("Dock", &window);
    9. QMainWindow* inner = new QMainWindow(dock);
    10. inner->setWindowFlags(Qt::Widget); // <---------
    11. QToolBar* toolBar = new QToolBar(inner);
    12. inner->addToolBar(toolBar);
    13. dock->setWidget(inner);
    14.  
    15. window.addDockWidget(Qt::LeftDockWidgetArea, dock);
    16. window.setCentralWidget(new QLabel("Central", &window));
    17. window.show();
    18. return app.exec();
    19. }
    To copy to clipboard, switch view to plain text mode 
    PS. Notice setWindowFlags().
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    AD (2nd October 2008)

  4. #3
    Join Date
    Jun 2008
    Location
    Saint-Petersburg
    Posts
    50
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Toolbar in dockwidget

    Thank You! ))))

    Worked!
    Last edited by AD; 2nd October 2008 at 15:01.

Similar Threads

  1. unable to hide combobox or spinbox in toolbar
    By Sandip in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2008, 11:52
  2. printing of dockWidget contents
    By user in forum Qt Programming
    Replies: 7
    Last Post: 18th May 2008, 23:07
  3. Toolbar and icon size
    By MrGarbage in forum Qt Programming
    Replies: 0
    Last Post: 8th January 2008, 21:27
  4. Create a Toolbar on a Subclassed Textedit?
    By c_07 in forum Qt Programming
    Replies: 5
    Last Post: 12th October 2007, 18:17
  5. QToolBar and DockWidget
    By baray98 in forum Qt Programming
    Replies: 3
    Last Post: 15th August 2007, 21:15

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.