Some change with input object
This commit is contained in:
@@ -33,15 +33,14 @@ InputObject::~InputObject()
|
|||||||
void InputObject::initUi()
|
void InputObject::initUi()
|
||||||
{
|
{
|
||||||
//#3c3c3c
|
//#3c3c3c
|
||||||
//
|
#ifdef CUTE_STYLE
|
||||||
|
|
||||||
QString style =
|
QString style =
|
||||||
"QWidget#WiBack{background-image: url(:/icons/bg.jpeg);}"
|
"QWidget#WiBack{background-image: url(:/icons/bg.jpeg);}"
|
||||||
"QWidget#WiBo{background-color: black;}"
|
"QWidget#WiBo{background-color: black;}"
|
||||||
"QLineEdit,QDateEdit{background-color: rgba(0,0,0,0.5);\
|
"QLineEdit,QDateEdit{background-color: rgba(0,0,0,0.5);\
|
||||||
min-height:100px;max-height:100px; min-width:500px;max-width:500px;\
|
min-height:100px;max-height:100px; min-width:500px;max-width:500px;\
|
||||||
border: 2px solid #ef9cba; border-radius:20px;\
|
border: 2px solid #ef9cba; border-radius:20px;\
|
||||||
font-family:Arial; color:white;margin:0;font-size:36px;}"
|
font-family:Microsoft YaHei; color:white;margin:0;font-size:36px;}"
|
||||||
"QTextEdit{background-color: rgba(0,0,0,0.5);\
|
"QTextEdit{background-color: rgba(0,0,0,0.5);\
|
||||||
min-height:300px;max-height:300px; min-width:700px;max-width:700px;\
|
min-height:300px;max-height:300px; min-width:700px;max-width:700px;\
|
||||||
border: 2px solid #ef9cba; border-radius:20px;\
|
border: 2px solid #ef9cba; border-radius:20px;\
|
||||||
@@ -49,6 +48,22 @@ void InputObject::initUi()
|
|||||||
"QDateEdit::up-button{image: url(:/up.png);height:15px;}"
|
"QDateEdit::up-button{image: url(:/up.png);height:15px;}"
|
||||||
"QDateEdit::down-button{image:url(:/down.png);height:15px;}"
|
"QDateEdit::down-button{image:url(:/down.png);height:15px;}"
|
||||||
;
|
;
|
||||||
|
#else
|
||||||
|
QString style =
|
||||||
|
"QWidget#WiBack{background-color: #383533;}"
|
||||||
|
"QWidget#WiBo{background-color: black;}"
|
||||||
|
"QLineEdit,QDateEdit,QTextEdit{\
|
||||||
|
background:qlineargradient(x1:0,y1:0,x2:1,y2:1,stop: 0.0 silver, stop: 1.0 grey);\
|
||||||
|
border: 1px solid #1e1b18; border-radius:20px;\
|
||||||
|
font-family:Microsoft YaHei; color:black;margin:0;font-size:36px;}"
|
||||||
|
|
||||||
|
"QLineEdit,QDateEdit{min-height:100px; max-height:100px; min-width:500px; max-width:500px;}"
|
||||||
|
"QTextEdit{min-height:300px;max-height:300px; min-width:700px;max-width:700px;}"
|
||||||
|
|
||||||
|
"QDateEdit::up-button{image: url(:/up.png);height:15px;}"
|
||||||
|
"QDateEdit::down-button{image:url(:/down.png);height:15px;}"
|
||||||
|
;
|
||||||
|
#endif
|
||||||
setStyleSheet(style);
|
setStyleSheet(style);
|
||||||
|
|
||||||
ui->dateEdit->setVisible(false);
|
ui->dateEdit->setVisible(false);
|
||||||
@@ -58,7 +73,7 @@ void InputObject::initUi()
|
|||||||
//this->setWindowOpacity(0.8);
|
//this->setWindowOpacity(0.8);
|
||||||
|
|
||||||
connect(QGuiApplication::inputMethod(), &QInputMethod::visibleChanged, [=]() {
|
connect(QGuiApplication::inputMethod(), &QInputMethod::visibleChanged, [=]() {
|
||||||
if (QGuiApplication::inputMethod()->isVisible())return;
|
if (QGuiApplication::inputMethod()->isVisible()) return;
|
||||||
//qDebug() << "HidePanel";
|
//qDebug() << "HidePanel";
|
||||||
//qDebug() << "focusWidget" << qApp->focusWidget();
|
//qDebug() << "focusWidget" << qApp->focusWidget();
|
||||||
this->HidePanel();
|
this->HidePanel();
|
||||||
@@ -143,45 +158,22 @@ void InputObject::ShowPanel() {
|
|||||||
ui->textEdit->setVisible(true);
|
ui->textEdit->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
//QDesktopWidget w;
|
|
||||||
//int deskWidth = w.availableGeometry().width();
|
|
||||||
//int deskHeight = w.availableGeometry().height();
|
|
||||||
//int vkbHeight = QGuiApplication::inputMethod()->keyboardRectangle().height();
|
|
||||||
|
|
||||||
this->showFullScreen();
|
this->showFullScreen();
|
||||||
this->setVisible(true);
|
this->setVisible(true);
|
||||||
this->activateWindow(); //it is quite important!!!
|
this->activateWindow(); //it is quite important!!!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (curLine) {
|
if (curLine) {
|
||||||
ui->lineEdit->setText(curLine->text());
|
ui->lineEdit->setText(curLine->text());
|
||||||
ui->lineEdit->setEchoMode(curLine->echoMode());
|
ui->lineEdit->setEchoMode(curLine->echoMode());
|
||||||
ui->lineEdit->setInputMethodHints(Qt::InputMethodHint::ImhNoAutoUppercase);
|
ui->lineEdit->setInputMethodHints(Qt::InputMethodHint::ImhNoAutoUppercase);
|
||||||
//qDebug() << "begin";
|
|
||||||
ui->lineEdit->setFocus();
|
ui->lineEdit->setFocus();
|
||||||
//QFocusEvent event0(QEvent::FocusIn);
|
while (QGuiApplication::focusObject() != ui->lineEdit)
|
||||||
//QCoreApplication::sendEvent(ui->lineEdit, &event0);
|
{
|
||||||
while (QGuiApplication::focusObject() != ui->lineEdit)
|
qApp->processEvents();
|
||||||
{
|
}
|
||||||
qApp->processEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
//qDebug() << QGuiApplication::focusObject();
|
|
||||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||||
QCoreApplication::sendEvent(ui->lineEdit, &event);
|
QApplication::sendEvent(ui->lineEdit, &event);
|
||||||
|
|
||||||
// QMouseEvent pressed(QEvent::MouseButtonPress, QPointF(10,10),Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
|
|
||||||
// QApplication::sendEvent(ui->lineEdit, &pressed);
|
|
||||||
// qDebug()<<"release";
|
|
||||||
// QMouseEvent release(QEvent::MouseButtonRelease, QPointF(10,10),Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
|
|
||||||
// QApplication::sendEvent(ui->lineEdit, &release);
|
|
||||||
// qDebug() <<QGuiApplication::focusObject();
|
|
||||||
//qDebug() << "end";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (curDateEdit)
|
if (curDateEdit)
|
||||||
@@ -195,7 +187,7 @@ void InputObject::ShowPanel() {
|
|||||||
}
|
}
|
||||||
qDebug() << QGuiApplication::focusObject();
|
qDebug() << QGuiApplication::focusObject();
|
||||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||||
QCoreApplication::sendEvent(ui->dateEdit, &event);
|
QApplication::sendEvent(ui->dateEdit, &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curText)
|
if (curText)
|
||||||
@@ -208,7 +200,7 @@ void InputObject::ShowPanel() {
|
|||||||
}
|
}
|
||||||
//qDebug() << QGuiApplication::focusObject();
|
//qDebug() << QGuiApplication::focusObject();
|
||||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||||
QCoreApplication::sendEvent(ui->textEdit, &event);
|
QApplication::sendEvent(ui->textEdit, &event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QDateEdit;
|
class QDateEdit;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
|
|
||||||
|
//#define CUTE_STYLE
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class InputObject;
|
class InputObject;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
|
|||||||
//preview scan
|
//preview scan
|
||||||
else{
|
else{
|
||||||
const char * data = GetPreviewData();
|
const char * data = GetPreviewData();
|
||||||
|
if (!data) return;
|
||||||
QByteArray bytes =QByteArray::fromRawData(data,140*140);
|
QByteArray bytes =QByteArray::fromRawData(data,140*140);
|
||||||
TRIGGER_EVENT(GUIEvents::ResponsePreviewData, nullptr, (QObject*)(&bytes));
|
TRIGGER_EVENT(GUIEvents::ResponsePreviewData, nullptr, (QObject*)(&bytes));
|
||||||
delete [] data;
|
delete [] data;
|
||||||
|
|||||||
Reference in New Issue
Block a user