kopia lustrzana https://github.com/f4exb/sdrangel
ValueDial(Z): add virtual keyboard support
rodzic
e704689be1
commit
73b221f055
|
@ -21,6 +21,7 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <QApplication>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "gui/valuedial.h"
|
#include "gui/valuedial.h"
|
||||||
|
@ -33,9 +34,12 @@ ValueDial::ValueDial(QWidget *parent, ColorMapper colorMapper) :
|
||||||
setAutoFillBackground(false);
|
setAutoFillBackground(false);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
||||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||||
|
setAttribute(Qt::WA_InputMethodEnabled, true);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
|
setInputMethodHints(Qt::ImhDigitsOnly);
|
||||||
|
|
||||||
m_background.setStart(0, 0);
|
m_background.setStart(0, 0);
|
||||||
m_background.setFinalStop(0, 1);
|
m_background.setFinalStop(0, 1);
|
||||||
m_background.setCoordinateMode(QGradient::ObjectBoundingMode);
|
m_background.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
|
@ -326,6 +330,11 @@ void ValueDial::mousePressEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
else if (mouseButton == Qt::LeftButton) // set cursor at current digit
|
else if (mouseButton == Qt::LeftButton) // set cursor at current digit
|
||||||
{
|
{
|
||||||
|
if (qApp->autoSipEnabled())
|
||||||
|
{
|
||||||
|
QGuiApplication::inputMethod()->show();
|
||||||
|
}
|
||||||
|
|
||||||
m_cursor = i;
|
m_cursor = i;
|
||||||
m_cursorState = true;
|
m_cursorState = true;
|
||||||
m_blinkTimer.start(400);
|
m_blinkTimer.start(400);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
#include "gui/valuedialz.h"
|
#include "gui/valuedialz.h"
|
||||||
|
|
||||||
|
@ -36,8 +37,10 @@ ValueDialZ::ValueDialZ(bool positiveOnly, QWidget* parent, ColorMapper colorMapp
|
||||||
setAutoFillBackground(false);
|
setAutoFillBackground(false);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
||||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||||
|
setAttribute(Qt::WA_InputMethodEnabled, true);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
setInputMethodHints(Qt::ImhFormattedNumbersOnly);
|
||||||
|
|
||||||
m_background.setStart(0, 0);
|
m_background.setStart(0, 0);
|
||||||
m_background.setFinalStop(0, 1);
|
m_background.setFinalStop(0, 1);
|
||||||
|
@ -347,6 +350,11 @@ void ValueDialZ::mousePressEvent(QMouseEvent* event)
|
||||||
}
|
}
|
||||||
else if (mouseButton == Qt::LeftButton) // set cursor at current digit
|
else if (mouseButton == Qt::LeftButton) // set cursor at current digit
|
||||||
{
|
{
|
||||||
|
if (qApp->autoSipEnabled())
|
||||||
|
{
|
||||||
|
QGuiApplication::inputMethod()->show();
|
||||||
|
}
|
||||||
|
|
||||||
m_cursor = i;
|
m_cursor = i;
|
||||||
m_cursorState = true;
|
m_cursorState = true;
|
||||||
m_blinkTimer.start(400);
|
m_blinkTimer.start(400);
|
||||||
|
|
Ładowanie…
Reference in New Issue