Results 1 to 3 of 3

Thread: Is there any other easy-fast way to connect a button and a on/off visualizatn method?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Thanks
    56
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Is there any other easy-fast way to connect a button and a on/off visualizatn method?

    I have a lot of buttons to view/hide elements.
    Each time I have to write the code I have to connect signal & slots. (I must to create a slot for a simple code... )
    I'd like to write a simple :
    Qt Code:
    1. connect (widget,SIGNAL(mouse_click)), other_widget->visible= !(other_widget->visible));
    To copy to clipboard, switch view to plain text mode 
    I could be possible?
    Any trick....
    Thanks

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Is there any other easy-fast way to connect a button and a on/off visualizatn met

    If you have lots of this kind of extra slots, maybe you need a state machine? QStateMachine

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Is there any other easy-fast way to connect a button and a on/off visualizatn met

    Write a simple class using QSignalMapper that will do it for you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 8th March 2011, 22:08
  2. error calling method using connect
    By jeffmetal in forum Newbie
    Replies: 4
    Last Post: 22nd April 2010, 18:09
  3. push button fast activation
    By bhogasena in forum Qt Programming
    Replies: 1
    Last Post: 20th January 2009, 01:48
  4. QObject::connect (fast)
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 22nd February 2008, 06:30

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.