Results 1 to 2 of 2

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

  1. #1
    Join Date
    Feb 2017
    Posts
    2
    Qt products
    Qt4 Qt5
    Platforms
    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 ?

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

    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
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    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, 18:34
  2. Auto-scaling not enabled
    By kulsekarr in forum Qwt
    Replies: 1
    Last Post: 5th June 2014, 09:38
  3. How to get OpenSSL enabled/configured?
    By Mobility in forum Qt Programming
    Replies: 2
    Last Post: 18th November 2012, 10:49
  4. using a DirectShow enabled webcam to take still images in QT
    By Jason Hamilton in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2008, 00:25
  5. QTableWidgetItem not enabled
    By Raccoon29 in forum Newbie
    Replies: 2
    Last Post: 21st March 2008, 19:39

Tags for this Thread

Bookmarks

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.