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. How I Can change text on the button
QtWS25 Last Chance

How I Can change text on the button

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 1.8k 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.
  • N Offline
    N Offline
    Nexicoll
    wrote on last edited by
    #1

    I have function
    @void RepeatQuestion@
    and when i want to change the text on the button, that don't work. I tried
    @Ui_MainWindow.pushButton->SetText("")@ @Ui_MainWindow->pushButton->SetText("")@ @Ui::MainWindow.pushButton->SetText("")@
    and
    @Ui::MAinWindow->pushButton->SetText("")@

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      Could you post MainWindow declaration.

      If you use MainWindow that was created by QtCreator wizard then
      @
      ui->pushButton->setText("Hello");
      @

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nexicoll
        wrote on last edited by
        #3

        When i write @ ui->@ i see "ui is not declarate"

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          Could you post MainWindow declaration.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nexicoll
            wrote on last edited by
            #5

            http://wklej.to/S7qvO

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andreyc
              wrote on last edited by
              #6

              There is no MainWindoww include in the source file.
              @
              #include "MainWindoww.h"
              @

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Nexicoll
                wrote on last edited by
                #7

                http://wklej.to/qyZm6

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andreyc
                  wrote on last edited by
                  #8

                  void ReWriteQuestion(string files) is not a part of MainWindoww.
                  That is why you are getting "ui is not declared".

                  Add it to the MainWindoww declaration and change the definition accordingly.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    Nexicoll
                    wrote on last edited by
                    #9

                    How :( ?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andreyc
                      wrote on last edited by
                      #10

                      @
                      class MainWindoww : public ......
                      {
                      .....
                      void ReWriteQuestion(string files)
                      .....
                      };
                      @

                      @
                      void MainWindoww::ReWriteQuestion(string files)
                      {
                      ......
                      ui->pushButton->setText("C++ rocks");
                      ......
                      }
                      @

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        Nexicoll
                        wrote on last edited by
                        #11

                        Thank You, mean :)

                        1 Reply Last reply
                        0

                        • Login

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