In the below code i want to , If i select / click Patient Type button. them in the menu "xmenumain" "Pediatric ECG" item should be disabled (it should list in the menu list but coloured in faded grey) . how do i achieve it ?
void MyMenu::cppSlot()
    {
     xmenumain = new QMenu;
    xmenumain->addAction("                   X",this, SLOT (call_exit(xmenumain)));
    xmenumain->addAction ( "Edit User Settings" , this , SLOT (call_a()) );
    xmenumain->addAction ( "Parameters" , this , SLOT (call_b()) );
    xmenumain->addAction ( "Sound Adjust" , this , SLOT (call_c()) );
    xmenumain->addAction ( "Patient Type" , this , SLOT (call_d()) );
    xmenumain->addAction ( "Pediatric ECG" , this , SLOT (call_d()) );
    xmenumain->addAction ( "Data Output" , this , SLOT (call_d()) );
    xmenumain->addAction ( "Set Time & Date" , this , SLOT (call_d()) );
    xmenumain->addAction ( "Sweepspeed" , this , SLOT (call_d()) );
    xmenumain->addAction ( "Respspeed" , this , SLOT (call_d()) );
    //xmenumain->popup( QCursor::pos() );
    //Change font and width
    xmenumain->setFont(QFont ("Courier", 13));
    xmenumain->setFixedWidth(250);
    //Colour setting
    QPalette palette=xmenumain->palette();
    palette.setColor(QPalette::Background, Qt::darkGray);
    xmenumain->setPalette(palette);
    //xmenumain->languageChange();
    //xmenumain->setAutoFillBackground(true);
    // Align the menu coordinates
    xmenumain->move(940,370);
    xmenumain->show();
    /*if(!(xmenumain->isEnabled()))
    {
        xmenumain->show();
    }*/
}
                You should have a QAction object:
QAction *action = new QAction("Pediatric ECG");
connect(action, SIGNAL(triggered), this, SLOT(...));
action->setEnabled(false);
xmenumain->addAction(action);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With