Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Adding a text to the QTabWidget in c++

Adding a text to the QTabWidget in c++

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    famduck
    wrote on 15 Apr 2013, 09:02 last edited by
    #1

    I have class which inherits QTabWidget. Inside the generated tab I want to display some text.The text should not be editable by the user.But during the application execution there can be a case/s which will cause the text change. Which class should I use for text? Thought about QTextEdit - but it doesn`t look like best idea - since the user should not change the text.Also thought about QTextLabel - but it also is not good - since the application displays text not label.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      prady_80
      wrote on 15 Apr 2013, 09:07 last edited by
      #2

      Why don't you just use QLabel?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        b1gsnak3
        wrote on 15 Apr 2013, 09:15 last edited by
        #3

        You use QLabel and when you want to change the text you emit a signal, connect that signal to QLabel's setText slot and that should do it

        1 Reply Last reply
        0
        • F Offline
          F Offline
          famduck
          wrote on 15 Apr 2013, 09:15 last edited by
          #4

          Is QLabel is designed to update text dynamically?I am looking for the best option for displayed above functionality

          1 Reply Last reply
          0
          • B Offline
            B Offline
            b1gsnak3
            wrote on 15 Apr 2013, 09:19 last edited by
            #5

            Please be more specific about dynamically

            1 Reply Last reply
            0
            • F Offline
              F Offline
              famduck
              wrote on 15 Apr 2013, 09:30 last edited by
              #6

              The user can change modes or insert some input data for application,so the application execution changes:some values application calculates changes,some computation modes changes .
              These changes happen during the application execution and I may want to update the above data every several seconds.In the text (I am asking about) I want to report to the user about every such change

              1 Reply Last reply
              0
              • B Offline
                B Offline
                b1gsnak3
                wrote on 15 Apr 2013, 09:47 last edited by
                #7

                Well, whenever you want to update the data just emit the signal with the text you want... For example, let's say you have a signal updateStatus(QString). The user inputs something and you want to tell him "Hey, you just did something". (This is all assumed to be in your QTabWidget subclass)

                @
                1st. connect(this, SIGNAL(updateStatus(QString)), tabLabel, SLOT(setText(QString)));

                2nd. emit updateStatus("Hey, you just did something");
                @

                This should change your labels text yo Hey, you just did something.

                1 Reply Last reply
                0

                1/7

                15 Apr 2013, 09:02

                • Login

                • Login or register to search.
                1 out of 7
                • First post
                  1/7
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved