Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPushButton setMenu under Mac system
Qt 6.11 is out! See what's new in the release blog

QPushButton setMenu under Mac system

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.1k 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.
  • W Offline
    W Offline
    williamzhang
    wrote on last edited by
    #1

    I implemented an app under the Mac OS X platform(10.8.5). I need a button when pressed will popup a menu, so I used a QPushButon and the setMenu method. But I find a trick issue.

    When I pressed the button, the menu will popup. This time the button is in the pressed state(UI is different). Pressed the button again will hidden the popup menu but the button still in pressed state(still in pressed UI).
    If you selected one menu item instead of pressed the button, the button's UI is correct.(in normal state)
    Actually, pressed button even times will let the button in normal state.(minimize the app and restore will show the correct UI)

    I tested this issue under Windows OS, it's OK

    My code:
    @auTrack = new QPushButton(this);
    auTrack->setCursor(Qt::ArrowCursor);
    auTrack->setIcon(QIcon(":audiotrack.png"));
    auTrack->setIconSize(QSize(s_icon_size, s_icon_size));
    auTrack->setFixedSize(s_icon_size, s_icon_size);
    auTrack->setStyleSheet("QPushButton::menu-indicator{ image: None; }");
    auTrack->setEnabled(false);
    auTrack->setFocusPolicy(Qt::NoFocus);
    auTrack->setToolTip(dvb_strings->str[DvbStrings::str_id_audio_tracks]);@

    this is the create and initial setting, when received the specialized event:
    @ if(audNum > 1)
    {
    auTrack->setCursor(Qt::PointingHandCursor);
    auTrack->setEnabled(true);
    auTrack->setMenu(mtengine->auTrackMenu);
    }
    else
    {
    auTrack->setEnabled(false);
    }@

    How can I fix this issue?

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

      I'm totally messed up.
      waiting for help....

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Which version of Qt are you using ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • W Offline
          W Offline
          williamzhang
          wrote on last edited by
          #4

          oh, QT4.8.4
          [quote author="SGaist" date="1386622161"]Hi and welcome to devnet,

          Which version of Qt are you using ?[/quote]

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Can you test with a more up to date version like 4.8.6 ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • W Offline
              W Offline
              williamzhang
              wrote on last edited by
              #6

              The issus is still there
              [quote author="SGaist" date="1414418362"]Can you test with a more up to date version like 4.8.6 ?[/quote]

              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