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. [Solved]Could QtQuick control design a toolButton with embedded menu?
QtWS25 Last Chance

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

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

    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
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      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
      0
      • J Offline
        J Offline
        Jens
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stereomatching
          wrote on last edited by
          #4

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

          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