Results 1 to 2 of 2

Thread: QT5: How can I set QAction Enabled(false)

  1. #1
    Join Date
    Feb 2017
    Qt products
    Qt4 Qt5
    Unix/X11 Windows

    Default QT5: How can I set QAction Enabled(false)

    How can I use signal and slot in QT5 to disable an item in a system tray menu for 2 minutes ?

    QAction* saveUptime = new QAction("Save uptime", trayIconMenu);
    saveUptime->setIcon(app->style()->standardIcon(QStyle::SP_FileDialogDetailedView) );

    QObject::connect(saveUptime, &QAction::triggered,mainWindow, &MainWindow::saveUptime);

    I can execute this function but I cannot from MainWindow change tray icon menu item

    Tray menu is declared in main.cpp

    int main(int argc, char *argv[]) {

  2. #2
    Join Date
    Dec 2009
    New Orleans, Louisiana
    Thanked 153 Times in 150 Posts
    Qt products
    MacOS X

    Default Re: QT5: How can I set QAction Enabled(false)

    Why are you adding this code to your main routine instead of your MainWindow class?
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. QtTreePropertyBrowser enabled but not editable
    By west in forum Qt Programming
    Replies: 5
    Last Post: 29th January 2016, 17:34
  2. Auto-scaling not enabled
    By kulsekarr in forum Qwt
    Replies: 1
    Last Post: 5th June 2014, 08:38
  3. How to get OpenSSL enabled/configured?
    By Mobility in forum Qt Programming
    Replies: 2
    Last Post: 18th November 2012, 09:49
  4. using a DirectShow enabled webcam to take still images in QT
    By Jason Hamilton in forum Qt Programming
    Replies: 4
    Last Post: 8th October 2008, 23:25
  5. QTableWidgetItem not enabled
    By Raccoon29 in forum Newbie
    Replies: 2
    Last Post: 21st March 2008, 18:39

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.