Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to format text as I'm typing?
Forum Updated to NodeBB v4.3 + New Features

How to format text as I'm typing?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 580 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.
  • W Offline
    W Offline
    wost
    wrote on last edited by
    #1

    I want to be able to format text as it's being edited, either programmatically or by writing; but how can I do that? My formatting has two criteria: 1) it has to be a number (either integer or float) and 2) it has to end with ,- (money delimiter in Norway). It has to be done programmatically and by writing, because the end user should be able to input numbers using a custom number inputting component (for touch devices) and keyboards.

    Obviously I can't do this:

    onTextChanged : {
      text: parseInt( price ) + ",-"
    }
    

    As that would result in a loop.
    Is there anything else I could try to do?

    aha_1980A 1 Reply Last reply
    0
    • W wost

      I want to be able to format text as it's being edited, either programmatically or by writing; but how can I do that? My formatting has two criteria: 1) it has to be a number (either integer or float) and 2) it has to end with ,- (money delimiter in Norway). It has to be done programmatically and by writing, because the end user should be able to input numbers using a custom number inputting component (for touch devices) and keyboards.

      Obviously I can't do this:

      onTextChanged : {
        text: parseInt( price ) + ",-"
      }
      

      As that would result in a loop.
      Is there anything else I could try to do?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      hi @wost,

      have you already searched for input mask and input validator?

      Qt has to stay free or it will die.

      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