Results 1 to 12 of 12

Thread: How to get the "text" from checkbox?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    19
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get the "text" from checkbox?

    Okay, my errors look.



    Quote Originally Posted by Zlatomir View Post
    Is tresc a QString or what type is it?
    Yep. QString

    @wysota - zauważyłem, że jesteś z Warszawy. Być może mój angielski ogranicza komunikacje Chodzi o to, że chcę pobrać text label danego checkboxa do zmiennej, aby następnie umieścić go w pliku html. Przykład checkbox o nazwie checMocne_1 o label: "stosuje się do norm społecznych" - no i w zależności czy checkbox jest zaznaczony chcę pobrać ten label i umieścić go w w jakimś miejscu pliku html.

  2. #2
    Join Date
    Nov 2010
    Posts
    20
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get the "text" from checkbox?

    You can use QTextStream :

    Qt Code:
    1. QFile f("test.html");
    2. if (f.open(QIODevice::WriteOnly | QIODevice::Text))
    3. {
    4. QTextStream out(&f);
    5. out << ui->checkMocne_1->text();
    6. f.close();
    7. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to Octal for this useful post:

    Alan_K (19th March 2011)

  4. #3
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    19
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get the "text" from checkbox?

    @Octal Working.

  5. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to get the "text" from checkbox?

    Alan_K, you do realize that the answer was just in front of you?
    And that the problem was not what you said it was?
    And that, next time, you need to say more information about what is not really working (compile/run error, implicated code, type of variables, etc), else everything we can do is guessing.

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2011, 19:21
  2. Replies: 4
    Last Post: 5th March 2010, 18:03
  3. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  4. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

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
  •  
Qt is a trademark of The Qt Company.