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?

How to bind a QString variable and lineEdit?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 1.7k 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.
  • K Offline
    K Offline
    kishore_hemmady
    wrote on 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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 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.

        mrjjM JonBJ 2 Replies Last reply
        0
        • K kishore_hemmady

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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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

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

            JonBJ Online
            JonBJ Online
            JonB
            wrote on 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

            • Login

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