Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved]Could QtQuick control design a toolButton with embedded menu?

    QML and Qt Quick
    2
    4
    1063
    Loading More Posts
    • 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.
    • S
      stereomatching last edited by

      Like the graph show(the toolButton with arrow)
      !http://www.qtcentre.org/attachment.php?attachmentid=9182&d=1372070834(img)!
      any ideas?

      1 Reply Last reply Reply Quote 0
      • J
        Jens last edited by

        Not directly by using ToolButton. We have added a "menu" property in Button for convenience but alas, this is not currently exposed to ToolButton. I think will fix that in 5.2

        For the time being, you should be able to work around it like this:
        @
        ToolButton {
        id: menuButton
        iconSource: "images/document-open.png"
        width: 60 // Make some room for the arrow

                Menu {
                    id: toolMenu
                    MenuItem { text: "Some item"}
                }
        
                Image {
                    anchors.right: parent.right
                    anchors.rightMargin: 4
                    anchors.verticalCenter: parent.verticalCenter
                    source: "arrow.png"
                }
                onClicked: toolMenu.popup()
            }
        

        @

        1 Reply Last reply Reply Quote 0
        • J
          Jens last edited by

          Obviously, you need to provide the pixmaps for it to work though :)

          1 Reply Last reply Reply Quote 0
          • S
            stereomatching last edited by

            Thanks for your help, I would try to implement the arrow by Image or Canvas :)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post