Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dynamically Setting the Tools in a ToolBar
Qt 6.11 is out! See what's new in the release blog

Dynamically Setting the Tools in a ToolBar

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.3k Views 2 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.
  • TavisT Offline
    TavisT Offline
    Tavis
    wrote on last edited by
    #1

    Hello,

    I am developing a mobile app for iOS and I need to be able to have the tools in the toolbar change depending on which page you are on. I found some documentation on how to accomplish this but it looks like it is out of date and the components and methods needed to accomplish this no longer exist.

    This is the document I found: https://doc.qt.io/archives/qtquick-components-symbian-1.1/qml-toolbar.html

    It mentions using the following Components and Methods that seem to be gone now in QT 5.7:

    ToolBarLayout
    PageStack
    setTools() method.

    Is there a newer way of acomplishing dynamic tools in a ToolBar?

    Thanks for any help on this,

    -Tavis

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! There are many ways to do that. But as you said your application uses multiple pages than you can simply use the Page QML Type which has a property header. So each page can have its own ToolBar assigned to header.

      TavisT 1 Reply Last reply
      0
      • ? A Former User

        Hi! There are many ways to do that. But as you said your application uses multiple pages than you can simply use the Page QML Type which has a property header. So each page can have its own ToolBar assigned to header.

        TavisT Offline
        TavisT Offline
        Tavis
        wrote on last edited by
        #3

        @Wieland I do that now with StackViews and I have multiple toolbars. I was trying to get away from having multiple toolbars inside of each StackView and put one ToolBar in the main window and then have the controls in the toolbar change dynamically depending on which StackView you are in.

        I guess the only way is to make my own toolbar and methods to change the visibility of the buttons per page I am on.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          peteritv
          wrote on last edited by
          #4

          This too seems like a regular "State-Transition" problem?

          In one state you want to handle toolbar x, and in another state you want to handle toolbar y?

          See documentation about states and transitions.

          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