Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] qtoolbar: one under the other

[solved] qtoolbar: one under the other

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    broadpeak
    wrote on last edited by
    #1

    I have two toolbar.
    I'd like to put one under the other (or one next the other...) programatically.
    How can I solve this?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KA51O
      wrote on last edited by
      #2

      I did something like this:

      @
      QWidget* widget = new QWidget();
      QVBoxLayout* widgetLayout = new QVBoxLayout();

      QToolBar* widgetToolbar1 = new QToolBar(widget);

      QAction* newAction = new QAction(QIcon(":/File/new-icon64.png"), tr("New"), widgetToolbar1);
      newAction->setToolTip(tr("Create a New Page"));
      widgetToolbar1->addAction(newAction);
      connect(newAction, SIGNAL(triggered()), this, SLOT(onClickNew()));

      //add more actions

      QToolBar* widgetToolbar2 = new QToolBar(widget);

      QAction* boldAction = new QAction(QIcon(":/Text_Format/bold-icon64.png"), "Bold", widgetToolbar2);
      boldAction->setToolTip(tr("Toggle the Current Selection 'bold' Property"));
      widgetToolbar2->addAction(boldAction);
      connect(boldAction, SIGNAL(triggered()), this, SLOT(onClickBold()));

      //add more actions

      widgetLayout->setContentsMargins(0, 0, 0, 0);
      widgetLayout->setSpacing(0);
      widgetLayout->addWidget(widgetToolbar1);
      widgetLayout->addWidget(widgetToolbar2);
      widget->setLayout(widgetLayout);
      @

      1 Reply Last reply
      0
      • B Offline
        B Offline
        broadpeak
        wrote on last edited by
        #3

        Thanks the idea "KA51O"!

        Anyway, in the meantime I have found a solution :)

        (MainWindow::)addToolBarBreak(Qt::LeftToolBarArea);

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved