Results 1 to 2 of 2

Thread: QToolbar inside QWidget

  1. #1

    Default QToolbar inside QWidget

    Hi,
    If I have a QMainWindow, I can add toolbars and they look like this:

    toolbar.png

    I have 3 toolbars, and their size can be changed with that line at the start of each.

    However, I have a QWidget, and I would like to get the same effect. Is there a way to achieve this?
    Thanks,

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QToolbar inside QWidget

    You can use any QWidget as the parent of a QToolBar. However, if you want all of the same behavior as the toolbars in a QMainWindow (floating, docking, automatic resizing of the other widgets on docking or floating, etc.), then you have to copy the code from QMainWindow that manages toolbars and docking. See the documentation and source code for QToolBar::setAllowedAreas() to see the communication between the toolbar and the main window.

Similar Threads

  1. how to align text inside a QToolBar
    By eric_vi in forum Qt Programming
    Replies: 1
    Last Post: 27th September 2010, 13:04
  2. Position of qActions inside a QToolBar
    By jano_alex_es in forum Newbie
    Replies: 9
    Last Post: 23rd April 2010, 11:29
  3. QToolBar, QWidgetAction, QWidget
    By prof.ebral in forum Newbie
    Replies: 3
    Last Post: 18th February 2010, 20:38
  4. Adding a QWidget to QToolbar
    By qtUser500 in forum Qt Tools
    Replies: 6
    Last Post: 16th October 2009, 19:16
  5. how to add QWidget to QToolBar
    By babu198649 in forum Qt Tools
    Replies: 2
    Last Post: 22nd September 2008, 07:58

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.