Results 1 to 11 of 11

Thread: Qpushbutton do something until click other button

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qpushbutton do something until click other button

    Well, then call connectToHost() in the start slot and disconnectFromHost() in the stop slot.

    Cheers,
    _

  2. #2
    Join Date
    Feb 2016
    Posts
    16
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qpushbutton do something until click other button

    I can't do this because I have an other function do something over Qtcpsocket also in my program

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qpushbutton do something until click other button

    I am afraid I don't understand.

    How are you expecting a client socket to work if you don't let it connect to the server?

    Cheers,
    _

  4. #4
    Join Date
    Feb 2016
    Posts
    16
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qpushbutton do something until click other button

    my mean I can't disconnectFromHost()

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qpushbutton do something until click other button

    Ah.
    If you connect/disconnect in other places, then your start/stop slot could just set/unset a member variable (e.g. setting a bool member to true on start and to false on stop).
    The slot that deals with incoming data then just need to check that value before adding text to the text edit, etc.

    Cheers,
    _

Similar Threads

  1. QPushButton Click not working in GUI
    By alistair in forum Newbie
    Replies: 7
    Last Post: 14th July 2015, 15:51
  2. Using double click in QPushButton
    By nikbits in forum Newbie
    Replies: 1
    Last Post: 16th September 2011, 11:28
  3. QPushButton click
    By qutron in forum Newbie
    Replies: 2
    Last Post: 29th November 2010, 14:47
  4. QPushButton deleting itself on click
    By Cruz in forum Qt Programming
    Replies: 4
    Last Post: 23rd January 2009, 09:18
  5. QPushButton on Shift+Click?
    By vishal.chauhan in forum Qt Programming
    Replies: 3
    Last Post: 9th September 2008, 10:00

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.