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
Forum Updated to NodeBB v4.3 + New Features

Switch between different QToolBars

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 369 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 2 Dec 2018, 17:22 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Dec 2018, 21:18 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

      1/2

      2 Dec 2018, 17:22

      • Login

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