Introduce InputObject to project, it's a modal dialog for text input.
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
#include "InputObject.h"
|
||||
#include "ui_InputObject.h"
|
||||
#include "qdesktopwidget.h"
|
||||
#include "ui_inputobject.h"
|
||||
//#include "qdesktopwidget.h"
|
||||
#include <QDebug>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QComboBox>
|
||||
#include <QDateEdit>
|
||||
#include <QtVirtualKeyboard>
|
||||
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QAbstractSpinBox>
|
||||
|
||||
InputObject::InputObject(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::InputObject)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
||||
initUi();
|
||||
|
||||
|
||||
this->setVisible(false);
|
||||
this->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
|
||||
|
||||
@@ -28,73 +30,86 @@ InputObject::~InputObject()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void InputObject::initUi()
|
||||
void InputObject::initUi()
|
||||
{
|
||||
//#3c3c3c
|
||||
//
|
||||
|
||||
QString style = "*{background-color:#3c3c3c; font-family:Arial; color:white;margin:0;font-size:16px;}"
|
||||
"QLabel#title{font-Size:98px;color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
|
||||
"stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);}"
|
||||
"QLabel#warn{color:#930000;background:transparent;font-size:20px;}"
|
||||
"QFrame#login_frame_username{min-width:700px;max-width:700px;max-height:500px;min-height:500px;"
|
||||
"border:1px solid #0078d8;border-radius:20px;"
|
||||
"background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n"
|
||||
" stop: 0.0 darkgray, stop: 0.5 gray, stop: 1.0 darkgray);"
|
||||
"}"
|
||||
|
||||
|
||||
"QLineEdit,QDateEdit{min-height:100px;max-height:100px; min-width:250px;max-width:250px;border: 3px solid pink; border-radius:10px;font-size:26px;}"
|
||||
"QLineEdit,QDateEdit:enabled{background-color: #515151}"
|
||||
QString style =
|
||||
"QWidget#WiBack{background-image: url(:/icons/bg.jpeg);}"
|
||||
"QWidget#WiBo{background-color: black;}"
|
||||
"QLineEdit,QDateEdit{background-color: rgba(0,0,0,0.5);\
|
||||
min-height:100px;max-height:100px; min-width:500px;max-width:500px;\
|
||||
border: 2px solid #ef9cba; border-radius:20px;\
|
||||
font-family:Arial; color:white;margin:0;font-size:36px;}"
|
||||
"QDateEdit::up-button{image: url(:/up.png);height:15px;}"
|
||||
"QDateEdit::down-button{image:url(:/down.png);height:15px;}"
|
||||
;
|
||||
setStyleSheet(style);
|
||||
this->setWindowOpacity(0.8);
|
||||
|
||||
ui->dateEdit->setVisible(false);
|
||||
ui->dateEdit->setMaximumDate(QDate::currentDate());
|
||||
ui->dateEdit->setDisplayFormat("yyyy/MM/dd");
|
||||
ui->dateEdit->setStyleSheet(style);
|
||||
//this->setWindowOpacity(0.8);
|
||||
|
||||
//ui->lineEdit->setFont(QFont("Arial", 25));
|
||||
//ui->dateEdit->setFont(QFont("Arial", 25, QFont::Bold));
|
||||
connect(QGuiApplication::inputMethod(), &QInputMethod::visibleChanged, [=]() {
|
||||
if (QGuiApplication::inputMethod()->isVisible())return;
|
||||
//qDebug() << "HidePanel";
|
||||
//qDebug() << "focusWidget" << qApp->focusWidget();
|
||||
this->HidePanel();
|
||||
this->hide();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//QLineEdit* InputObject::lineEdit()
|
||||
//{
|
||||
// return ui->lineEdit;
|
||||
//}
|
||||
|
||||
bool InputObject::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
static bool _visible = false;
|
||||
static bool excution = false;
|
||||
|
||||
if (obj->inherits("QQuickView"))
|
||||
//mouse button release means setfocus is useless
|
||||
if (event->type() == QEvent::MouseButtonRelease)
|
||||
{
|
||||
if (_visible != QGuiApplication::inputMethod()->isVisible())
|
||||
//qDebug() << obj << event->type();
|
||||
|
||||
if (obj->objectName() == QString("qt_spinbox_lineedit"))
|
||||
{
|
||||
|
||||
if (QGuiApplication::inputMethod()->isVisible())
|
||||
QDateEdit *_date = qobject_cast<QDateEdit*>(obj->parent());
|
||||
if (_date == ui->dateEdit)return true;
|
||||
if (_date->isEnabled())
|
||||
{
|
||||
if (excution == false) {
|
||||
excution = true;
|
||||
//make sure vkb hide and show again,without activating InputObject(both show/hide)
|
||||
this->ShowPanel();
|
||||
excution = false;
|
||||
}
|
||||
this->ShowPanel();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (excution == false) {
|
||||
excution = true;
|
||||
//make sure will not give rise to another vkb
|
||||
this->HidePanel();
|
||||
excution = false;
|
||||
}
|
||||
}
|
||||
_visible = QGuiApplication::inputMethod()->isVisible();
|
||||
}
|
||||
if (obj->objectName() == QString("qt_scrollarea_viewport"))
|
||||
{
|
||||
QTextEdit *_text= qobject_cast<QTextEdit*>(obj->parent());
|
||||
if (_text == ui->textEdit) return true; //
|
||||
if (_text->isEnabled())
|
||||
{
|
||||
this->ShowPanel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->inherits("QLineEdit")) {
|
||||
QLineEdit *tbx = qobject_cast<QLineEdit*>(obj);
|
||||
//you have to tell whether it is coming from qdateedit!!!
|
||||
if (ui->lineEdit != tbx && tbx->isEnabled())
|
||||
{
|
||||
//qDebug() << "ShowPanel";
|
||||
//qDebug() << "focusWidget" << qApp->focusWidget();
|
||||
//qDebug() << "lineEdit" << ui->lineEdit;
|
||||
//qDebug() << "obj" << obj;
|
||||
this->ShowPanel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
@@ -102,70 +117,125 @@ bool InputObject::eventFilter(QObject *obj, QEvent *event)
|
||||
void InputObject::ShowPanel() {
|
||||
if (qApp->focusWidget()->inherits("QLineEdit"))
|
||||
{
|
||||
curEdit = qobject_cast<QLineEdit*>(qApp->focusWidget());
|
||||
curLine = qobject_cast<QLineEdit*>(qApp->focusWidget());
|
||||
ui->dateEdit->setVisible(false);
|
||||
ui->lineEdit->setVisible(true);
|
||||
ui->textEdit->setVisible(false);
|
||||
}
|
||||
else if (qApp->focusWidget()->inherits("QComboBox"))
|
||||
{
|
||||
curEdit = qobject_cast<QComboBox*>(qApp->focusWidget())->lineEdit();
|
||||
ui->dateEdit->setVisible(false);
|
||||
ui->lineEdit->setVisible(true);
|
||||
}
|
||||
else if(qApp->focusWidget()->inherits("QDateEdit"))
|
||||
if (qApp->focusWidget()->inherits("QDateEdit"))
|
||||
{
|
||||
curDateEdit = qobject_cast<QDateEdit*>(qApp->focusWidget());
|
||||
ui->dateEdit->setVisible(true);
|
||||
ui->lineEdit->setVisible(false);
|
||||
ui->textEdit->setVisible(false);
|
||||
}
|
||||
else
|
||||
|
||||
if (qApp->focusWidget()->inherits("QTextEdit"))
|
||||
{
|
||||
return;
|
||||
curText = qobject_cast<QTextEdit*>(qApp->focusWidget());
|
||||
ui->dateEdit->setVisible(false);
|
||||
ui->lineEdit->setVisible(false);
|
||||
ui->textEdit->setVisible(true);
|
||||
}
|
||||
QDesktopWidget w;
|
||||
int deskWidth = w.availableGeometry().width();
|
||||
int deskHeight = w.availableGeometry().height();
|
||||
int vkbHeight = QGuiApplication::inputMethod()->keyboardRectangle().height();
|
||||
this->setGeometry(0, 0, deskWidth, deskHeight - vkbHeight);
|
||||
|
||||
//else
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//QDesktopWidget w;
|
||||
//int deskWidth = w.availableGeometry().width();
|
||||
//int deskHeight = w.availableGeometry().height();
|
||||
//int vkbHeight = QGuiApplication::inputMethod()->keyboardRectangle().height();
|
||||
|
||||
this->showFullScreen();
|
||||
this->setVisible(true);
|
||||
this->activateWindow(); //it is quite important!!!
|
||||
|
||||
if (curEdit) {
|
||||
ui->lineEdit->setText(curEdit->text());
|
||||
ui->lineEdit->setEchoMode(curEdit->echoMode());
|
||||
ui->lineEdit->setInputMethodHints(Qt::InputMethodHint::ImhNoAutoUppercase);
|
||||
ui->lineEdit->setFocus();
|
||||
|
||||
|
||||
if (curLine) {
|
||||
ui->lineEdit->setText(curLine->text());
|
||||
ui->lineEdit->setEchoMode(curLine->echoMode());
|
||||
ui->lineEdit->setInputMethodHints(Qt::InputMethodHint::ImhNoAutoUppercase);
|
||||
//qDebug() << "begin";
|
||||
ui->lineEdit->setFocus();
|
||||
//QFocusEvent event0(QEvent::FocusIn);
|
||||
//QCoreApplication::sendEvent(ui->lineEdit, &event0);
|
||||
while (QGuiApplication::focusObject() != ui->lineEdit)
|
||||
{
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
//qDebug() << QGuiApplication::focusObject();
|
||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||
QApplication::sendEvent(ui->lineEdit, &event);
|
||||
QCoreApplication::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)
|
||||
{
|
||||
|
||||
ui->dateEdit->setDateTime(curDateEdit->dateTime());
|
||||
ui->dateEdit->setFocus();
|
||||
while (QGuiApplication::focusObject() != ui->dateEdit)
|
||||
{
|
||||
qApp->processEvents();
|
||||
}
|
||||
qDebug() << QGuiApplication::focusObject();
|
||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||
QApplication::sendEvent(ui->dateEdit, &event);
|
||||
QCoreApplication::sendEvent(ui->dateEdit, &event);
|
||||
}
|
||||
|
||||
|
||||
if (curText)
|
||||
{
|
||||
ui->textEdit->setPlainText(curText->toPlainText());
|
||||
ui->textEdit->setFocus();
|
||||
while (QGuiApplication::focusObject() != ui->textEdit)
|
||||
{
|
||||
qApp->processEvents();
|
||||
}
|
||||
//qDebug() << QGuiApplication::focusObject();
|
||||
QEvent event(QEvent::RequestSoftwareInputPanel);
|
||||
QCoreApplication::sendEvent(ui->textEdit, &event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InputObject::HidePanel()
|
||||
{
|
||||
if (curEdit) {
|
||||
curEdit->setText(ui->lineEdit->text());
|
||||
if (curLine) {
|
||||
curLine->setText(ui->lineEdit->text());
|
||||
ui->lineEdit->clearFocus();
|
||||
ui->lineEdit->clear();
|
||||
this->setVisible(false);
|
||||
curEdit = nullptr;
|
||||
//this->setVisible(false);
|
||||
curLine = nullptr;
|
||||
}
|
||||
else if (curDateEdit)
|
||||
else if (curDateEdit)
|
||||
{
|
||||
//curDateEdit->setDateTime(QDateTime::currentDateTime());
|
||||
curDateEdit->setDateTime(ui->dateEdit->dateTime());
|
||||
ui->dateEdit->clearFocus();
|
||||
ui->dateEdit->clear();
|
||||
this->setVisible(false);
|
||||
//this->setVisible(false);
|
||||
curDateEdit = nullptr;
|
||||
}
|
||||
}
|
||||
else if (curText)
|
||||
{
|
||||
curText->setText(ui->textEdit->toPlainText());
|
||||
ui->textEdit->clearFocus();
|
||||
ui->textEdit->clear();
|
||||
//this->setVisible(false);
|
||||
curText = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
#pragma once
|
||||
#ifndef INPUTOBJECT_H
|
||||
#define INPUTOBJECT_H
|
||||
|
||||
#include <QWidget>
|
||||
class QLineEdit;
|
||||
class QDateEdit;
|
||||
|
||||
class QTextEdit;
|
||||
namespace Ui {
|
||||
class InputObject;
|
||||
class InputObject;
|
||||
}
|
||||
|
||||
class InputObject : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InputObject(QWidget *parent = 0);
|
||||
~InputObject();
|
||||
explicit InputObject(QWidget *parent = nullptr);
|
||||
~InputObject();
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
void ShowPanel();
|
||||
private:
|
||||
Ui::InputObject *ui;
|
||||
void initUi();
|
||||
void ShowPanel();
|
||||
// void ShowPanel();
|
||||
void HidePanel();
|
||||
|
||||
static InputObject *_instance;
|
||||
Ui::InputObject *ui;
|
||||
QDateEdit *curDateEdit = nullptr;
|
||||
QLineEdit* curEdit = nullptr;
|
||||
};
|
||||
QLineEdit* curLine = nullptr;
|
||||
QTextEdit* curText = nullptr;
|
||||
};
|
||||
|
||||
#endif // INPUTOBJECT_H
|
||||
|
||||
@@ -6,111 +6,125 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>916</width>
|
||||
<height>305</height>
|
||||
<width>952</width>
|
||||
<height>660</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>mask</string>
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>306</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<widget class="QWidget" name="WiBack" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>63</height>
|
||||
<width>235</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> border: 3px solid pink;
|
||||
border-radius: 15px;
|
||||
selection-background-color: darkgray;
|
||||
</string>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="AmericanSamoa"/>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>214</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>800</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="dateEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"> border: 3px solid pink;
|
||||
border-radius: 15px;
|
||||
selection-background-color: darkgray;</string>
|
||||
</property>
|
||||
<property name="dateTime">
|
||||
<datetime>
|
||||
<hour>0</hour>
|
||||
<minute>0</minute>
|
||||
<second>0</second>
|
||||
<year>1994</year>
|
||||
<month>11</month>
|
||||
<day>29</day>
|
||||
</datetime>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>62</height>
|
||||
<width>235</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@@ -119,22 +133,17 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<widget class="QWidget" name="WiBo" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>306</width>
|
||||
<height>20</height>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../res/icons.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
#include <QLineEdit>
|
||||
#include <QToolButton>
|
||||
#include <QFrame>
|
||||
#include <qDebug>
|
||||
|
||||
#include <QInputMethodEvent>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include "guimacros.h"
|
||||
#include <QCryptographicHash>
|
||||
#include "db/SQLHelper.h"
|
||||
#include "InputObject.h"
|
||||
|
||||
#define splitFlag QString("-")
|
||||
|
||||
LoginWindow::LoginWindow(QWidget* parent)
|
||||
@@ -144,10 +146,8 @@ void LoginWindow::doLogin()
|
||||
|
||||
|
||||
QString encryptPwd = getEncryptedPassword(strPassWord);
|
||||
qDebug()<<encryptPwd;
|
||||
QString sql = QString("select UserCode from Account where UserCode='%1' and Password='%2'")
|
||||
.arg(strUserCode).arg(encryptPwd);
|
||||
qDebug()<<sql;
|
||||
if (SQLHelper::QueryCount(sql)>0)
|
||||
{
|
||||
accept();
|
||||
|
||||
@@ -11,8 +11,9 @@ int main(int argc, char *argv[])
|
||||
qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", "..\\src\\layouts");
|
||||
|
||||
QApplication a(argc, argv);
|
||||
InputObject *obj = new InputObject();
|
||||
//a.installEventFilter(obj);
|
||||
InputObject *obj = new InputObject();
|
||||
|
||||
a.installEventFilter(obj);
|
||||
|
||||
needLogin:
|
||||
|
||||
Reference in New Issue
Block a user