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. Phone Dialpad longpress 0 - directs to +
Forum Updated to NodeBB v4.3 + New Features

Phone Dialpad longpress 0 - directs to +

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 1.2k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    RG90
    wrote on last edited by
    #1

    Hi,

    I am working on dialpad for phone. I have to display + if I press 0 button on dialpad for longtime. As, I am new to qt. I don't have an idea how to develop it. Can anyone help with some suggestions (any sample code).

    Thanks

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi!

      import QtQuick 2.7
      import QtQuick.Controls 2.1
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Row {
              Button {
                  text: "0"
                  onClicked: label.text += "0"
                  onPressAndHold: label.text += "+"
              }
              Label {
                  id: label
              }
          }
      }
      
      1 Reply Last reply
      1
      • Arvindhan PonnusamyA Offline
        Arvindhan PonnusamyA Offline
        Arvindhan Ponnusamy
        wrote on last edited by Arvindhan Ponnusamy
        #3

        Above Abstract Button press and hold available from QtQuick.Controls 2.1 in Qt 5.7 on wards.

        Can also use Mouse Area Press and Hold event.

        import QtQuick 2.5
        import QtQuick.Window 2.2

        Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")

        MainForm {
            anchors.fill: parent
            mouseArea.onPressAndHold: {
                console.log("Press and Hold")
            }
        }
        

        }

        1 Reply Last reply
        1
        • R Offline
          R Offline
          RG90
          wrote on last edited by
          #4

          Hi,

          Thanks for your valuable suggestions. I am using Qt 5.5.1. I don't have nay QtQuick.Contols 2.1. I can only access to QtQuick.Controls 1.4. Can anyone of you suggest on it.

          Thanks.

          1 Reply Last reply
          1
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            In that case, you can use a Timer and the Button's pressed property / onPressedChanged signal to build your own onPressAndHold.

            1 Reply Last reply
            2
            • R Offline
              R Offline
              RG90
              wrote on last edited by
              #6

              Thanks @Wieland . It helped me to get an idea on my work

              1 Reply Last reply
              1

              • Login

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