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. [solved] return a qstring of a line by lineposition of a plaintextedit
Forum Updated to NodeBB v4.3 + New Features

[solved] return a qstring of a line by lineposition of a plaintextedit

Scheduled Pinned Locked Moved General and Desktop
35 Posts 5 Posters 4.8k 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.
  • Karoluss96K Karoluss96

    I changed plaintextEdit to textEdit, but setplaceholder is the same.

    plainText must be a string or list string?

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #23

    @Karoluss96
    What is going on here? Did you read what setPlaceHolder() does? It will only show anything if the text edit is empty. Is it? Is that what you really want anyway?

    As @jsulm & I say, why don't you try reading the documentation and make the appropriate calls, rather than guessing and asking about each thing?

    1 Reply Last reply
    0
    • jsulmJ jsulm

      @Karoluss96 Why don't you simply read the documentation?!
      https://doc.qt.io/qt-6/qtextedit.html#setText
      https://doc.qt.io/qt-6/qtextedit.html#setPlainText
      https://doc.qt.io/qt-6/qtextedit.html#placeholderText-prop

      Karoluss96K Offline
      Karoluss96K Offline
      Karoluss96
      wrote on last edited by
      #24

      @jsulm Thank I've already read it

      jsulmJ 1 Reply Last reply
      0
      • Karoluss96K Karoluss96

        @jsulm Thank I've already read it

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

        @Karoluss96 said in [solved] return a qstring of a line by lineposition of a plaintextedit:

        Thank I've already read it

        OK, and what is the problem?

        1 Reply Last reply
        0
        • Karoluss96K Offline
          Karoluss96K Offline
          Karoluss96
          wrote on last edited by
          #26

          In Text Edit I want to see eg.:

          'wait - waiting for data
          protocol - data in protocol
          end_of_contr - the end of control '

          each record from sql query must be in new line separatly

          not only last line (in example: 'end_of_contr - the end of control ')

          jsulmJ JonBJ 3 Replies Last reply
          0
          • Karoluss96K Karoluss96

            In Text Edit I want to see eg.:

            'wait - waiting for data
            protocol - data in protocol
            end_of_contr - the end of control '

            each record from sql query must be in new line separatly

            not only last line (in example: 'end_of_contr - the end of control ')

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #27
            This post is deleted!
            1 Reply Last reply
            0
            • Karoluss96K Karoluss96

              In Text Edit I want to see eg.:

              'wait - waiting for data
              protocol - data in protocol
              end_of_contr - the end of control '

              each record from sql query must be in new line separatly

              not only last line (in example: 'end_of_contr - the end of control ')

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

              @Karoluss96 said in [solved] return a qstring of a line by lineposition of a plaintextedit:

              not only last line (in example: 'end_of_contr - the end of control ')

              Then what does plainText contain before you add it to the text edit? And what does a contain? Did you do any debugging to find out why only last line is added?

              Hint: if you call setText() it REPLACES what was added before...

              Karoluss96K 1 Reply Last reply
              0
              • Karoluss96K Karoluss96

                In Text Edit I want to see eg.:

                'wait - waiting for data
                protocol - data in protocol
                end_of_contr - the end of control '

                each record from sql query must be in new line separatly

                not only last line (in example: 'end_of_contr - the end of control ')

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #29

                @Karoluss96
                Have already answered this several times above. Meanwhile, do you really intend to use setPlaceholderText() for what you want? Or do you intend to not answer?

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @Karoluss96 said in [solved] return a qstring of a line by lineposition of a plaintextedit:

                  not only last line (in example: 'end_of_contr - the end of control ')

                  Then what does plainText contain before you add it to the text edit? And what does a contain? Did you do any debugging to find out why only last line is added?

                  Hint: if you call setText() it REPLACES what was added before...

                  Karoluss96K Offline
                  Karoluss96K Offline
                  Karoluss96
                  wrote on last edited by
                  #30

                  @jsulm said in [solved] return a qstring of a line by lineposition of a plaintextedit:

                  Then what does plainText contain before you add it to the text edit? And what does a contain? Did you do any debugging to find out why only last line is added?
                  Hint: if you call setText() it REPLACES what was added before...

                  I debuged by print(). Console present all options good, in lines one by one. I removed placeHolderText for setText but as the documentation (and you) says it also replace the lines one-by-one, wheras I need that all lines must stay in textEdit

                  jsulmJ 1 Reply Last reply
                  0
                  • Karoluss96K Karoluss96

                    @jsulm said in [solved] return a qstring of a line by lineposition of a plaintextedit:

                    Then what does plainText contain before you add it to the text edit? And what does a contain? Did you do any debugging to find out why only last line is added?
                    Hint: if you call setText() it REPLACES what was added before...

                    I debuged by print(). Console present all options good, in lines one by one. I removed placeHolderText for setText but as the documentation (and you) says it also replace the lines one-by-one, wheras I need that all lines must stay in textEdit

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

                    @Karoluss96 If you want to keep what is already there then why don't you simply do

                    self.dlg.plainTextEdit.setText(self.dlg.plainTextEdit.text() + plainText)
                    
                    JonBJ 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Karoluss96 If you want to keep what is already there then why don't you simply do

                      self.dlg.plainTextEdit.setText(self.dlg.plainTextEdit.text() + plainText)
                      
                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #32

                      @jsulm , @Karoluss96
                      Who knows what the OP actually wants?! But even simpler for that would be

                      self.dlg.plainTextEdit.appendPlainText(plainText)
                      

                      (It might put in an extra \n before the new text, because it talks about "Appends a new paragraph with text to the end of the text edit.", not sure.)

                      1 Reply Last reply
                      1
                      • Karoluss96K Offline
                        Karoluss96K Offline
                        Karoluss96
                        wrote on last edited by
                        #33

                        @jsulm @JonB Guys, both options are works!!!

                        Thanks for helping ... and keeping patient for me!
                        (I have a new roomate in my work, but I don't know at what hour he appear, so I have a little stress. Finally he appears... a little after presenting last your answers :-D)

                        JonBJ 1 Reply Last reply
                        1
                        • Karoluss96K Karoluss96

                          @jsulm @JonB Guys, both options are works!!!

                          Thanks for helping ... and keeping patient for me!
                          (I have a new roomate in my work, but I don't know at what hour he appear, so I have a little stress. Finally he appears... a little after presenting last your answers :-D)

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #34

                          @Karoluss96 It was your roommate's fault ;-)

                          1 Reply Last reply
                          0
                          • Karoluss96K Offline
                            Karoluss96K Offline
                            Karoluss96
                            wrote on last edited by
                            #35

                            Ha, ha, ha @JonB :-D

                            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