Results 1 to 3 of 3

Thread: using QCheckBox->text() from QThread

  1. #1
    Join Date
    Dec 2009
    Posts
    29
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Default using QCheckBox->text() from QThread

    I know it is not possible to do GUI operations from a QThread but I was wondering if it is possible to read the text of something like a QComboBox or a QRadioButton or QLineEdit etc from the QThread in question.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: using QCheckBox->text() from QThread

    No! Do not do that.

    There are a couple of things you can do to get that information in your thread.
    1. Create a settings file that you open from within the object in your thread.
    2. Pass the settings to the object in your thread before starting the thread.
    3. Use signals and slots between your ui and the object in your thread.

  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: using QCheckBox->text() from QThread

    4. Have a simple variable (QString) somewhere that holds the value and read from this variable (remember about protecting it with a mutex if the value of the variable may be changing).
    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. QCheckBox with long text label
    By Ferdous in forum Newbie
    Replies: 5
    Last Post: 29th October 2011, 19:05
  2. Custom ListWidget(QCheckBox + Icon + Text)
    By nrabara in forum Newbie
    Replies: 6
    Last Post: 13th May 2010, 06:35
  3. QCheckBox value
    By Koas in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2009, 13:33
  4. Replies: 1
    Last Post: 3rd September 2008, 14:16
  5. QCheckbox
    By sonuani in forum Qt Programming
    Replies: 1
    Last Post: 19th February 2008, 13:12

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.