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. Help with buttons please
Forum Update on Monday, May 27th 2025

Help with buttons please

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 389 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.
  • C Offline
    C Offline
    Circuits
    wrote on 3 Dec 2019, 21:33 last edited by
    #1

    Design issues:

    I am building a setup wizard and I am looking for some suggestions and some help with how to implement the buttons. Currently, the wizard has three buttons:

    "Cancel" (blue)
    "Save and Exit" (blue)
    "Next" which changes to "Finished" on the last page. (blue unless they don't have the option of clicking it in which case it is gray because it is disabled)

    I feel like each button should be a different color perhaps? For instance, "Cancel" could be red, "Save and Exit" could be gray and "Next" could be green. However, since the "Next" button can be gray when it isn't allowed to be clicked I don't want the user thinking that "Save and Exit" isn't allowed to be clicked when it is. So perhaps "Cancel" should be red and both "Save and Exit" and "Next" should be green? Perhaps I should have a color change when hovered or clicked?

    Functionality issues:

    Here is an example of what I can figure out with Button

    Button
    {
      id: cancelButton
      width: 150
      height: 50
      contentItem: Text
      {
        text: qsTr("Cancel")
        font: theme ? theme.pushButton.font : internal.font
        color: "white"
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
      }
      background: Rectangle
      {
        radius: 5
        color: cancelButton.down ? "blue" : "red"
      }
      onClicked:
      {
        //on clicked logic goes here
      }
    }
    

    Currently I am not using the color switch shown in Rectangle but I could if it is suggested. The only thing I can't figure out how to do is alter the color of the text or rectangle when the button is being hovered, how might I do that? Is it even possible?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fcarney
      wrote on 3 Dec 2019, 22:45 last edited by
      #2

      There might be another way, but I use a mousearea for that:
      https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#hoverEnabled-prop

      C++ is a perfectly valid school of magic.

      C 1 Reply Last reply 3 Dec 2019, 22:55
      2
      • F fcarney
        3 Dec 2019, 22:45

        There might be another way, but I use a mousearea for that:
        https://doc.qt.io/qt-5/qml-qtquick-mousearea.html#hoverEnabled-prop

        C Offline
        C Offline
        Circuits
        wrote on 3 Dec 2019, 22:55 last edited by
        #3

        @fcarney Works for me, thanks!

        1 Reply Last reply
        0
        • I Offline
          I Offline
          IntruderExcluder
          wrote on 4 Dec 2019, 09:20 last edited by
          #4

          QuckControls 2 already have hovered and hoverEnabled properties, using MouseArea is unnecessary.

          C 1 Reply Last reply 4 Dec 2019, 16:35
          2
          • I IntruderExcluder
            4 Dec 2019, 09:20

            QuckControls 2 already have hovered and hoverEnabled properties, using MouseArea is unnecessary.

            C Offline
            C Offline
            Circuits
            wrote on 4 Dec 2019, 16:35 last edited by
            #5

            @IntruderExcluder Right, I noticed that as well and am not using mouseArea.

            1 Reply Last reply
            0

            1/5

            3 Dec 2019, 21:33

            • Login

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