提交 35a46bef 作者: zhangyl

添加新门禁

上级 692e1171
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 7
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++ \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/i686-w64-mingw32 \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/backward \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include-fixed \
C:/Qt/Qt5.13.2/Tools/mingw730_32/i686-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0 \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib/gcc \
C:/Qt/Qt5.13.2/Tools/mingw730_32/i686-w64-mingw32/lib \
C:/Qt/Qt5.13.2/Tools/mingw730_32/lib
差异被折叠。 点击展开。
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
QT += core gui sql serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
#自定Pro结构文件
MOC_DIR = temp/moc
RCC_DIR = temp/rcc
UI_DIR = temp/ui
OBJECTS_DIR = temp/obj
#这样只有exe文件在bin文件夹
DESTDIR = bin
#为了使日志在 Release 模式下也可输出文件名和代码行数
DEFINES += QT_MESSAGELOGCONTEXT
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
bridge.cpp \
frmmessagebox.cpp \
iconhelper.cpp \
logindlg.cpp \
main.cpp \
mainwindow.cpp \
sqlitehandle.cpp
HEADERS += \
bridge.h \
frmmessagebox.h \
iconhelper.h \
logindlg.h \
mainwindow.h \
myhelper.h \
sqlitehandle.h
FORMS += \
frmmessagebox.ui \
logindlg.ui \
mainwindow.ui
#添加日志
include(modeller_applog/applogmodel.pri)
#添加数据库助手
include(sqliteassistant/sqliteassistant.pri)
#添加扫码模块
include(scanCode_control/scanCode_control.pri)
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
image.qrc
File added
File:(sqliteassistant\sqliteassistant.cpp) Line:(30) Function:long int SqliteAssistant::connectSql() Succeed to connect database. (2022-02-14 15:05:44 周一)
File:(main.cpp) Line:(26) Function:int qMain(int, char**) connectSql ok (2022-02-14 15:05:44 周一)
File:(mainwindow.cpp) Line:(164) Function:void MainWindow::SoftStart() 软件启动时间: "2022-02-14 15:05:44" (2022-02-14 15:05:44 周一)
File:(mainwindow.cpp) Line:(191) Function:void MainWindow::SoftClose() 软件关闭时间: "2022-02-14 15:27:05" (2022-02-14 15:27:05 周一)
#ifndef BRIDGE_H
#define BRIDGE_H
#include <QMutex>
#include <QObject>
#include <QThread>
#include <windows.h>
//#include "getPcInfo_model/globalapiclass.h" //获取电脑信息
//#include "meter_control/tcpcontrol.h" // 仪表控制--TCP链接
//#include "meter_model/metermodel.h" // 仪表数据处理
//#include "eqpt_control/eqptcontrol.h" // 外围设备控制
//#include "eqpt_model/eqptmodel.h"
//#include "hkCapture_control/cameracontrol.h" // 抓拍机控制模块
//#include "rightCarmera_control/rightcarmeracontrol.h" // 右侧相机控制
//#include "leftCarmera_control/leftcarmeracontrol.h" // 左侧相机控制
//#include "picToBase64_model/pictobase64model.h" //图片转换控制
////#include "sqlite_control/sqlitecontrol.h" //数据库管理模块
////#include "voice_view/voiceview.h" // 语音管理模块
#include "scanCode_control/scancodecontrol.h" //扫码模块
//#include "tcpTools_control/tcptoolscontrol.h" //TCP控制模块
//#include "tcpTools_model/tcptoolsmodel.h" //TCP数据管理模块
//#include "led_model/yangbangscreen.h"
//#include "weightinfo.h"
using namespace std;
class Bridge : public QObject
{
Q_OBJECT
public:
~Bridge();
//单例模式
static Bridge* GetInstance();
//声明模块
//TcpControl *m_TcpControl;
//MeterModel *m_MeterModel;
QString m_subnum; //缓存业务流水号
//EqptControl *m_EqptControl;
//EqptModel *m_EqptModel;
//CameraControl *m_CameraControl;
//RightCarmeraControl *m_RightCarmeraControl;
// LeftCarmeraControl *m_LeftCarmeraControl;
// PicToBase64Model *m_PicToBase64Model;
// PicToBase64Model_LeftPic *m_PicToBase64Model_LeftPic;
// PicToBase64Model_CarPic *m_PicToBase64Model_CarPic;
// PicToBase64Model_CarPlnumPic *m_PicToBase64Model_CarPlnumPic;
// SqliteControl *m_SqliteControl;
ScanCodeControl *m_ScanCodeControl;
// TcpToolsControl *m_TcpToolsControl;
// TcpToolsModel *m_TcpToolsModel;
// yangbangScreen *m_yangbangScreen;
public:
//更改状态
void CD_is_startCheck();
//通过回调函数,更新Ui界面数据;
QString UpDataUi_WeighingData();
QString UpDataUi_carInTime();
QString UpDataUi_carOutTime();
signals:
//仪表线程启动信号
void SendToTcpControl_threadStart();
//外围设备线程启动信号
void SendToEqptControl_threadStart();
//通过界面绿灯
void SendToEqptControl_HeadGreen();
void SendToEqptControl_HeadRed();
void SendToEqptControl_HeadTrunkUp();
void SendToEqptControl_HeadTrunkUpRelease();
void SendToEqptControl_HeadTrunkLock();
void SendToEqptControl_HeadTrunkUnLock();
void SendToEqptControl_HeadTrunkDown();
void SendToEqptControl_HeadTrunkDownRelease();
void SendToEqptControl_LastTrunkUp();
void SendToEqptControl_LastTrunkLock();
void SendToEqptControl_LastTrunkUnLock();
void SendToEqptControl_LastTrunkUpRelease();
void SendToEqptControl_LastTrunkDown();
void SendToEqptControl_LastTrunkDownRelease();
void SendToEqptControl_LastGreen();
void SendToEqptControl_LastRed();
void SendToEqptControl_CartchPic();
//抓拍机控制
void SendToCameraControl_Login();
void SendToCameraControl_Catchpic();
// //右侧相机
void SendToRightCarmeraControl_Login();
void SendToRightCarmeraControl_CatchRightpic();
// //左侧相机
void SendToLeftCarmeraControl_Login();
void SendToLeftCarmeraControl_CatchLeftpic();
//图片转换
void SendToPicToBase64Model_Strat(QString data);
void SendToPicToBase64Model_LeftPic_Strat(QString data);
void SendToPicToBase64Model_CarPic_Strat(QString data);
void SendToPicToBase64Model_CarPlnumPic_Strat(QString data);
// 数据库
void SendToSqliteControl_OpenDB(); //打开数据库
// void SendToSqliteControl_InsertDB(Vehicle_info &info); //插入数据库
void SendToSqliteControl_DeletDB(); //删除数据库
void SendToSqliteControl_UpDataDB(); //更新数据库
void SendToSqliteControl_SelectDB(); //查询数据库
//扫码
void SendToScanCodeControl_Start();
//TCP
void SendToTcpToolsControl_Connect(); //连接服务器
void SendToTcpToolsControl_Register(QByteArray data); //连接服务器
void SendToTcpToolsControl_Enter1(QByteArray data); //模式一入场
void SendToTcpToolsControl_ScanCodeStart(QByteArray data); //发送扫码数据
void SendToTcpToolsControl_ScanEnter(QByteArray data); //扫码入场
void SendToTcpToolsControl_Enter2(QByteArray data); //模式二入场
void SendToTcpToolsControl_HeadTrunk(QByteArray data); //前道闸
void SendToTcpToolsControl_Out(QByteArray data); //出场
void SendToTcpToolsControl_ScanOut(QByteArray data); //出场
void SendToTcpToolsControl_Weight(QByteArray data); //称重
void SendToTcpToolsControl_ScanCodeWeight(QByteArray data); //扫码称重
void SendToTcpToolsControl_Error(QByteArray data); //异常
//TCP_MODEL
void SendToTcpToolsModel_Register(); //站点注册
void SendToTcpToolsModel_Enter1(); //模式一入场
void SendToTcpToolsModel_ScanEnter(); //扫码入场
void SendToTcpToolsModel_ScanCodeStart(); //扫码开始称重
void SendToTcpToolsModel_Enter2(); //模式二入场
void SendToTcpToolsModel_HeadTrunk(); //前道闸
void SendToTcpToolsModel_ScanCodeWeight(); //扫码称重
void SendToTcpToolsModel_Out(); //出场
void SendToTcpToolsModel_ScanOut(); //出场
void SendToTcpToolsModel_Weight(); //称重
void SendToTcpToolsModel_Error(); //异常
//LCD 显示屏
void SendToyangbangScreen_Login(); //登陆
//发送给界面提示称重开始
void SendToUi_ScanCodeWeightStart();
void SendToUi_ScanCodeReplay();
void SendToUi_ScanCodeReplayError();
public slots:
private:
Bridge();
static Bridge *m_instance;
static QMutex m_mutex;
QThread *m_TcpControl_Thread;
QThread *m_EqptControl_Thread;
QThread *m_CameraControl_Thread;
QThread *m_RightCarmeraControl_Thread;
QThread *m_LeftCarmeraControl_Thread;
QThread *m_PicToBase64Model_Thread;
QThread *m_PicToBase64Model_LeftPic_Thread;
QThread *m_PicToBase64Model_CarPic_Thread;
QThread *m_PicToBase64Model_CarPlnumPic_Thread;
QThread *m_SqliteControl_Thread;
QThread *m_ScanCodeControl_Thread;
QThread *m_TcpToolsControl_Thread;
void BridgeToTcpControl_connect(); // 桥和仪表之间的通讯
void BridgeToEqptControl_connect(); // 桥和外围设备之间的通讯
void BridgeToEqptModel_connect(); // 桥和外围处理设备之间的通讯
void BridgeToCameraControl_connect(); // 桥和抓拍机之间的通讯
void BridgeToRightCarmeraControl_connect(); // 桥和右侧相机之间的通讯
void BridgeToLeftCarmeraControl_connect(); // 桥和左侧相机之间的通讯
void BridgeToPicToBase64Model_connect(); // 桥和图片转换器之间的通讯
void BridgeToSqliteControl_connect(); // 桥和数据库之间的通讯
void BridgeToScanCodeControl_connect(); // 桥和扫码模块之间的通讯
void BridgeToTcpToolsControl_connect(); // 桥和TCP控制模块之间的通讯
void BridgeToTcpToolsModel_connect(); // 桥和TCP控制模块之间的通讯
void BridgeToyangbangScreen_connect(); // 桥和LCD控制模块之间的通讯
string QByteToCStr(QByteArray data);
string strTime();
private:
//实时称重
QString m_WeighingData_timely; //实时称重数据
QString plateNum = "";
QString picPath = "";
bool is_weight = false;
bool is_startCheck = false;
QTimer *m_Headtimer;
QTimer *m_Headtimer2;
QTimer *m_Lasttimer;
QTimer *m_Lasttimer2;
};
#endif // BRIDGE_H
#include "frmmessagebox.h"
#include "ui_frmmessagebox.h"
#include "iconhelper.h"
#include "myhelper.h"
frmMessageBox::frmMessageBox(QWidget *parent) :
QDialog(parent),
ui(new Ui::frmMessageBox)
{
ui->setupUi(this);
this->mousePressed = false;
//设置窗体标题栏隐藏
this->setWindowFlags(Qt::FramelessWindowHint);
//设置窗体关闭时自动释放内存
this->setAttribute(Qt::WA_DeleteOnClose);
//设置图形字体
IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12);
IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10);
//关联关闭按钮
connect(ui->btnMenu_Close, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close()));
//窗体居中显示
myHelper::FormInCenter(this);
}
frmMessageBox::~frmMessageBox()
{
delete ui;
}
void frmMessageBox::SetMessage(const QString &msg, int type)
{
if (type == 0) {
ui->labIcoMain->setStyleSheet("border-image: url(:/image/info.png);");
ui->btnCancel->setVisible(false);
ui->lab_Title->setText("提示");
} else if (type == 1) {
ui->labIcoMain->setStyleSheet("border-image: url(:/image/question.png);");
ui->lab_Title->setText("询问");
} else if (type == 2) {
ui->labIcoMain->setStyleSheet("border-image: url(:/image/error.png);");
ui->btnCancel->setVisible(false);
ui->lab_Title->setText("错误");
}
ui->labInfo->setText(msg);
}
void frmMessageBox::on_btnOk_clicked()
{
done(1);
this->close();
}
void frmMessageBox::mouseMoveEvent(QMouseEvent *e)
{
if (mousePressed && (e->buttons() && Qt::LeftButton)) {
this->move(e->globalPos() - mousePoint);
e->accept();
}
}
void frmMessageBox::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
mousePressed = true;
mousePoint = e->globalPos() - this->pos();
e->accept();
}
}
void frmMessageBox::mouseReleaseEvent(QMouseEvent *)
{
mousePressed = false;
}
#ifndef FRMMESSAGEBOX_H
#define FRMMESSAGEBOX_H
#include <QDialog>
#include <QMouseEvent>
namespace Ui {
class frmMessageBox;
}
class frmMessageBox : public QDialog
{
Q_OBJECT
public:
explicit frmMessageBox(QWidget *parent = 0);
~frmMessageBox();
void SetMessage(const QString &msg, int type);
protected:
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *);
private slots:
void on_btnOk_clicked();
private:
Ui::frmMessageBox *ui;
QPoint mousePoint; //鼠标拖动自定义标题栏时的坐标
bool mousePressed; //鼠标是否按下
};
#endif // FRMMESSAGEBOX_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>frmMessageBox</class>
<widget class="QDialog" name="frmMessageBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>303</width>
<height>143</height>
</rect>
</property>
<property name="windowTitle">
<string>提示</string>
</property>
<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>
<widget class="QWidget" name="widget_title" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>28</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_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>
<widget class="QLabel" name="lab_Ico">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>31</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lab_Title">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">font: 10pt &quot;微软雅黑&quot;;</string>
</property>
<property name="text">
<string>提示</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_menu" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<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="QPushButton" name="btnMenu_Close">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>关闭</string>
</property>
<property name="text">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_main" native="true">
<property name="styleSheet">
<string notr="true">font: 11pt &quot;微软雅黑&quot;;</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<widget class="QLabel" name="labIcoMain">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>45</width>
<height>45</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/image/info.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="labInfo">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>211</width>
<height>41</height>
</rect>
</property>
<property name="text">
<string>确定要删除吗?</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>271</width>
<height>34</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<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="btnOk">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>确定(&amp;O)</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/image/ok.png</normaloff>:/image/ok.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCancel">
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>取消(&amp;C)</string>
</property>
<property name="icon">
<iconset resource="image.qrc">
<normaloff>:/image/delete.png</normaloff>:/image/delete.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="image.qrc"/>
</resources>
<connections/>
</ui>
#include "iconhelper.h"
IconHelper* IconHelper::_instance = 0;
IconHelper::IconHelper(QObject*):
QObject(qApp)
{
int fontId = QFontDatabase::addApplicationFont(":/image/fontawesome-webfont.ttf");
QString fontName = QFontDatabase::applicationFontFamilies(fontId).at(0);
iconFont = QFont(fontName);
}
void IconHelper::SetIcon(QLabel* lab, QChar c, int size)
{
iconFont.setPointSize(size);
lab->setFont(iconFont);
lab->setText(c);
}
void IconHelper::SetIcon(QPushButton* btn, QChar c, int size)
{
iconFont.setPointSize(size);
btn->setFont(iconFont);
btn->setText(c);
}
#ifndef ICONHELPER_H
#define ICONHELPER_H
#include <QObject>
#include <QFont>
#include <QFontDatabase>
#include <QMutex>
#include <QLabel>
#include <QPushButton>
#include <QApplication>
class IconHelper : public QObject
{
private:
explicit IconHelper(QObject *parent = 0);
QFont iconFont;
static IconHelper* _instance;
public:
static IconHelper* Instance()
{
static QMutex mutex;
if (!_instance) {
QMutexLocker locker(&mutex);
if (!_instance) {
_instance = new IconHelper;
}
}
return _instance;
}
void SetIcon(QLabel* lab, QChar c, int size = 10);
void SetIcon(QPushButton* btn, QChar c, int size = 10);
};
#endif // ICONHELPER_H
<RCC>
<qresource prefix="/">
<file>image/2008060216255190.jpg</file>
<file>image/add.png</file>
<file>image/add-line_horizontal.png</file>
<file>image/add-line_vertical.png</file>
<file>image/array_down.png</file>
<file>image/black.css</file>
<file>image/blue.css</file>
<file>image/checkbox_checked.png</file>
<file>image/checkbox_unchecked.png</file>
<file>image/clean.png</file>
<file>image/Close_0.png</file>
<file>image/Close_1.png</file>
<file>image/db_admin_0.png</file>
<file>image/db_admin_1.png</file>
<file>image/db_cdPwd_0.png</file>
<file>image/db_cdPwd_1.png</file>
<file>image/db_cdUser_0.png</file>
<file>image/db_cdUser_1.png</file>
<file>image/db_close_0.png</file>
<file>image/db_close_1.png</file>
<file>image/db_select_0.png</file>
<file>image/db_select_1.png</file>
<file>image/db_setting_0.png</file>
<file>image/db_setting_1.png</file>
<file>image/debug.jpg</file>
<file>image/delete.png</file>
<file>image/down.png</file>
<file>image/downLoad.png</file>
<file>image/downloadPic.png</file>
<file>image/error.png</file>
<file>image/firewareUpdate.jpg</file>
<file>image/Font Awesome Cheatsheet.png</file>
<file>image/fontawesome-webfont.ttf</file>
<file>image/gray.css</file>
<file>image/header.png</file>
<file>image/ic_launcher_wallpaper.png</file>
<file>image/info.png</file>
<file>image/jinmai_icon.png</file>
<file>image/jinmai_logo.png</file>
<file>image/Login_Dialog.qss</file>
<file>image/main.png</file>
<file>image/Min_0.png</file>
<file>image/Min_1.png</file>
<file>image/navy.css</file>
<file>image/off.ico</file>
<file>image/ok.png</file>
<file>image/on.ico</file>
<file>image/open.png</file>
<file>image/qt_zh_CN.qm</file>
<file>image/question.png</file>
<file>image/radio_normal.png</file>
<file>image/radio_selected.png</file>
<file>image/save.png</file>
<file>image/send.png</file>
<file>image/setting.png</file>
<file>image/sub-line_horizontal.png</file>
<file>image/sub-line_vertical.png</file>
<file>image/up.png</file>
<file>image/update.png</file>
</qresource>
</RCC>
*{
font-family:Microsoft YaHei;
}
QWidget#wid_main{
background-color: #1B89CA;
border: 1px solid #1B89CA;
border-radius: 10px;
}
QWidget#widget_sec{
background-color: rgb(255,255,255);
border: 1px solid rgb(255,255,255);
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
}
QLabel{
background: transparent;
border: 1px solid transparent;
color:rgb(0,0,0);
font-weight: bold;
font: 25 15pt "Microsoft YaHei";
padding: 1px;
}
QLabel#lab_title{
color:rgb(255,255,255);
font: 50 10pt "Microsoft YaHei";
}
QLabel#lab_name{
font: 50 20pt "Microsoft YaHei";
}
QLabel#lab_user{
font: 25 12pt "Microsoft YaHei";
}
QLabel#lab_pwd{
font: 25 12pt "Microsoft YaHei";
}
QLabel#lab_logo{
border-image: url(:/image/jinmai_icon.png);
}
/*密码框*/
QLineEdit#lineEdit_pwd,#lineEdit_user
{
border: 1px solid rgb(209 , 209 , 209);
border-right:transparent;
border-left:transparent;
border-top:transparent;
}
QLineEdit#lineEdit_pwd,#lineEdit_user:hover
{
padding-top:0px ;
border-top:transparent;
border-left:transparent;
border-right:transparent;
}
QPushButton {
background-color: #1B89CA;
border: 1px solid transparent;
font-weight: bold;
font: 25 15pt "Microsoft YaHei";
padding: 1px 4px;
}
QPushButton:hover{
}
QPushButton:pressed
{
}
/*登陆按钮*/
QPushButton#pbn_login
{
color:#e6e6e6;
font-weight: bold;
background-color:#1B89CA;
border-radius:5px;
}
QPushButton#pbn_login:hover
{
color:white;
background-color:#5CACEE;
}
QPushButton#pbn_login:pressed
{
color:#e6e6e6;
background-color:#1B89CA;
padding-left:3px;
padding-top:3px;
}
/*最小化窗口*/
QPushButton#pbn_min{
border-image: url(:/image/Min_0.png);
}
QPushButton#pbn_min:hover{
border-image: url(:/image/Min_1.png);
}
QPushButton#pbn_min:pressed{
border-image: url(:/image/Min_0.png);
}
/*关闭窗口*/
QPushButton#pbn_close{
border-image: url(:/image/Close_0.png);
}
QPushButton#pbn_close:hover{
border-image: url(:/image/Close_1.png);
}
QPushButton#pbn_close:pressed{
border-image: url(:/image/Close_0.png);
}
QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
border:1px solid #4D4D4D;
border-radius:0px;
}
.QFrame{
border:1px solid #636363;
border-radius:5px;
}
QWidget#widget_title{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QLabel#lab_Ico,QLabel#lab_Title{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QLineEdit {
border: 1px solid #636363;
border-radius: 5px;
padding: 2px;
background: none;
selection-background-color: #4D4D4D;
}
QLineEdit[echoMode="2"] {
lineedit-password-character: 9679;
}
.QGroupBox{
border: 1px solid #636363;
border-radius: 5px;
}
.QPushButton{
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 5px;
min-height: 20px;
border-radius:5px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
.QPushButton[focusPolicy="0"] {
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 0px;
min-height: 10px;
border-radius:3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
.QPushButton:hover{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}
.QPushButton:pressed{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #636363);
}
QPushButton#btnMenu_Close:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
}
QCheckBox {
spacing: 2px;
}
QCheckBox::indicator {
width: 20px;
height: 20px;
}
QCheckBox::indicator:unchecked {
image: url(:/image/checkbox_unchecked.png);
}
QCheckBox::indicator:checked {
image: url(:/image/checkbox_checked.png);
}
QRadioButton {
spacing: 2px;
}
QRadioButton::indicator {
width: 15px;
height: 15px;
}
QRadioButton::indicator::unchecked {
image: url(:/image/radio_normal.png);
}
QRadioButton::indicator::checked {
image: url(:/image/radio_selected.png);
}
QComboBox,QDateEdit{
border-radius: 3px;
padding: 1px 10px 1px 5px;
border: 1px solid #636363;
}
QComboBox::drop-down,QDateEdit::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 1px;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-left-color: #636363;
}
QComboBox::down-arrow,QDateEdit::down-arrow {
image: url(:/image/array_down.png);
}
QMenu {
background-color:#F0F0F0;
margin: 2px;
}
QMenu::item {
padding: 2px 12px 2px 12px;
}
QMenu::indicator {
width: 13px;
height: 13px;
}
QMenu::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QMenu::separator {
height: 1px;
background: #636363;
}
QProgressBar {
border-radius: 5px;
text-align: center;
border: 1px solid #636363;
}
QProgressBar::chunk {
width: 5px;
margin: 0.5px;
background-color: #4D4D4D;
}
QSlider::groove:horizontal,QSlider::add-page:horizontal {
background: #808080;
height: 8px;
border-radius: 3px;
}
QSlider::sub-page:horizontal {
height: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QSlider::handle:horizontal {
width: 13px;
margin-top: -3px;
margin-bottom: -3px;
border-radius: 6px;
background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #636363);
}
QSlider::handle:horizontal:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #4D4D4D);
}
QSlider::groove:vertical,QSlider::sub-page:vertical {
background:#808080;
width: 8px;
border-radius: 3px;
}
QSlider::add-page:vertical {
width: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QSlider::handle:vertical {
height: 14px;
margin-left: -3px;
margin-right: -3px;
border-radius: 6px;
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #636363);
}
QSlider::handle:vertical:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #4D4D4D);
}
QScrollBar:vertical {
width:10px;
background-color:rgba(0,0,0,0%);
padding-top:10px;
padding-bottom:10px;
}
QScrollBar:horizontal {
height:10px;
background-color:rgba(0,0,0,0%);
padding-left:10px; padding-right:10px;
}
QScrollBar::handle:vertical {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}
QScrollBar::handle:horizontal {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}
QScrollBar::handle:vertical:hover {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QScrollBar::handle:horizontal:hover {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QScrollBar::add-line:vertical {
height:10px;
width:10px;
subcontrol-position: bottom;
subcontrol-origin: margin;
border-image:url(:/image/add-line_vertical.png);
}
QScrollBar::add-line:horizontal {
height:10px;
width:10px;
subcontrol-position: right;
subcontrol-origin: margin;
border-image:url(:/image/add-line_horizontal.png);
}
QScrollBar::sub-line:vertical {
height:10px;
width:10px;
subcontrol-position: top;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_vertical.png);
}
QScrollBar::sub-line:horizontal {
height:10px;
width:10px;
subcontrol-position: left;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_horizontal.png);
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
width:10px;
background: #C0C0C0;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
height:10px;
background: #C0C0C0;
}
QScrollArea {
border: 0px ;
}
QTreeView,QListView,QTableView{
border: 1px solid #636363;
selection-background-color: #4D4D4D;
selection-color: #F0F0F0;
}
QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}
QTableView::item, QListView::item, QTreeView::item {
padding: 5px;
margin: 0px;
}
QHeaderView::section {
padding:3px;
margin:0px;
color:#F0F0F0;
border: 1px solid #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}
QTabBar::tab {
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
color: #F0F0F0;
min-width: 60px;
min-height: 20px;
padding: 3px 8px 3px 8px;
margin:1px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
}
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
}
QStatusBar::item {
border: 1px solid #636363;
border-radius: 3px;
}
\ No newline at end of file
QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
border:1px solid #1B89CA;
border-radius:0px;
}
.QFrame{
border:1px solid #5CACEE;
border-radius:5px;
}
QWidget#widget_title{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QLabel#lab_Ico,QLabel#lab_Title{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QLineEdit {
border: 1px solid #5CACEE;
border-radius: 5px;
padding: 2px;
background: none;
selection-background-color: #1B89CA;
}
QLineEdit[echoMode="2"] {
lineedit-password-character: 9679;
}
.QGroupBox{
border: 1px solid #5CACEE;
border-radius: 5px;
}
.QPushButton{
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 5px;
min-height: 20px;
border-radius:5px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
.QPushButton[focusPolicy="0"] {
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 0px;
min-height: 10px;
border-radius:3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
.QPushButton:hover{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
}
.QPushButton:pressed{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #5CACEE);
}
QPushButton#btnMenu_Close:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
}
QCheckBox {
spacing: 2px;
}
QCheckBox::indicator {
width: 20px;
height: 20px;
}
QCheckBox::indicator:unchecked {
image: url(:/image/checkbox_unchecked.png);
}
QCheckBox::indicator:checked {
image: url(:/image/checkbox_checked.png);
}
QRadioButton {
spacing: 2px;
}
QRadioButton::indicator {
width: 15px;
height: 15px;
}
QRadioButton::indicator::unchecked {
image: url(:/image/radio_normal.png);
}
QRadioButton::indicator::checked {
image: url(:/image/radio_selected.png);
}
QComboBox,QDateEdit{
border-radius: 3px;
padding: 1px 10px 1px 5px;
border: 1px solid #5CACEE;
}
QComboBox::drop-down,QDateEdit::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 1px;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-left-color: #5CACEE;
}
QComboBox::down-arrow,QDateEdit::down-arrow {
image: url(:/image/array_down.png);
}
QMenu {
background-color:#F0F0F0;
margin: 2px;
}
QMenu::item {
padding: 2px 12px 2px 12px;
}
QMenu::indicator {
width: 13px;
height: 13px;
}
QMenu::item:selected {
color: #FFFFFF;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QMenu::separator {
height: 1px;
background: #5CACEE;
}
QProgressBar {
border-radius: 5px;
text-align: center;
border: 1px solid #5CACEE;
}
QProgressBar::chunk {
width: 5px;
margin: 0.5px;
background-color: #1B89CA;
}
QSlider::groove:horizontal,QSlider::add-page:horizontal {
background: #808080;
height: 8px;
border-radius: 3px;
}
QSlider::sub-page:horizontal {
height: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QSlider::handle:horizontal {
width: 13px;
margin-top: -3px;
margin-bottom: -3px;
border-radius: 6px;
background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #5CACEE);
}
QSlider::handle:horizontal:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #1B89CA);
}
QSlider::groove:vertical,QSlider::sub-page:vertical {
background:#808080;
width: 8px;
border-radius: 3px;
}
QSlider::add-page:vertical {
width: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QSlider::handle:vertical {
height: 14px;
margin-left: -3px;
margin-right: -3px;
border-radius: 6px;
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #5CACEE);
}
QSlider::handle:vertical:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #1B89CA);
}
QScrollBar:vertical {
width:10px;
background-color:rgba(0,0,0,0%);
padding-top:10px;
padding-bottom:10px;
}
QScrollBar:horizontal {
height:10px;
background-color:rgba(0,0,0,0%);
padding-left:10px; padding-right:10px;
}
QScrollBar::handle:vertical {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
}
QScrollBar::handle:horizontal {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
}
QScrollBar::handle:vertical:hover {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QScrollBar::handle:horizontal:hover {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QScrollBar::add-line:vertical {
height:10px;
width:10px;
subcontrol-position: bottom;
subcontrol-origin: margin;
border-image:url(:/image/add-line_vertical.png);
}
QScrollBar::add-line:horizontal {
height:10px;
width:10px;
subcontrol-position: right;
subcontrol-origin: margin;
border-image:url(:/image/add-line_horizontal.png);
}
QScrollBar::sub-line:vertical {
height:10px;
width:10px;
subcontrol-position: top;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_vertical.png);
}
QScrollBar::sub-line:horizontal {
height:10px;
width:10px;
subcontrol-position: left;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_horizontal.png);
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
width:10px;
background: #C0C0C0;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
height:10px;
background: #C0C0C0;
}
QScrollArea {
border: 0px ;
}
QTreeView,QListView,QTableView{
border: 1px solid #5CACEE;
selection-background-color: #1B89CA;
selection-color: #F0F0F0;
}
QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
}
QTableView::item, QListView::item, QTreeView::item {
padding: 5px;
margin: 0px;
}
QHeaderView::section {
padding:3px;
margin:0px;
color:#F0F0F0;
border: 1px solid #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
}
QTabBar::tab {
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
color: #F0F0F0;
min-width: 60px;
min-height: 20px;
padding: 3px 8px 3px 8px;
margin:1px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
}
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
}
QStatusBar::item {
border: 1px solid #5CACEE;
border-radius: 3px;
}
\ No newline at end of file
QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
border:1px solid #454648;
border-radius:0px;
}
.QFrame{
border:1px solid #B8B8B8;
border-radius:5px;
}
QWidget#widget_title{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QLabel#lab_Ico,QLabel#lab_Title{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QLineEdit {
border: 1px solid #B8B8B8;
border-radius: 5px;
padding: 2px;
background: none;
selection-background-color: #454648;
}
QLineEdit[echoMode="2"] {
lineedit-password-character: 9679;
}
.QGroupBox{
border: 1px solid #B8B8B8;
border-radius: 5px;
}
.QPushButton{
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 5px;
min-height: 20px;
border-radius:5px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
.QPushButton[focusPolicy="0"] {
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 0px;
min-height: 10px;
border-radius:3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
.QPushButton:hover{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
}
.QPushButton:pressed{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #B8B8B8);
}
QPushButton#btnMenu_Close:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
}
QCheckBox {
spacing: 2px;
}
QCheckBox::indicator {
width: 20px;
height: 20px;
}
QCheckBox::indicator:unchecked {
image: url(:/image/checkbox_unchecked.png);
}
QCheckBox::indicator:checked {
image: url(:/image/checkbox_checked.png);
}
QRadioButton {
spacing: 2px;
}
QRadioButton::indicator {
width: 15px;
height: 15px;
}
QRadioButton::indicator::unchecked {
image: url(:/image/radio_normal.png);
}
QRadioButton::indicator::checked {
image: url(:/image/radio_selected.png);
}
QComboBox,QDateEdit{
border-radius: 3px;
padding: 1px 10px 1px 5px;
border: 1px solid #B8B8B8;
}
QComboBox::drop-down,QDateEdit::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 1px;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-left-color: #B8B8B8;
}
QComboBox::down-arrow,QDateEdit::down-arrow {
image: url(:/image/array_down.png);
}
QMenu {
background-color:#F0F0F0;
margin: 2px;
}
QMenu::item {
padding: 2px 12px 2px 12px;
}
QMenu::indicator {
width: 13px;
height: 13px;
}
QMenu::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QMenu::separator {
height: 1px;
background: #B8B8B8;
}
QProgressBar {
border-radius: 5px;
text-align: center;
border: 1px solid #B8B8B8;
}
QProgressBar::chunk {
width: 5px;
margin: 0.5px;
background-color: #454648;
}
QSlider::groove:horizontal,QSlider::add-page:horizontal {
background: #808080;
height: 8px;
border-radius: 3px;
}
QSlider::sub-page:horizontal {
height: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QSlider::handle:horizontal {
width: 13px;
margin-top: -3px;
margin-bottom: -3px;
border-radius: 6px;
background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #B8B8B8);
}
QSlider::handle:horizontal:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #454648);
}
QSlider::groove:vertical,QSlider::sub-page:vertical {
background:#808080;
width: 8px;
border-radius: 3px;
}
QSlider::add-page:vertical {
width: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QSlider::handle:vertical {
height: 14px;
margin-left: -3px;
margin-right: -3px;
border-radius: 6px;
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #B8B8B8);
}
QSlider::handle:vertical:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #454648);
}
QScrollBar:vertical {
width:10px;
background-color:rgba(0,0,0,0%);
padding-top:10px;
padding-bottom:10px;
}
QScrollBar:horizontal {
height:10px;
background-color:rgba(0,0,0,0%);
padding-left:10px; padding-right:10px;
}
QScrollBar::handle:vertical {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
}
QScrollBar::handle:horizontal {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
}
QScrollBar::handle:vertical:hover {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QScrollBar::handle:horizontal:hover {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QScrollBar::add-line:vertical {
height:10px;
width:10px;
subcontrol-position: bottom;
subcontrol-origin: margin;
border-image:url(:/image/add-line_vertical.png);
}
QScrollBar::add-line:horizontal {
height:10px;
width:10px;
subcontrol-position: right;
subcontrol-origin: margin;
border-image:url(:/image/add-line_horizontal.png);
}
QScrollBar::sub-line:vertical {
height:10px;
width:10px;
subcontrol-position: top;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_vertical.png);
}
QScrollBar::sub-line:horizontal {
height:10px;
width:10px;
subcontrol-position: left;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_horizontal.png);
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
width:10px;
background: #C0C0C0;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
height:10px;
background: #C0C0C0;
}
QScrollArea {
border: 0px ;
}
QTreeView,QListView,QTableView{
border: 1px solid #B8B8B8;
selection-background-color: #454648;
selection-color: #F0F0F0;
}
QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
}
QTableView::item, QListView::item, QTreeView::item {
padding: 5px;
margin: 0px;
}
QHeaderView::section {
padding:3px;
margin:0px;
color:#F0F0F0;
border: 1px solid #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
}
QTabBar::tab {
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
color: #F0F0F0;
min-width: 60px;
min-height: 20px;
padding: 3px 8px 3px 8px;
margin:1px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
}
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
}
QStatusBar::item {
border: 1px solid #B8B8B8;
border-radius: 3px;
}
\ No newline at end of file
QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
border:1px solid #0F7DBE;
border-radius:0px;
}
.QFrame{
border:1px solid #50A3F0;
border-radius:5px;
}
QWidget#widget_title{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QLabel#lab_Ico,QLabel#lab_Title{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QLineEdit {
border: 1px solid #50A3F0;
border-radius: 5px;
padding: 2px;
background: none;
selection-background-color: #0F7DBE;
}
QLineEdit[echoMode="2"] {
lineedit-password-character: 9679;
}
.QGroupBox{
border: 1px solid #50A3F0;
border-radius: 5px;
}
.QPushButton{
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 5px;
min-height: 20px;
border-radius:5px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
.QPushButton[focusPolicy="0"] {
border-style: none;
border: 0px;
color: #F0F0F0;
padding: 0px;
min-height: 10px;
border-radius:3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
.QPushButton:hover{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
}
.QPushButton:pressed{
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
border-radius:0px;
color: #F0F0F0;
background-color:rgba(0,0,0,0);
border-style:none;
}
QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #50A3F0);
}
QPushButton#btnMenu_Close:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
}
QCheckBox {
spacing: 2px;
}
QCheckBox::indicator {
width: 20px;
height: 20px;
}
QCheckBox::indicator:unchecked {
image: url(:/image/checkbox_unchecked.png);
}
QCheckBox::indicator:checked {
image: url(:/image/checkbox_checked.png);
}
QRadioButton {
spacing: 2px;
}
QRadioButton::indicator {
width: 15px;
height: 15px;
}
QRadioButton::indicator::unchecked {
image: url(:/image/radio_normal.png);
}
QRadioButton::indicator::checked {
image: url(:/image/radio_selected.png);
}
QComboBox,QDateEdit{
border-radius: 3px;
padding: 1px 10px 1px 5px;
border: 1px solid #50A3F0;
}
QComboBox::drop-down,QDateEdit::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
border-left-width: 1px;
border-left-style: solid;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
border-left-color: #50A3F0;
}
QComboBox::down-arrow,QDateEdit::down-arrow {
image: url(:/image/array_down.png);
}
QMenu {
background-color:#F0F0F0;
margin: 2px;
}
QMenu::item {
padding: 2px 12px 2px 12px;
}
QMenu::indicator {
width: 13px;
height: 13px;
}
QMenu::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QMenu::separator {
height: 1px;
background: #50A3F0;
}
QProgressBar {
border-radius: 5px;
text-align: center;
border: 1px solid #50A3F0;
}
QProgressBar::chunk {
width: 5px;
margin: 0.5px;
background-color: #0F7DBE;
}
QSlider::groove:horizontal,QSlider::add-page:horizontal {
background: #808080;
height: 8px;
border-radius: 3px;
}
QSlider::sub-page:horizontal {
height: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QSlider::handle:horizontal {
width: 13px;
margin-top: -3px;
margin-bottom: -3px;
border-radius: 6px;
background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #50A3F0);
}
QSlider::handle:horizontal:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #0F7DBE);
}
QSlider::groove:vertical,QSlider::sub-page:vertical {
background:#808080;
width: 8px;
border-radius: 3px;
}
QSlider::add-page:vertical {
width: 8px;
border-radius: 3px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QSlider::handle:vertical {
height: 14px;
margin-left: -3px;
margin-right: -3px;
border-radius: 6px;
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #50A3F0);
}
QSlider::handle:vertical:hover {
background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #0F7DBE);
}
QScrollBar:vertical {
width:10px;
background-color:rgba(0,0,0,0%);
padding-top:10px;
padding-bottom:10px;
}
QScrollBar:horizontal {
height:10px;
background-color:rgba(0,0,0,0%);
padding-left:10px; padding-right:10px;
}
QScrollBar::handle:vertical {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
}
QScrollBar::handle:horizontal {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
}
QScrollBar::handle:vertical:hover {
width:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QScrollBar::handle:horizontal:hover {
height:10px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QScrollBar::add-line:vertical {
height:10px;
width:10px;
subcontrol-position: bottom;
subcontrol-origin: margin;
border-image:url(:/image/add-line_vertical.png);
}
QScrollBar::add-line:horizontal {
height:10px;
width:10px;
subcontrol-position: right;
subcontrol-origin: margin;
border-image:url(:/image/add-line_horizontal.png);
}
QScrollBar::sub-line:vertical {
height:10px;
width:10px;
subcontrol-position: top;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_vertical.png);
}
QScrollBar::sub-line:horizontal {
height:10px;
width:10px;
subcontrol-position: left;
subcontrol-origin: margin;
border-image:url(:/image/sub-line_horizontal.png);
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
width:10px;
background: #C0C0C0;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
height:10px;
background: #C0C0C0;
}
QScrollArea {
border: 0px ;
}
QTreeView,QListView,QTableView{
border: 1px solid #50A3F0;
selection-background-color: #0F7DBE;
selection-color: #F0F0F0;
}
QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
color: #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
}
QTableView::item, QListView::item, QTreeView::item {
padding: 5px;
margin: 0px;
}
QHeaderView::section {
padding:3px;
margin:0px;
color:#F0F0F0;
border: 1px solid #F0F0F0;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
}
QTabBar::tab {
border-bottom-left-radius:0px;
border-bottom-right-radius:0px;
color: #F0F0F0;
min-width: 60px;
min-height: 20px;
padding: 3px 8px 3px 8px;
margin:1px;
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
}
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
}
QStatusBar::item {
border: 1px solid #50A3F0;
border-radius: 3px;
}
\ No newline at end of file
File added
#include "logindlg.h"
#include "ui_logindlg.h"
#include "sqliteassistant/sqliteassistant.h"
#include "myhelper.h"
LoginDlg::LoginDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::LoginDlg)
{
ui->setupUi(this);
query_model_add = new QSqlQueryModel(this);
m_MainWindow = new MainWindow();
lab_tip = new QLabel(this);
timer_tip = new QTimer(this);
lab_tip->setSizeIncrement(200,20);
connect(timer_tip,&QTimer::timeout,this,[=](){
timer_tip->stop();
lab_tip->close();
});
connect(ui->pbn_close,&QPushButton::clicked,this,&MainWindow::close);
connect(ui->pbn_login,&QPushButton::clicked,this,[=](){
if(!LoginJudgment()){
return;
}else{
m_MainWindow->showFullScreen();
this->close();
}
});
setWindowTitle("用户登陆");
LoadStyleSheet();
InitGui();
}
void LoginDlg::LoadStyleSheet()
{
QFile qss(":/image/Login_Dialog.qss");
qss.open(QFile::ReadOnly);
this->setStyleSheet(qss.readAll());
qss.close();
}
bool LoginDlg::LoginJudgment()
{
lab_tip->setStyleSheet("QLabel{background: transparent;border: 1px solid transparent;"
"color:rgb(255,0,0);font-weight: bold;font: 25 10pt Microsoft YaHei;padding: 1px;}");
lab_tip->move(this->width()/2 - 90,this->height()- ui->pbn_login->height());
QString user = m_SqliteAssistant->Select_AdminInfoName();
QString pwd = m_SqliteAssistant->Select_AdminInfo("admin");
QString rootuser = "root";
QString m_user = ui->lineEdit_user->text();
QString m_pwd = ui->lineEdit_pwd->text();
if(m_user == user && m_pwd == pwd ){
return true;
}
if(m_user == rootuser && m_pwd == pwd ){
//config->show();
this->close();
}
if(m_user == user && m_pwd != pwd){
lab_tip->setText("密码错误,请重新输入");
ui->lineEdit_pwd->clear();
ui->lineEdit_pwd->setFocus();
lab_tip->adjustSize();
lab_tip->show();
timer_tip->start(2000);
return false;
}
if(m_user != user && m_pwd == pwd){
lab_tip->setText("用户名错误,请重新输入");
ui->lineEdit_user->clear();
ui->lineEdit_user->setFocus();
lab_tip->adjustSize();
lab_tip->show();
timer_tip->start(2000);
return false;
}
if(m_user != user && m_pwd != pwd){
lab_tip->setText("用户名和密码错误,请重新输入");
ui->lineEdit_pwd->clear();
ui->lineEdit_user->clear();
ui->lineEdit_user->setFocus();
lab_tip->adjustSize();
lab_tip->show();
timer_tip->start(2000);
return false;
}
return false;
}
LoginDlg::~LoginDlg()
{
delete ui;
}
void LoginDlg::InitGui()
{
setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_TranslucentBackground);
ui->lab_title->setText("用户登陆");
ui->lab_name->setText("信湖煤矿——门禁系统");
ui->lineEdit_user->setFocus();
ui->lineEdit_user->setText("admin");
ui->lineEdit_pwd->setText("jm123456");
}
#ifndef LOGINDLG_H
#define LOGINDLG_H
#include <QDialog>
#include <QLabel>
#include <QSqlQueryModel>
#include <QTimer>
#include "mainwindow.h"
namespace Ui {
class LoginDlg;
}
class LoginDlg : public QDialog
{
Q_OBJECT
public:
explicit LoginDlg(QWidget *parent = nullptr);
~LoginDlg();
MainWindow *m_MainWindow;
private:
void InitGui();
void LoadStyleSheet();
//登录判断
bool LoginJudgment();
private:
Ui::LoginDlg *ui;
QLabel *lab_tip;
QTimer *timer_tip;
QSqlQueryModel *query_model_add;
QSqlQueryModel *query_model_state;
};
#endif // LOGINDLG_H
#include "mainwindow.h"
#include "myhelper.h"
#include <QApplication>
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
#include "modeller_applog/applog.h" //日志
#include "sqliteassistant/sqliteassistant.h" //数据库助手
#include "logindlg.h" //登陆
int LogKeepDay = 0; //日志保存天数,
SqliteAssistant *m_SqliteAssistant;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
myHelper::SetStyle("navy");
Singleton<AppLog>::getInstance().start();
m_SqliteAssistant = new SqliteAssistant();
if(0!=m_SqliteAssistant->connectSql())
{
qDebug()<<"connectSql error";
return 1;
}
else
{
qDebug()<<"connectSql ok";
}
//LogKeepDay
Singleton<AppLog>::getInstance().onClearLogFile("./log",LogKeepDay);
LoginDlg login;
login.show();
return a.exec();
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QLabel>
#include <QMainWindow>
#include <QPushButton>
#include <QTimer>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
void init(); //软件初始化
void SoftStart();
void ReadSystemInfo();
void CheckAll();
void SoftClose();
void dataUpDate();
void Pbn_clicked();
void SetLineEdit(bool status);
protected:
bool eventFilter(QObject *watched, QEvent *event);
void closeEvent(QCloseEvent *event);
private:
Ui::MainWindow *ui;
//Bridge *m_Bridge; //中间类
QLabel *m_systemTime; //系统运行时间
QLabel *m_ScanCode; //二维码识别器
QLabel *m_Rfid; //FRID读卡器
QLabel *m_Trunk; //道闸
QLabel *m_SportsCamera; //抓拍相机
QLabel *m_monitorCamera; //监控相机
QLabel *m_carplnumPic;
//QPushButton *m_ScanStatus;
QTimer *m_SoftBreath;
int m_SoftBreath_s = 0;
int m_SoftBreath_m = 0;
int m_SoftBreath_h = 0;
int m_SoftBreath_d = 0;
};
#endif // MAINWINDOW_H
#include "applog.h"
#include <QMutex>
#include <QFile>
#include <QTextStream>
#include <QDir>
#include <QDate>
#include <QApplication>
QtMessageHandler messageHandler = NULL;
AppLog::AppLog()
{
}
AppLog::~AppLog()
{
}
void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
QString text;
switch(type)
{
case QtDebugMsg:
text = QString("Debug");
break;
case QtInfoMsg:
text = QString("Info");
break;
case QtWarningMsg:
text = QString("Warning");
break;
case QtCriticalMsg:
text = QString("Critical");
break;
case QtFatalMsg:
text = QString("Fatal");
}
QString context_info = QString("File:(%1) Line:(%2) Function:%3")
.arg(QString(context.file))
.arg(context.line)
.arg(context.function);
QString current_date_time = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ddd");
QString current_date = QString("(%1)").arg(current_date_time);
QString message = QString("%1 %2 %3").arg(context_info).arg(msg).arg(current_date);
//加锁
static QMutex applog_mutex;
applog_mutex.lock();
//输出信息至文件中(读写、追加形式)
// QString logFileDir = QString("%1/log/%2")
// .arg(QApplication::applicationDirPath())
// .arg(QDate::currentDate().toString("yyyy-MM-dd"));
QString logFileDir = QString("%1/log")
.arg(QApplication::applicationDirPath());
// QString logFileName = QString("%1_%2_log.txt")
// .arg(QApplication::applicationName())
// .arg(text);
QString logFileName = QString("%1_%2_%3_log.txt")
.arg(QApplication::applicationName())
.arg(text)
.arg(QDate::currentDate().toString("yyyy-MM-dd"));
QDir logDir(logFileDir);
if (!logDir.exists())
logDir.mkpath(logFileDir);
QFile file(QString("%1/%2").arg(logFileDir).arg(logFileName));
file.open(QIODevice::WriteOnly | QIODevice::Append | QFile::Text);
QTextStream text_stream(&file);
text_stream << message << "\r\n";
file.flush();
file.close();
//解锁
applog_mutex.unlock();
//用系统原来的函数完成原来的功能. 比如输出到调试窗
if (messageHandler)
messageHandler(type, context, msg);
}
void AppLog::start()
{
//安装日志钩子
messageHandler = qInstallMessageHandler(outputMessage);
}
void AppLog::stop()
{
//卸载日志钩子
qInstallMessageHandler(0);
}
void AppLog::onClearLogFile(QString path, int keepLogDays)
{
QStringList fileList;
//需要清理文件的类型
QStringList filterList;
QString fileType = "*.txt";
filterList.append(fileType);
//获取目录内的文件列表
QDir dir = QDir(path);
Q_ASSERT(dir.exists());
fileList = dir.entryList(filterList, QDir::Files, QDir::Name);
QDateTime currDt = QDateTime::currentDateTime();
foreach (QString fileName, fileList)
{
//获取文件的创建时间
QFileInfo info(path + "/" + fileName);
QDateTime dt = info.created();
int days = dt.daysTo(currDt);
if(days > keepLogDays)
{
QFile::remove(path + "/" + fileName);
}
}
}
bool RemoveDir(QString dirPath)
{
if(dirPath.isEmpty())
return false;
QDir dir(dirPath);
if(!dir.exists())
return true;
for(QFileInfo info:dir.entryInfoList())
{
if(info.isFile())
{
QFile::remove(info.filePath());
}
else
{
RemoveDir(info.absoluteFilePath());
}
}
return dir.remove(dir.absolutePath());
}
#ifndef APPLOG_H
#define APPLOG_H
#include <QObject>
#include "singleton.h"
class AppLog
{
SINGLETON(AppLog)
public:
void start();
void stop();
void onClearLogFile(QString path, int keepLogDays);
};
#endif // APPLOG_H
#程序的记录员
HEADERS += \
$$PWD/applog.h
SOURCES += \
$$PWD/applog.cpp
#ifndef SINGLETON_H
#define SINGLETON_H
#include <QMutex>
#include <QScopedPointer>
/**
* 使用方法:
* 1. 定义类为单例:
* class ConnectionPool {
* SINGLETON(ConnectionPool) // Here
* public:
*
* 2. 获取单例类的对象:
* Singleton<ConnectionPool>::getInstance();
* ConnectionPool &pool = Singleton<ConnectionPool>::getInstance();
* 注意: 如果单例的类需要释放的资源和 Qt 底层的信号系统有关系,例如 QSettings,QSqlDatabase 等,
* 需要在程序结束前手动释放(也就是在 main() 函数返回前调用释放资源的函数,参考 ConnectionPool 的调用),
* 否则有可能在程序退出时报系统底层的信号错误,导致如 QSettings 的数据没有保存。
*/
template <typename T>
class Singleton {
public:
static T& getInstance();
Singleton(const Singleton &other);
Singleton<T>& operator=(const Singleton &other);
private:
//同步锁
static QMutex mutex;
//智能指针,只在该作用域存在,一旦出该作用域,就会自动销毁
static QScopedPointer<T> instance;
};
/*-----------------------------------------------------------------------------|
| Singleton implementation |
|----------------------------------------------------------------------------*/
template <typename T> QMutex Singleton<T>::mutex;
template <typename T> QScopedPointer<T> Singleton<T>::instance;
template <typename T>
T &Singleton<T>::getInstance()
{
if (instance.isNull()) {
mutex.lock();
if (instance.isNull()) {
//reset():delete目前指向的对象,调用其析构函数,将指针指向另一个对象other,所有权转移到other
instance.reset(new T());
}
mutex.unlock();
}
/**
* 获取智能指针动态创建的对象的指针有两种方法:QScopedPointer#data() 和 QScopedPointer#take()
* T *QScopedPointer::data() const返回指向对象的常量指针,QScopedPointer仍拥有对象所有权。
* 所以通过data()返回过后就被自动删除了,从而导致mian函数中的p1变成了野指针,程序崩溃.
* 使用T *QScopedPointer::take()也是返回对象指针,但QScopedPointer不再拥有对象所有权,而
* 是转移到调用这个函数的caller,同时QScopePointer对象指针置为NULL
*/
return *instance.data();
}
/*-----------------------------------------------------------------------------|
| Singleton Macro |
|----------------------------------------------------------------------------*/
/**
* QScopedPointerDeleter 是 QScopedPointer 的默认实现,使用delete删除指针
* 宏中不能使用 // 添加注释,换行续添加换行符 “\”
*
* 宏中已经申明了构造函数和析构函数,使用该宏的类直接写函数体即可,无需再次申明
*/
#define SINGLETON(Class) \
private: \
Class(); \
~Class(); \
Class(const Class &other); \
Class& operator=(const Class &other); \
friend class Singleton<Class>; /* 注释必须写在续行符("\")的前面 */ \
friend struct QScopedPointerDeleter<Class>;/* 末尾注释不需要加续行符 */
#endif // DBUTIL_H
#ifndef MYHELPER_H
#define MYHELPER_H
#include <QApplication>
#include <QDesktopWidget>
#include <QFile>
#include <QSettings>
#include <QTime>
#include <QTranslator>
#include "frmmessagebox.h"
class myHelper: public QObject
{
public:
//设置为开机启动
static void AutoRunWithSystem(bool IsAutoRun, QString AppName, QString AppPath)
{
QSettings *reg = new QSettings(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
QSettings::NativeFormat);
if (IsAutoRun) {
reg->setValue(AppName, AppPath);
} else {
reg->setValue(AppName, "");
}
}
//设置编码为UTF8
static void SetUTF8Code()
{
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForLocale(codec);
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForTr(codec);
#endif
}
//设置皮肤样式
static void SetStyle(const QString &styleName)
{
QFile file(QString(":/image/%1.css").arg(styleName));
file.open(QFile::ReadOnly);
QString qss = QLatin1String(file.readAll());
qApp->setStyleSheet(qss);
qApp->setPalette(QPalette(QColor("#F0F0F0")));
}
//加载中文字符
static void SetChinese()
{
QTranslator *translator = new QTranslator(qApp);
translator->load(":/image/qt_zh_CN.qm");
qApp->installTranslator(translator);
}
//判断是否是IP地址
static bool IsIP(QString IP)
{
QRegExp RegExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)");
return RegExp.exactMatch(IP);
}
//显示信息框,仅确定按钮
static void ShowMessageBoxInfo(QString info)
{
frmMessageBox *msg = new frmMessageBox;
msg->SetMessage(info, 0);
msg->exec();
}
//显示错误框,仅确定按钮
static void ShowMessageBoxError(QString info)
{
frmMessageBox *msg = new frmMessageBox;
msg->SetMessage(info, 2);
msg->exec();
}
//显示询问框,确定和取消按钮
static int ShowMessageBoxQuesion(QString info)
{
frmMessageBox *msg = new frmMessageBox;
msg->SetMessage(info, 1);
return msg->exec();
}
//延时
static void Sleep(int sec)
{
QTime dieTime = QTime::currentTime().addMSecs(sec);
while ( QTime::currentTime() < dieTime ) {
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
}
//窗体居中显示
static void FormInCenter(QWidget *frm)
{
int frmX = frm->width();
int frmY = frm->height();
QDesktopWidget w;
int deskWidth = w.width();
int deskHeight = w.height();
QPoint movePoint(deskWidth / 2 - frmX / 2, deskHeight / 2 - frmY / 2);
frm->move(movePoint);
}
};
#endif // MYHELPER_H
temp/obj/bridge.o
temp/obj/frmmessagebox.o
temp/obj/iconhelper.o
temp/obj/logindlg.o
temp/obj/main.o
temp/obj/mainwindow.o
temp/obj/sqlitehandle.o
temp/obj/applog.o
temp/obj/sqliteassistant.o
temp/obj/scancodecontrol.o
temp/obj/qrc_image.o
temp/obj/moc_bridge.o
temp/obj/moc_frmmessagebox.o
temp/obj/moc_logindlg.o
temp/obj/moc_mainwindow.o
temp/obj/moc_sqlitehandle.o
temp/obj/moc_sqliteassistant.o
temp/obj/moc_scancodecontrol.o
temp/obj/bridge.o
temp/obj/frmmessagebox.o
temp/obj/iconhelper.o
temp/obj/logindlg.o
temp/obj/main.o
temp/obj/mainwindow.o
temp/obj/sqlitehandle.o
temp/obj/applog.o
temp/obj/sqliteassistant.o
temp/obj/scancodecontrol.o
temp/obj/qrc_image.o
temp/obj/moc_bridge.o
temp/obj/moc_frmmessagebox.o
temp/obj/moc_logindlg.o
temp/obj/moc_mainwindow.o
temp/obj/moc_sqlitehandle.o
temp/obj/moc_sqliteassistant.o
temp/obj/moc_scancodecontrol.o
pic/1.jpg

475.8 KB

HEADERS += \
$$PWD/scancodecontrol.h
SOURCES += \
$$PWD/scancodecontrol.cpp
#include "scancodecontrol.h"
#include "myhelper.h"
#include <QRegExp>
ScanCodeControl::ScanCodeControl(QObject *parent) : QObject(parent)
{
}
void ScanCodeControl::setComm(QString ComName, long baudRate)
{
// 设置串口号
SerialPort.setPortName(ComName);
// 打开串口
if(SerialPort.open(QIODevice::ReadOnly))
{
// 设置波特率
SerialPort.setBaudRate(baudRate);
SerialPort.setDataBits(QSerialPort::Data8);
SerialPort.setParity(QSerialPort::NoParity);
// 设置流控制
SerialPort.setFlowControl(QSerialPort::NoFlowControl);
SerialPort.setStopBits(QSerialPort::OneStop);
emit SendToBridge_ScanCodeDataisOk();
//设置数据位数
// switch(8)
// {
// case 5: SerialPort.setDataBits(QSerialPort::Data5); break;
// case 6: SerialPort.setDataBits(QSerialPort::Data6); break;
// case 7: SerialPort.setDataBits(QSerialPort::Data7); break;
// case 8: SerialPort.setDataBits(QSerialPort::Data8); break;
// default: break;
// }
// 设置校验位
//SerialPort->setParity(QSerialPort::NoParity);
//设置奇偶校验
// switch(parity)
// {
// case 0: SerialPort.setParity(QSerialPort::NoParity); break;
// case 1: SerialPort.setParity(QSerialPort::OddParity); break;
// case 2: SerialPort.setParity(QSerialPort::EvenParity); break;
// default: break;
// }
//设置停止位
// switch(stopBits)
// {
// case 1: SerialPort.setStopBits(QSerialPort::OneStop); break;
// case 2: SerialPort.setStopBits(QSerialPort::TwoStop); break;
// default: break;
// }
}else {
//myHelper::ShowMessageBoxError("扫码模块故障");
return;
}
connect(&SerialPort,&QSerialPort::readyRead,this,[=](){
QString str(SerialPort.readAll());
QStringList list = str.split(QRegExp("[\r\n]"),QString::SkipEmptyParts); //去掉\r\n
foreach (QString line, list) {
if(m_RepeatScan == line){
return;
}
m_RepeatScan =line;
m_timer->start(100);
}
});
m_timer = new QTimer(this);
connect(m_timer,&QTimer::timeout,this,[=](){
m_timer->stop();
emit SendToBridge_ScanCodeData(m_RepeatScan);
m_RepeatScan = nullptr;
});
}
#ifndef SCANCODECONTROL_H
#define SCANCODECONTROL_H
#include <QObject>
#include <QSerialPort>
#include <QTimer>
class ScanCodeControl : public QObject
{
Q_OBJECT
public:
explicit ScanCodeControl(QObject *parent = nullptr);
public:
signals:
void SendToBridge_ScanCodeData(QString data);
void SendToBridge_ScanCodeDataisOk();
public slots:
void setComm(QString ComName,long baudRate);
private:
QSerialPort SerialPort;
QString m_RepeatScan = nullptr;
QTimer *m_timer; //扫码数据重置
};
#endif // SCANCODECONTROL_H
++ "b/scanCode_control/\346\211\253\347\240\201\346\250\241\345\235\227.txt"
#ifndef SQLITEASSISTANT_H
#define SQLITEASSISTANT_H
#include <QObject>
#include <QSql>
#include <QSqlQueryModel>
#include <QTableWidget>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include "vehinfo.h"
class SqliteAssistant : public QObject
{
Q_OBJECT
public:
explicit SqliteAssistant(QObject *parent = nullptr);
long connectSql(); //检测连接
long Insert_GoodTypeInfo(QString data); //插入货物信息
QStringList Select_GoodTypeInfo(); //查询货物信息
long Insert_CustomerInfo(QString data); //插入客户信息
QStringList Select_CustomerInfo(); //查询客户信息
QStringList Select_EqptInfo(); //查询设备表信息
long Delete_CustomerInfo(QString data); //删除客户信息
long Delete_GoodTypeInfo(QString data); //删除货物信息
long Insert_EquipmentInfo(QString data,QString data2); //插入设备注册信息
long Delete_EquipmentInfo(QString data); //删除设备注册信息
long Insert_SystemConfigInfo(QString data,QString data2); //插入配置信息
//long Updata_SystemConfigInfo(QString data,QString data2); //更新配置信息
QString Select_SystemConfigInfo(QString data); //查询配置信息
QString Select_AdminInfo(QString data); //查询管理员信息
QString Select_AdminInfoName(); //查询管理员名字
long Insert_UserInfo(QString data,QString data2,QString data3); //插入用户信息
QStringList Select_UserInfo(); //查找用户信息
QStringList Select_UserInfo2(); //查找用户信息2
QString Select_UserInfo3(QString data); //查找用户信息3
long Delete_UserInfo(QString data); //删除用户
long Updata_AdminInfo(QString data); //查询管理员信息
long Insert_WeighingRun(QString data,QString data2,
QString data3,QString data4,
QString data5,QString data6,
QString data7,QString data8,
QString data9,QString data10); //插入称重信息
long select_ui_WeighingRun(QTableWidget *weight,int sumCount);
long Delete_WeighingRun(int data); //删除记录
int GetRowounts(QString tableName); // 获取表记录
long SelectInfo_sqliteView(QTableWidget *weight,SelectInfor &infor,int sumCount); //查询界面
// long Insert_GoodTypeInfo(QString data);
// long Insert_GoodTypeInfo(QString data);
// long Insert_GoodTypeInfo(QString data);
// long Insert_GoodTypeInfo(QString data);
// long Insert_GoodTypeInfo(QString data);
signals:
void Send_Data_Exists();
void Send_Data_Not_Exists();
void RecvFromBridge_Insert_GoodTypeInfo(QString data);
void Send_DataModel(QSqlQueryModel *data);
private:
QSqlDatabase database;
QSqlQuery *m_pSqlHandle;
};
extern SqliteAssistant *m_SqliteAssistant;
#endif // SQLITEASSISTANT_H
HEADERS += \
$$PWD/sqliteassistant.h
SOURCES += \
$$PWD/sqliteassistant.cpp
#include "sqlitehandle.h"
SqliteHandle::SqliteHandle(QObject *parent) : QObject(parent)
{
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论