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. how to select the text on double click in qml spin box
QtWS25 Last Chance

how to select the text on double click in qml spin box

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt 5.7qmlspinbox
2 Posts 2 Posters 1.2k 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.
  • V Offline
    V Offline
    vinaygopal
    wrote on last edited by
    #1

    I have a QML spin box which is editable and on double click it has to select the text, in the latest module of qt5.7 they have removed select by mouse property how can i do this?

    THis is my QML code.

    SpinBox {
            id: spinbox
            from: 0
            value: 0
            to: 358 * 10000
            editable: true
            stepSize: 2.8125 * 10000
            anchors.centerIn: parent
    
            property int decimals: 4
            property real realValue: value / 10000
    
            validator: DoubleValidator {
                bottom: Math.min(spinbox.from, spinbox.to)
                top:  Math.max(spinbox.from, spinbox.to)
            }
    
            textFromValue: function(value, locale) {
                return Number(value / 10000).toLocaleString(locale, 'f', spinbox.decimals)
            }
    
            valueFromText: function(text, locale) {
                return Number.fromLocaleString(locale, text) * 10000
            }
    }
    
    J.HilkJ 1 Reply Last reply
    0
    • V vinaygopal

      I have a QML spin box which is editable and on double click it has to select the text, in the latest module of qt5.7 they have removed select by mouse property how can i do this?

      THis is my QML code.

      SpinBox {
              id: spinbox
              from: 0
              value: 0
              to: 358 * 10000
              editable: true
              stepSize: 2.8125 * 10000
              anchors.centerIn: parent
      
              property int decimals: 4
              property real realValue: value / 10000
      
              validator: DoubleValidator {
                  bottom: Math.min(spinbox.from, spinbox.to)
                  top:  Math.max(spinbox.from, spinbox.to)
              }
      
              textFromValue: function(value, locale) {
                  return Number(value / 10000).toLocaleString(locale, 'f', spinbox.decimals)
              }
      
              valueFromText: function(text, locale) {
                  return Number.fromLocaleString(locale, text) * 10000
              }
      }
      
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @vinaygopal you could customise your Spinbox and set your own TextInput, that one still has the selectByMouse, even if 5.15.8

      https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-spinbox
      https://doc.qt.io/qt-5/qml-qtquick-textinput.html#selectByMouse-prop


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      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