Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Probelem with MouseArea and comboBox drop down footer
Qt 6.12 LTS is out! See what's new in the release blog

Probelem with MouseArea and comboBox drop down footer

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 283 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.
  • C Offline
    C Offline
    Cyrille de Brebisson
    wrote on last edited by
    #1

    Hello,
    I have a ComboBox with a list view as a popup. This list view has a footer which needs to change color depending if the mouse is hovering above it or not....
    What I observe is that when I click onthe comboBox and the popUp opens, the mouse area associated with the footer received an onEntered message (which is incorrect as there if 4 or 5 objects in my list view model). This triggers me to set the footer to the hovered color...
    Then, as soon as I move the mouse, even by 1 pixel, the mouse area receives an on exit message, at which point I correctly notice that the mouse is NOT in the footer and change the color...
    It looks as if the system first puts the footer in the control, triggers the mouse area, then adds the rest of the model, but that the mouse are does not get told of the change... But I have not looked in the QT code in details to check...
    Is this a QT bug, or am I missing something?
    Thanks,
    Cyrille

            contentItem: ListView {
                clip: true
                implicitHeight: contentHeight
                model: control.delegateModel
    
                footer: Item {
                    width: parent.width
                    height: control.implicitHeight
    
                    Rectangle {
                        id: footerTopRect
                        // There seems to be a problem in QT here...
                        // When the list popsup, it only has one item, the footer and as a result
                        // the mouse is seen as being in the footer, thus the mouseArea "enters"
                        // and onMore gets set to true...
                        // then the system noticed that there is such thing as a model and "add them"...
                        // this moves the position of the footer, BUT the mouse area onExit is NOT triggered
                        // and onMore stays true, this resulting in the wrong color there...
                        // Unfortunately, this happends AFTER the onOpened signal, so setting onMore to false there does not help...
                        color: comboPopup.onMore ? AppTheme.primaryHover : AppTheme.primaryBlue
                        height: backRect.radius
                        anchors.top:  footerRoundRect.top
                        anchors.left: footerRoundRect.left
                        anchors.right: footerRoundRect.right
                    }
                    MyLabel {
                        anchors.fill: parent
                        leftPadding: 10
                        font.weight: Font.Light
                        text: qsTrId("More")
                    }
                    MouseArea {
                        anchors.fill: parent
                        hoverEnabled: true
                        onEntered: comboPopup.onMore = true
                        onExited: comboPopup.onMore = false
                    }
                }
            }
    
    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
    • Unsolved