Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to bind a QString variable and lineEdit?
Forum Updated to NodeBB v4.3 + New Features

How to bind a QString variable and lineEdit?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 1.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.
  • K Offline
    K Offline
    kishore_hemmady
    wrote on 2 Apr 2018, 10:13 last edited by
    #1

    I have many QString variables which I'm displaying in the UI lineEdits by ui->lineEdit->setText(var1) function.When the user changes the value in the lineEdit corresponding QString variable should also update.I DONT want lineEdits to send signals,instead I want bind each variable with its corresponding lineEdit i.e when either of them change other should change.Is it possible?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 2 Apr 2018, 10:16 last edited by
      #2

      Hi
      No, its not possible.
      Signal and slots are how it works.
      You cannot bind a variable to lineEdit as such.

      Why dont you want to use signals ? its how widgets are designed to work. :)

      1 Reply Last reply
      1
      • K Offline
        K Offline
        kishore_hemmady
        wrote on 2 Apr 2018, 10:22 last edited by
        #3

        I have some 100s of lineEdits in Multiple Stackedwidget pages.I dont want to apply signals and slots to all of them.

        M J 2 Replies Last reply 2 Apr 2018, 10:48
        0
        • K kishore_hemmady
          2 Apr 2018, 10:22

          I have some 100s of lineEdits in Multiple Stackedwidget pages.I dont want to apply signals and slots to all of them.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 2 Apr 2018, 10:48 last edited by
          #4

          @kishore_hemmady
          But without TextChanged signal or similar, how can you know text have been changed ?

          1 Reply Last reply
          2
          • K kishore_hemmady
            2 Apr 2018, 10:22

            I have some 100s of lineEdits in Multiple Stackedwidget pages.I dont want to apply signals and slots to all of them.

            J Online
            J Online
            JonB
            wrote on 2 Apr 2018, 13:10 last edited by
            #5

            @kishore_hemmady
            You have to use signals/slots. Write some code to encapsulate the signal/slot linkage between lineEdit & variable generically, then set them up dynamically if you don't want to type in all the links manually.

            1 Reply Last reply
            0

            1/5

            2 Apr 2018, 10:13

            • Login

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