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. Switch between different QToolBars
Qt 6.11 is out! See what's new in the release blog

Switch between different QToolBars

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 734 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Jendker
    wrote on last edited by
    #1

    Hello everyone,

    I wanted to ask what would be recommended approach to switch between different toolbars? I want to make the toolbar dependant on the currently select main tab of the application and show only relevant icons at the moment. I could just create the vectors and call hide and show for specific icons, but maybe there is something cleaner?

    Should I maybe try to:

    • create multiple toolbars and hide not needed with QWidget::setVisible(bool)
    • or is there maybe a way to pack the icons in the one toolbar in some container (QStackedWidget would be desired) and switch between the container pages as required? I can basically add widget to QToolBar, but still I don't know if it does make sense, because I am not sure how to put the necessary icons in QStackedWidget pages?

    or should I just leave it and try the simplest possible approach with vectors?

    I am asking, because maybe there is some clean way of creating paged toolbar and I am just missing it.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Since you have specific actions related to specific tabs, the most clean would be to have one QToolBar per tab and show/hide the toolbar based on the currently shown tab. This will keep things grouped.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3

      • Login

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