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. QLineedit's text() isnt working
Qt 6.11 is out! See what's new in the release blog

QLineedit's text() isnt working

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 364 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.
  • C Offline
    C Offline
    christo161
    wrote on last edited by
    #1

    Why isnt working text() in this program?
    https://pastebin.com/WQrqLVG9

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      In the location you are calling QLineEdit::text(), i.e. the constructor, the line edits will all contain nothing because they start that way and have not yet been presented to the user. Converting a blank string to an integer probably gives zero (and a fail code that you are not checking).

      If you want to do something with the user input, for example when they push the OK button, then this should happen in a slot, not the constructor.

      Also, the logic you are using for the date "difference" is not going to work in the general case.

      1 Reply Last reply
      3

      • Login

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