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. QRegularExpression limit line edit box to 1-50?
Forum Updated to NodeBB v4.3 + New Features

QRegularExpression limit line edit box to 1-50?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 262 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
    Calicoder
    wrote on last edited by
    #1

    Good day fellow QT'ers, been fooling around in QT Creator and am trying to limit a QLineEdit I have to only accept numbers between 1 to 50 with this:

    QRegularExpression("[1-9]{0,1}")
    

    Been reading up on the docs for QRegularExpression and don't see a way to limit it to 50 as I'm able to type up to 99. Any ideas?

    Appreciate the help!

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Use a QSpinBox, set min/max appropriately.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      C 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        Use a QSpinBox, set min/max appropriately.

        C Offline
        C Offline
        Calicoder
        wrote on last edited by
        #3

        @Christian-Ehrlicher Cool I'll try that 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