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
QtWS25 Last Chance

Help with buttons please

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 383 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 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
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on 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
      2
      • fcarneyF fcarney

        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 last edited by
        #3

        @fcarney Works for me, thanks!

        1 Reply Last reply
        0
        • IntruderExcluderI Offline
          IntruderExcluderI Offline
          IntruderExcluder
          wrote on last edited by
          #4

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

          C 1 Reply Last reply
          2
          • IntruderExcluderI IntruderExcluder

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

            C Offline
            C Offline
            Circuits
            wrote on last edited by
            #5

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

            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