Results 1 to 3 of 3

Thread: [QtDesigner] Multiple rows of QToolBar

  1. #1
    Join Date
    May 2012
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [QtDesigner] Multiple rows of QToolBar

    Hello,

    I've been struggling for quite some time with this problem, and unfortunately Google failed to help me find a solution.
    I want to design a window with multiple QToolBars on top of the window. These QToolBars (currently have 5 of them) are supposed to be in 2 rows. The problem is that in QtDesigner it looks good, I have them grouped into 2 rows, but when I compile it, it all messes up. It put last 4 toolbars in second row, and only first toolbar is in first row. I've been reading about using:
    Qt Code:
    1. QMainWindow::addToolBarBreak ( Qt::ToolBarArea area = Qt::TopToolBarArea );
    To copy to clipboard, switch view to plain text mode 
    but the problem is that I'm using QtDesigner, so I can't really use that (or is there some kind of functionality in QtDesigner like 'Cutomize Code' similiar to what's implemented in Netbeans?). Thanks in advance for your help, and sorry for me average English, still learning.

  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: [QtDesigner] Multiple rows of QToolBar

    In your Designer file, you have given each toolbar a unique name, haven't you? In your main window constructor, after you have called setupUi(), call

    Qt Code:
    1. QToolBar * firstBarSecondLine = ui->whateverTheToolbarIsNamed;
    2. insertToolbarBreak( firstBarSecondLine );
    To copy to clipboard, switch view to plain text mode 

    This should insert a line break before the firstBarSecondLine tool bar.

    There is probably a way to do this in .ui file code (maybe not interactively using the Designer), but I don't know how.

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

    Malutek (19th January 2013)

  4. #3
    Join Date
    May 2012
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QtDesigner] Multiple rows of QToolBar

    That was exactly what I was looking for. Thank you very much d_stranz!

Similar Threads

  1. how to set the QToolBar's actions to multiple rows
    By fly542 in forum Qt Programming
    Replies: 2
    Last Post: 25th July 2011, 03:00
  2. QTableView: Select multiple rows?
    By realdarkman71 in forum Newbie
    Replies: 2
    Last Post: 9th December 2010, 21:36
  3. add multiple rows at a time in tablewidgets
    By rk0747 in forum Qt Programming
    Replies: 0
    Last Post: 15th April 2010, 06:54
  4. QTableWidget - Select multiple rows.
    By wally in forum Qt Programming
    Replies: 2
    Last Post: 21st October 2008, 17:15
  5. [QT4] QTreeView and rows with multiple lines
    By KShots in forum Qt Programming
    Replies: 8
    Last Post: 30th March 2006, 18:47

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.