QPushButton setMenu under Mac system



  • 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?



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


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Which version of Qt are you using ?



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

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


  • Lifetime Qt Champion

    Can you test with a more up to date version like 4.8.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]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.