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 to detect text is changed in label ?
Forum Updated to NodeBB v4.3 + New Features

How to detect text is changed in label ?

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 7 Posters 4.7k Views 1 Watching
  • 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.
  • asttekinA Offline
    asttekinA Offline
    asttekin
    wrote on last edited by
    #1
    ui->pLabelMaxLimit->setTextInteractionFlags(Qt::TextEditorInteraction);
    

    Label is editable.How do I detect after text is changed.

    raven-worxR 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      QLabels are not meant to be editable, what you want is probably a QLineEdit

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • asttekinA Offline
        asttekinA Offline
        asttekin
        wrote on last edited by
        #3

        I want to use label.Is it not possible with the label?
        Thanks.

        VRoninV 1 Reply Last reply
        0
        • asttekinA asttekin

          I want to use label.Is it not possible with the label?
          Thanks.

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          @asttekin said:

          I want to use label

          Can I ask why?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          asttekinA 1 Reply Last reply
          0
          • asttekinA asttekin
            ui->pLabelMaxLimit->setTextInteractionFlags(Qt::TextEditorInteraction);
            

            Label is editable.How do I detect after text is changed.

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            @asttekin
            this is not possible.
            The (internal) QTextControl is only connected with the 2 link signals.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            1
            • VRoninV VRonin

              @asttekin said:

              I want to use label

              Can I ask why?

              asttekinA Offline
              asttekinA Offline
              asttekin
              wrote on last edited by
              #6

              @VRonin

              https://postimg.org/image/5n87ss101/

              In normally I can set the label to use the line edit and push buttons.But buttons and linedit taking up places in the window.So I don't want to use them.
              I want to change the value directly on the label.

              Thanks.

              jsulmJ VRoninV mrjjM 3 Replies Last reply
              1
              • asttekinA asttekin

                @VRonin

                https://postimg.org/image/5n87ss101/

                In normally I can set the label to use the line edit and push buttons.But buttons and linedit taking up places in the window.So I don't want to use them.
                I want to change the value directly on the label.

                Thanks.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @asttekin What is the difference between label and line edit? Both need space.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • asttekinA asttekin

                  @VRonin

                  https://postimg.org/image/5n87ss101/

                  In normally I can set the label to use the line edit and push buttons.But buttons and linedit taking up places in the window.So I don't want to use them.
                  I want to change the value directly on the label.

                  Thanks.

                  VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by
                  #8

                  @asttekin why not replacing the label with a line edit entirely?

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  asttekinA 1 Reply Last reply
                  3
                  • asttekinA asttekin

                    @VRonin

                    https://postimg.org/image/5n87ss101/

                    In normally I can set the label to use the line edit and push buttons.But buttons and linedit taking up places in the window.So I don't want to use them.
                    I want to change the value directly on the label.

                    Thanks.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @asttekin
                    Hi
                    When you use that flag with a Label it does allow to edit text.
                    However, no signals are emitted so its not possible to know when edit is finished.

                    As the others points out, you should use a lineedit and maybe this signal
                    http://doc.qt.io/qt-5/qlineedit.html#editingFinished

                    User must then press enter to end editing.

                    1 Reply Last reply
                    1
                    • K Offline
                      K Offline
                      karti gesar
                      wrote on last edited by
                      #10

                      use textchage()..when you change the text it will shown in qlabel also

                      Ni.SumiN 1 Reply Last reply
                      0
                      • K karti gesar

                        use textchage()..when you change the text it will shown in qlabel also

                        Ni.SumiN Offline
                        Ni.SumiN Offline
                        Ni.Sumi
                        wrote on last edited by Ni.Sumi
                        #11

                        @karti-gesar

                        use textchage()..when you change the text it will shown in qlabel also.

                        http://doc.qt.io/qt-4.8/qlabel.html#text-prop If you are talking about this, its the slot . If some one connected the lineEdit / some other editable component to the QLabel, then this slot takes the takes the text from the lineEdit to display it on the label, But not from the Label to other component .
                        Any how, both label and line Edit takes place in the GUI and LineEdit more powerful than the Label in your case. So could you please let us know, what's stopping you to shift to lineEdit from the Label ?

                        1 Reply Last reply
                        0
                        • VRoninV VRonin

                          @asttekin why not replacing the label with a line edit entirely?

                          asttekinA Offline
                          asttekinA Offline
                          asttekin
                          wrote on last edited by
                          #12

                          @VRonin

                          OK.

                          thanks.

                          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