Merge pull request #598 from Vort/value_dial_vkeyb

ValueDial(Z): add virtual keyboard support
This commit is contained in:
f4exb 2020-08-13 13:53:39 +02:00 committed by GitHub
commit e6d9e4758c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include <QMouseEvent>
#include <QPainter>
#include <QWheelEvent>
#include <QApplication>
#include <cstdlib>
#include "gui/valuedial.h"
@ -33,9 +34,12 @@ ValueDial::ValueDial(QWidget *parent, ColorMapper colorMapper) :
setAutoFillBackground(false);
setAttribute(Qt::WA_OpaquePaintEvent, true);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_InputMethodEnabled, true);
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
setInputMethodHints(Qt::ImhDigitsOnly);
m_background.setStart(0, 0);
m_background.setFinalStop(0, 1);
m_background.setCoordinateMode(QGradient::ObjectBoundingMode);
@ -326,6 +330,11 @@ void ValueDial::mousePressEvent(QMouseEvent *event)
}
else if (mouseButton == Qt::LeftButton) // set cursor at current digit
{
if (qApp->autoSipEnabled())
{
QGuiApplication::inputMethod()->show();
}
m_cursor = i;
m_cursorState = true;
m_blinkTimer.start(400);

View File

@ -24,6 +24,7 @@
#include <QWheelEvent>
#include <QKeyEvent>
#include <QLocale>
#include <QApplication>
#include "gui/valuedialz.h"
@ -36,8 +37,10 @@ ValueDialZ::ValueDialZ(bool positiveOnly, QWidget* parent, ColorMapper colorMapp
setAutoFillBackground(false);
setAttribute(Qt::WA_OpaquePaintEvent, true);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_InputMethodEnabled, true);
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
setInputMethodHints(Qt::ImhFormattedNumbersOnly);
m_background.setStart(0, 0);
m_background.setFinalStop(0, 1);
@ -347,6 +350,11 @@ void ValueDialZ::mousePressEvent(QMouseEvent* event)
}
else if (mouseButton == Qt::LeftButton) // set cursor at current digit
{
if (qApp->autoSipEnabled())
{
QGuiApplication::inputMethod()->show();
}
m_cursor = i;
m_cursorState = true;
m_blinkTimer.start(400);