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. Button Hover States
Forum Updated to NodeBB v4.3 + New Features

Button Hover States

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 252 Views 1 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.
  • T Offline
    T Offline
    tturgeon4
    wrote on last edited by
    #1

    Hello!

    I am having troubles with my Button hover state not resetting after it opens a new popup. Here is what I am doing:

    Button {
    	id: button
    	hoverEnabled: true
    	height: 26
    	width: 140
    	background: Rectangle {
    		color: parent.hovered ? "red" : "green"
    	}
    	onClicked: {
    	      dialogWindow.open()
    	}
    }
    

    When I click the button and dialogWindow (popup) opens, it is in front of the dialog that contains my button with the button still visible. The button however stays the red color rather than reverting back to green. After some debugging it seems that my mouse is still being registered as inside the button when the new dialog opens. How do I fix this issue?

    1 Reply Last reply
    0
    • W Offline
      W Offline
      Winz 0
      wrote on last edited by
      #2

      It's working as expected on both linux debian 12 & windows 11 with Qt6.8.0
      I tried this code :

      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Button {
              id: button
              hoverEnabled: true
              height: 26
              width: 140
              background: Rectangle {
                  color: parent.hovered ? "red" : "green"
              }
              onClicked: {
                    dialogWindow.open()
              }
          }
      
          Popup {
                   id: dialogWindow
                   x: 100
                   y: 100
                   width: 200
                   height: 300
                   modal: true
                   focus: true
                   closePolicy: Popup.CloseOnEscape
               }
      }
      
      
      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