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. MenuBarItem remains highlighted after mouse over
Forum Updated to NodeBB v4.3 + New Features

MenuBarItem remains highlighted after mouse over

Scheduled Pinned Locked Moved Solved QML and Qt Quick
8 Posts 2 Posters 699 Views 2 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.
  • fbg13F Offline
    fbg13F Offline
    fbg13
    wrote on last edited by fbg13
    #1

    SOLUTION: add hoverEnabled: true to MenuBar.


    When hovering a MenuBarItem the item remains highlighted after I move the mouse away.
    Video https://i.imgur.com/xw53pUD.mp4

    import QtQuick 2.13
    import QtQuick.Controls 2.13
    
    ApplicationWindow {
        id: window
        width: 320
        height: 260
        visible: true
    
        menuBar: MenuBar {
            Menu {
                title: qsTr("&File")
                Action { text: qsTr("&New...") }
                Action { text: qsTr("&Open...") }
                Action { text: qsTr("&Save") }
                Action { text: qsTr("Save &As...") }
                MenuSeparator { }
                Action { text: qsTr("&Quit") }
            }
            Menu {
                title: qsTr("&Edit")
                Action { text: qsTr("Cu&t") }
                Action { text: qsTr("&Copy") }
                Action { text: qsTr("&Paste") }
            }
            Menu {
                title: qsTr("&Help")
                Action { text: qsTr("&About") }
            }
        }
    }
    

    Any way to remove the highlighting when mouse leaves the item?

    Operating System: openSUSE Tumbleweed 20200114
    KDE Plasma Version: 5.17.5
    KDE Frameworks Version: 5.66.0
    Qt Version: 5.13.1

    1 Reply Last reply
    0
    • SeeLookS Offline
      SeeLookS Offline
      SeeLook
      wrote on last edited by
      #2

      Hi,
      For me it looks more like QQC2 style (Plasma/Kirigami) bug than anything other.
      Try i.e.:

      export QT_QUICK_CONTROLS_STYLE=Fusion
      

      before calling Your example.
      There is not highlight at all in Fusion style (in others I tried neither).

      fbg13F 1 Reply Last reply
      0
      • SeeLookS SeeLook

        Hi,
        For me it looks more like QQC2 style (Plasma/Kirigami) bug than anything other.
        Try i.e.:

        export QT_QUICK_CONTROLS_STYLE=Fusion
        

        before calling Your example.
        There is not highlight at all in Fusion style (in others I tried neither).

        fbg13F Offline
        fbg13F Offline
        fbg13
        wrote on last edited by
        #3

        @SeeLook said in MenuBarItem remains highlighted after mouse over:

        There is not highlight at all in Fusion style (in others I tried neither)

        That's because they don't have hoverEnabled: true, if I add it I get the same behaviour.

        SeeLookS 1 Reply Last reply
        0
        • fbg13F fbg13

          @SeeLook said in MenuBarItem remains highlighted after mouse over:

          There is not highlight at all in Fusion style (in others I tried neither)

          That's because they don't have hoverEnabled: true, if I add it I get the same behaviour.

          SeeLookS Offline
          SeeLookS Offline
          SeeLook
          wrote on last edited by
          #4
          //...
          menuBar: MenuBar {
              hoverEnabled: true
              Menu {
          //...
          

          Indeed...
          But in that case it behaves much more polite: highlight disappears when mouse goes out of tool bar.
          Isn't it bearable enough for You?

          fbg13F 1 Reply Last reply
          0
          • SeeLookS SeeLook
            //...
            menuBar: MenuBar {
                hoverEnabled: true
                Menu {
            //...
            

            Indeed...
            But in that case it behaves much more polite: highlight disappears when mouse goes out of tool bar.
            Isn't it bearable enough for You?

            fbg13F Offline
            fbg13F Offline
            fbg13
            wrote on last edited by
            #5

            @SeeLook said in MenuBarItem remains highlighted after mouse over:

            menuBar: MenuBar {
            hoverEnabled: true
            Menu {

            I meant the MenuBarItem.qml of Fusion was missing hoverEnabled: true and that's were I added it.
            Didn't think of adding it to MenuBar, which does indeed work. Still weird that I have to do that.

            Thanks.

            1 Reply Last reply
            0
            • SeeLookS Offline
              SeeLookS Offline
              SeeLook
              wrote on last edited by
              #6

              OK.
              So, probably the correct way is to call a bug of QQC2 where this hoverEnabled: true statement is missing or so.
              And maybe still, use it as a workaround in custom code.

              And little bit philosophically: I was wondering why it has been unseen so far. Maybe with quite modern QML, a Menu Bar is something rarely in use this days. I can't mention any QML app I know/use with that. Personally I don't use it as well.
              But it is subjective (very), so just ignore me in that matter.

              fbg13F 1 Reply Last reply
              0
              • SeeLookS SeeLook

                OK.
                So, probably the correct way is to call a bug of QQC2 where this hoverEnabled: true statement is missing or so.
                And maybe still, use it as a workaround in custom code.

                And little bit philosophically: I was wondering why it has been unseen so far. Maybe with quite modern QML, a Menu Bar is something rarely in use this days. I can't mention any QML app I know/use with that. Personally I don't use it as well.
                But it is subjective (very), so just ignore me in that matter.

                fbg13F Offline
                fbg13F Offline
                fbg13
                wrote on last edited by
                #7

                @SeeLook said in MenuBarItem remains highlighted after mouse over:

                And little bit philosophically: I was wondering why it has been unseen so far. Maybe with quite modern QML, a Menu Bar is something rarely in use this days. I can't mention any QML app I know/use with that. Personally I don't use it as well.
                But it is subjective (very), so just ignore me in that matter.

                I think people are not using qml much on desktop.
                I know of only one qml application elisa, but it's not using a menu.
                If you know of other open source qml applications please share.

                1 Reply Last reply
                0
                • SeeLookS Offline
                  SeeLookS Offline
                  SeeLook
                  wrote on last edited by SeeLook
                  #8

                  If You like, take a look at mine:
                  https://nootka.sourceforge.io (beta is on QML) - https://github.com/SeeLook/nootka
                  or:
                  https://github.com/SeeLook/Metronomek
                  But neither of them use Menu Bar.
                  Also all KCM modules (Plasma system settings) is on QML and Discover as well but still, no Menu Bar there.
                  However do not bother the fashion, just keep using it when You feel it is suitable for Your needs.

                  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