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

Expand toolbar

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 1.9k 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.
  • A Offline
    A Offline
    alecs26
    wrote on last edited by
    #1

    Hello,

    I have a toolbar on the left of the screen.

    When I go over a toolbar button with the cursor, I want to expand 4 buttons as:
    picture
    http://www.cjoint.com/c/FLwuQArCebd

    It seems like a classic thing to do. Is there an automated method to do this ?

    Thank you very much,

    Alex

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

      Hi,

      Not that I'm aware of but one possibility could be to add a QMenu to your QToolButton and in there add a QWidgetAction on which you button a custom widget containing the buttons you want.

      Hope it helps

      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
      1
      • A Offline
        A Offline
        alecs26
        wrote on last edited by
        #3

        Thank you very much for the information. I think I found an easy way to do what I want to do. I will post my solution when its finished. However, there is a small problem with it.

        Here is a simplifified example. I have a rectangle with width 113. When I hover over the rectangle, I extend this rectangle width. When I exit the area, I reset the rectangle to its original width.

        This works. However, when I go on the design tab, I get a warning:
        Imperative code is not supported in the Qt Quick Designer. (M203) for the line (rectangle2.width=113 and rectangle2.width=113+107)

            Rectangle
            {
                id: rectangle2
                x: 430
                y: 296
                width: 113
                height: 105
                color: "#000000"
                MouseArea
                {
                    anchors.fill: parent
                    hoverEnabled: true
                 
                    onExited:
                    {
                        rectangle4.visible=false
                        rectangle2.width=113
                    }
                    onEntered:
                    {
                        rectangle4.visible=true
                        rectangle2.width=113+107
                    }
                }
        

        Thank you very much for your help !

        Alex

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          instead of
          rectangle2.width=113+107
          try
          rectangle2.width=220

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alecs26
            wrote on last edited by
            #5

            Thank you for your answer. I still have the same warning with this.
            I also had the warning with the other line (rectangle2.width=113).

            Thank you very much,

            Alex

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

              See here for that warning.

              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
              0
              • A Offline
                A Offline
                alecs26
                wrote on last edited by
                #7

                Ok thank you.
                I'm just not sure to understand.
                Can I ignore this warning ?
                Will my program won't work sometimes because of that ?

                Thank you so much,

                Alex

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

                  AFAIK, That warning tells you that Qt Quick Designer can't handle that kind of stuff not that your code is inherently wrong.

                  Again, AFAIK, The Qt Quick Designer was made to build your UI but not to handle logic in it which is what you added.

                  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
                  0
                  • A Offline
                    A Offline
                    alecs26
                    wrote on last edited by
                    #9

                    Thanks !

                    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