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