Results 1 to 3 of 3

Thread: disable/enable shortcut

  1. #1
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default disable/enable shortcut

    hello,

    i have a problem with a menu i created. i want to set a shortcut and disable it until a picture is loaded. the button doesn't work while setEnabled is false, but the shortcut works even if the button is disabled. how can i disable the shortcut too?

    Code:

    /* zoomInAction entry*/
    zoomInAct = new QAction(tr("Zoom &In"), this);
    connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
    zoomInAct->setShortcut(tr("Ctrl++"));
    zoomInAct->setEnabled(false);
    viewMenu->addAction(zoomInAct);

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable/enable shortcut

    Well, this sounds like a bug...
    Try using action->blockSignals( true ) while you load the image and blockSignals( false ) when you finished loading the image.

    Regards

  3. #3
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: disable/enable shortcut

    yes that worked
    thanks

Similar Threads

  1. Discovery free Shortcut CTRL+S on QTextBrowser
    By patrik08 in forum Qt Programming
    Replies: 0
    Last Post: 4th May 2007, 10:51
  2. Shortcut for QMenu
    By Ryhel in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2007, 12:57
  3. Strange shortcut problem
    By blukske in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2007, 11:26
  4. Qt 4.2 Shortcut Management
    By dvmorris in forum Qt Programming
    Replies: 20
    Last Post: 5th March 2007, 21:48
  5. shortcut with more than one key
    By ChasW in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2007, 07:38

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.