Solved Phone Dialpad longpress 0 - directs to +
-
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
-
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 } } }
-
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.2Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")MainForm { anchors.fill: parent mouseArea.onPressAndHold: { console.log("Press and Hold") } }
}
-
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.
-
In that case, you can use a
Timer
and theButton
'spressed
property /onPressedChanged
signal to build your ownonPressAndHold
. -
Thanks @Wieland . It helped me to get an idea on my work