Commit 5ed20300 by NitefullWind

1. 添加小键盘。

parent 74bc5ec7
...@@ -49,7 +49,8 @@ SOURCES += \ ...@@ -49,7 +49,8 @@ SOURCES += \
$$PWD/task/taskrefund.cpp \ $$PWD/task/taskrefund.cpp \
$$PWD/database/fmp_database.cpp \ $$PWD/database/fmp_database.cpp \
$$PWD/task/tasksetstoreinfo.cpp \ $$PWD/task/tasksetstoreinfo.cpp \
$$PWD/items/storeinfo.cpp $$PWD/items/storeinfo.cpp \
$$PWD/windows/fmnumpad.cpp
HEADERS +=\ HEADERS +=\
$$PWD/backup/fmbackup.h \ $$PWD/backup/fmbackup.h \
...@@ -89,7 +90,8 @@ HEADERS +=\ ...@@ -89,7 +90,8 @@ HEADERS +=\
$$PWD/task/taskrefund.h \ $$PWD/task/taskrefund.h \
$$PWD/database/fmp_database.h \ $$PWD/database/fmp_database.h \
$$PWD/task/tasksetstoreinfo.h \ $$PWD/task/tasksetstoreinfo.h \
$$PWD/items/storeinfo.h $$PWD/items/storeinfo.h \
$$PWD/windows/fmnumpad.h
unix { unix {
target.path = /usr/lib target.path = /usr/lib
...@@ -123,4 +125,5 @@ FORMS += \ ...@@ -123,4 +125,5 @@ FORMS += \
$$PWD/windows/forms/fmviplogin.ui \ $$PWD/windows/forms/fmviplogin.ui \
$$PWD/windows/forms/fmviporder.ui \ $$PWD/windows/forms/fmviporder.ui \
$$PWD/windows/forms/fmvippanel.ui \ $$PWD/windows/forms/fmvippanel.ui \
$$PWD/windows/forms/fmviprefund.ui $$PWD/windows/forms/fmviprefund.ui \
$$PWD/windows/forms/fmnumpad.ui
#include "fmnumpad.h"
#include "ui_fmnumpad.h"
FMNumPad::FMNumPad(QDialog *parent) :
FMVipWnd(parent),
ui(new Ui::FMNumPad)
{
initWnd(nullptr);
}
FMNumPad::FMNumPad(QLineEdit *lineEidt, QDialog *parent):
_lineEdit(lineEidt),
FMVipWnd(parent),
ui(new Ui::FMNumPad)
{
initWnd(nullptr);
}
bool FMNumPad::initWnd(Session *session)
{
Q_UNUSED(session)
ui->setupUi(this);
connect(ui->no0, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no1, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no2, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no3, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no4, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no5, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no6, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no7, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no8, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->no9, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
connect(ui->dot, &QPushButton::clicked, this, &FMNumPad::on_digit_clicked);
setFocusPolicy(Qt::NoFocus);
return true;
}
FMNumPad::~FMNumPad()
{
delete ui;
}
void FMNumPad::on_digit_clicked()
{
QString num_str = qobject_cast<QPushButton*>(sender())->text();
emit digit_click(num_str);
if(_lineEdit != nullptr) {
_lineEdit->insert(num_str);
}
}
void FMNumPad::on_backspace_btn_clicked()
{
emit digit_delete();
if(_lineEdit != nullptr) {
_lineEdit->backspace();
}
}
void FMNumPad::on_clear_btn_clicked()
{
emit digit_clear();
if(_lineEdit != nullptr) {
_lineEdit->clear();
}
}
void FMNumPad::on_confirm_btn_clicked()
{
emit digit_confirm();
}
#ifndef FMNUMPAD_H
#define FMNUMPAD_H
#include "fmvipwnd.h"
#include <QLineEdit>
namespace Ui {
class FMNumPad;
}
class FMNumPad : public FMVipWnd
{
Q_OBJECT
public:
explicit FMNumPad(QDialog *parent = 0);
FMNumPad(QLineEdit *lineEidt, QDialog *parent = 0);
~FMNumPad();
private:
bool initWnd(Session *session);
signals:
void digit_click(QString keynum);
void digit_delete();
void digit_clear();
void digit_confirm();
private slots:
void on_digit_clicked();
void on_backspace_btn_clicked();
void on_clear_btn_clicked();
void on_confirm_btn_clicked();
private:
Ui::FMNumPad *ui;
QLineEdit *_lineEdit;
};
#endif // FMNUMPAD_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FMNumPad</class>
<widget class="QWidget" name="FMNumPad">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>246</width>
<height>305</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget {
font: normal 22px &quot;Microsoft YaHei&quot;;
color: rgb(90,90,90);
}
#FMNumPad {
background: rgb(255,255,255);
border: 1 solid silver;
}
/*
* 标题栏
*/
#title {
background: rgb(56, 56, 64);
min-height: 32px; max-height: 32px;
}
#title_label {
margin-left: 4px;
font: normal 15px &quot;Microsoft YaHei&quot;;
color: rgb(220, 220, 220);
}
#close_btn {
min-width: 32;max-width: 32;
min-height: 32;max-height: 32;
image: url(&quot;:/img/btn_close.png&quot;);
background: rgb(56, 56, 64);
border: 0 solid silver;
padding: 0;
}
QPushButton {
border: 1 solid silver;
border-radius: 2px;
min-width: 50px; min-height: 50px;
max-width: 50px; max-height: 50px;
color: rgb(120,120,120);
background: transparent;
}
QPushButton:hover {
background: #7aad65;
color: white;
padding: 2 0 0 2;
}
#no0 {
min-width: 106px;
max-width: 106px;}
#backspace_btn, #clear_btn {
font: normal 16px &quot;Microsoft YaHei&quot;;
}
#backspace_btn {
background-image: url(&quot;:/img/num_del.png&quot;);
}
#confirm_btn {
background: rgb(37,176,241);
font: 400 16px &quot;Microsoft YaHei&quot;;
color: white;
min-height: 106px;
max-height: 106px;
border: 0 solid white;
border-right: 1 solid silver;
}
#confirm_btn:hover {
padding: 2 0 0 2;
}</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>8</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>
<widget class="QWidget" name="title" 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>
<widget class="QLabel" name="title_label">
<property name="text">
<string>数字键盘</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="close_btn">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<item row="1" column="3">
<widget class="QPushButton" name="clear_btn">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>清空</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="no0">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="no9">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>9</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="no6">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item row="2" column="3" rowspan="2">
<widget class="QPushButton" name="confirm_btn">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>确认</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="no1">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="no2">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="no3">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="no5">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="no4">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="backspace_btn">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="dot">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="no7">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>7</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="no8">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
min-width: 54; min-width: 54;
min-height: 54; min-height: 54;
border-radius: 0px; border-radius: 0px;
image: url(:/img/btn_close.png); image: url(&quot;:/img/btn_close.png&quot;);
} }
/* /*
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
#mobile_label { #mobile_label {
color: rgb(169,169,169); color: rgb(169,169,169);
image: url(&quot;:/account.png&quot;); image: url(&quot;:/img/account.png&quot;);
background: white; background: white;
border: 1 solid silver; border: 1 solid silver;
border-right: 0; border-right: 0;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "fmvipdispatcher.h" #include "fmvipdispatcher.h"
#include "fmtask.h" #include "fmtask.h"
#include "fmnumpad.h"
class TestPlugin : public QObject class TestPlugin : public QObject
{ {
...@@ -28,6 +29,9 @@ private slots: ...@@ -28,6 +29,9 @@ private slots:
void test_Sign_data(); void test_Sign_data();
void test_Sign(); void test_Sign();
void test_numpad_data();
void test_numpad();
}; };
TestPlugin::TestPlugin() TestPlugin::TestPlugin()
...@@ -148,6 +152,20 @@ void TestPlugin::test_Sign() ...@@ -148,6 +152,20 @@ void TestPlugin::test_Sign()
QCOMPARE(FMTask::Sign(jsonObj1), SignStr); QCOMPARE(FMTask::Sign(jsonObj1), SignStr);
} }
void TestPlugin::test_numpad_data()
{
}
void TestPlugin::test_numpad()
{
QLineEdit *edit = new QLineEdit();
FMNumPad pad(edit);
pad.show();
edit->show();
QTest::qWait(1000 * 60 *2);
}
QTEST_MAIN(TestPlugin) QTEST_MAIN(TestPlugin)
#include "tst_testplugin.moc" #include "tst_testplugin.moc"
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#define VER_MINOR 1 #define VER_MINOR 1
#define VER_REVISION 0 #define VER_REVISION 0
#define VER_BUILD 28 #define VER_BUILD 29
//! Convert version numbers to string //! Convert version numbers to string
#define _STR(S) #S #define _STR(S) #S
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment