Results 1 to 2 of 2

Thread: Strange behavior of checkable menu items..

  1. #1
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Unhappy Strange behavior of checkable menu items..

    I used Qt Designer to set a

    Qt Code:
    1. QAction *actionTest;
    2. actionTest->setCheckable(true);
    3. actionTest->setChecked(true);
    To copy to clipboard, switch view to plain text mode 


    which is connected to my own action function
    Qt Code:
    1. QObject::connect(ui.actionTest, SIGNAL(activated()), this, SLOT(checkTest()));
    To copy to clipboard, switch view to plain text mode 

    and my checkTest() is as follows:

    Qt Code:
    1. void someClass::checkTest()
    2. {
    3. if(ui.actionTest->isChecked())
    4. ui.actionTest>setChecked ( false );
    5. else
    6. {
    7. ........ // That is where I always jump into
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 


    As we can see, although
    actionTest->setChecked(true);

    has already been set checked, the connected slot function can't see it at all.

    What's wrong? Urgent....

    please help.

    Cheers
    JIA
    Welcome to Vision Open
    http://www.visionopen.com

  2. #2
    Join Date
    Sep 2009
    Location
    Surrey, BC, Canada
    Posts
    110
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Strange behavior of checkable menu items..

    Sorry, now, problem solved.

    Qt embeds some actions inside already.

    Cheers
    JIA
    Welcome to Vision Open
    http://www.visionopen.com

Similar Threads

  1. Replies: 1
    Last Post: 28th July 2009, 06:58
  2. Radio menu items in Designer
    By rbp in forum Qt Tools
    Replies: 0
    Last Post: 31st March 2009, 00:50
  3. designer not showing menu items ...
    By wagmare in forum Installation and Deployment
    Replies: 0
    Last Post: 24th February 2009, 10:26
  4. Combobox with checkable items
    By qtneuling in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2008, 14:42
  5. Want custom menu items, like graphics, but how?
    By rm in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2008, 20:52

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.