改进代码

master
feiyangqingyun 2021-05-17 14:43:33 +08:00
parent 2036e9a0eb
commit c54fec1992
46 changed files with 303 additions and 302 deletions

View File

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

@ -29,7 +29,7 @@
| 22 | lineeditnext | 文本框回车焦点下移 | | 22 | lineeditnext | 文本框回车焦点下移 |
| 23 | zhtopy | 汉字转拼音 | | 23 | zhtopy | 汉字转拼音 |
| 24 | qwtdemo | qwt的源码版本无需插件直接源码集成到你的项目即可 | | 24 | qwtdemo | qwt的源码版本无需插件直接源码集成到你的项目即可 |
| 25 | buttondefence | 通用按钮地图效果 | | 25 | devicebutton | 设备按钮地图效果 |
| 26 | mouseline | 鼠标定位十字线 | | 26 | mouseline | 鼠标定位十字线 |
| 27 | emailtool | 邮件发送工具 | | 27 | emailtool | 邮件发送工具 |
| 28 | ntpclient | NTP服务器时间同步 | | 28 | ntpclient | NTP服务器时间同步 |
@ -81,7 +81,7 @@
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/lineeditnext.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/lineeditnext.gif)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/zhtopy.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/zhtopy.gif)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/qwtdemo.jpg) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/qwtdemo.jpg)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/buttondefence.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/devicebutton.gif)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/mouseline.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/mouseline.gif)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/emailtool.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/emailtool.gif)
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/ntpclient.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/ntpclient.gif)

View File

@ -1,99 +0,0 @@
#ifndef BUTTONDEFENCE_H
#define BUTTONDEFENCE_H
/**
* :feiyangqingyun(QQ:517216493) 2018-7-2
* 1. 22
* 2.
* 3.
* 4.
* 5.
* 6.
*/
#include <QWidget>
#ifdef quc
class Q_DECL_EXPORT ButtonDefence : public QWidget
#else
class ButtonDefence : public QWidget
#endif
{
Q_OBJECT
Q_ENUMS(ButtonStyle)
Q_ENUMS(ButtonStatus)
Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove)
Q_PROPERTY(QString text READ getText WRITE setText)
Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle)
Q_PROPERTY(ButtonStatus buttonStatus READ getButtonStatus WRITE setButtonStatus)
public:
//防区样式 圆形、警察、气泡、气泡2、消息、消息2
enum ButtonStyle {
ButtonStyle_Circle = 0,
ButtonStyle_Police = 1,
ButtonStyle_Bubble = 2,
ButtonStyle_Bubble2 = 3,
ButtonStyle_Msg = 4,
ButtonStyle_Msg2 = 5
};
//防区状态 布防、撤防、报警、旁路、故障
enum ButtonStatus {
ButtonStatus_Arming = 0,
ButtonStatus_Disarming = 1,
ButtonStatus_Alarm = 2,
ButtonStatus_Bypass = 3,
ButtonStatus_Error = 4
};
explicit ButtonDefence(QWidget *parent = 0);
~ButtonDefence();
protected:
void paintEvent(QPaintEvent *);
bool eventFilter(QObject *watched, QEvent *event);
private:
bool canMove; //是否可移动
QString text; //显示文字
ButtonStyle buttonStyle; //防区样式
ButtonStatus buttonStatus; //防区状态
QString type; //图片末尾类型
QString imgName; //背景图片名称
bool isDark; //是否加深报警
QTimer *timer; //报警闪烁定时器
private slots:
void checkAlarm();
public:
bool getCanMove() const;
QString getText() const;
ButtonStyle getButtonStyle() const;
ButtonStatus getButtonStatus() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置可移动
void setCanMove(bool canMove);
//设置显示文字
void setText(const QString &text);
//设置防区样式
void setButtonStyle(const ButtonStyle &buttonStyle);
//设置防区状态
void setButtonStatus(const ButtonStatus &buttonStatus);
Q_SIGNALS:
void clicked();
void doubleClicked();
};
#endif //BUTTONDEFENCE_H

View File

@ -1,71 +0,0 @@
#include "frmbuttondefence.h"
#include "ui_frmbuttondefence.h"
#include "buttondefence.h"
#include "qdebug.h"
frmButtonDefence::frmButtonDefence(QWidget *parent) : QWidget(parent), ui(new Ui::frmButtonDefence)
{
ui->setupUi(this);
this->initForm();
}
frmButtonDefence::~frmButtonDefence()
{
delete ui;
}
void frmButtonDefence::initForm()
{
//设置背景地图
ui->labMap->setStyleSheet("border-image:url(:/image/bg_call.jpg);");
btn1 = new ButtonDefence(ui->labMap);
btn1->setText("#1");
btn1->setGeometry(5, 5, 35, 35);
btn2 = new ButtonDefence(ui->labMap);
btn2->setText("#2");
btn2->setGeometry(45, 5, 35, 35);
btn3 = new ButtonDefence(ui->labMap);
btn3->setText("#3");
btn3->setGeometry(85, 5, 35, 35);
btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2;
foreach (QPushButton *btn, btnStyle) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle()));
}
btnStatus << ui->btnArming << ui->btnDisarming << ui->btnAlarm << ui->btnBypass << ui->btnError;
foreach (QPushButton *btn, btnStatus) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStatus()));
}
}
void frmButtonDefence::changeStyle()
{
QPushButton *btn = (QPushButton *)sender();
int index = btnStyle.indexOf(btn);
ButtonDefence::ButtonStyle style = (ButtonDefence::ButtonStyle)index;
btn1->setButtonStyle(style);
btn2->setButtonStyle(style);
btn3->setButtonStyle(style);
}
void frmButtonDefence::changeStatus()
{
QPushButton *btn = (QPushButton *)sender();
int index = btnStatus.indexOf(btn);
ButtonDefence::ButtonStatus style = (ButtonDefence::ButtonStatus)index;
btn1->setButtonStatus(style);
btn2->setButtonStatus(style);
btn3->setButtonStatus(style);
}
void frmButtonDefence::on_ckCanMove_stateChanged(int arg1)
{
bool canMove = (arg1 != 0);
btn1->setCanMove(canMove);
btn2->setCanMove(canMove);
btn3->setCanMove(canMove);
}

View File

@ -1,36 +0,0 @@
#ifndef FRMBUTTONDEFENCE_H
#define FRMBUTTONDEFENCE_H
#include <QWidget>
class ButtonDefence;
class QPushButton;
namespace Ui {
class frmButtonDefence;
}
class frmButtonDefence : public QWidget
{
Q_OBJECT
public:
explicit frmButtonDefence(QWidget *parent = 0);
~frmButtonDefence();
private slots:
void initForm();
void changeStyle();
void changeStatus();
void on_ckCanMove_stateChanged(int arg1);
private:
Ui::frmButtonDefence *ui;
ButtonDefence *btn1;
ButtonDefence *btn2;
ButtonDefence *btn3;
QList<QPushButton *> btnStyle;
QList<QPushButton *> btnStatus;
};
#endif // FRMBUTTONDEFENCE_H

View File

@ -1,35 +0,0 @@
<RCC>
<qresource prefix="/">
<file>image/bg_call.jpg</file>
<file>image/buttondefence/btn_defence_alarm_bubble.png</file>
<file>image/buttondefence/btn_defence_alarm_bubble2.png</file>
<file>image/buttondefence/btn_defence_alarm_circle.png</file>
<file>image/buttondefence/btn_defence_alarm_msg.png</file>
<file>image/buttondefence/btn_defence_alarm_msg2.png</file>
<file>image/buttondefence/btn_defence_alarm_police.png</file>
<file>image/buttondefence/btn_defence_arming_bubble.png</file>
<file>image/buttondefence/btn_defence_arming_bubble2.png</file>
<file>image/buttondefence/btn_defence_arming_circle.png</file>
<file>image/buttondefence/btn_defence_arming_msg.png</file>
<file>image/buttondefence/btn_defence_arming_msg2.png</file>
<file>image/buttondefence/btn_defence_arming_police.png</file>
<file>image/buttondefence/btn_defence_bypass_bubble.png</file>
<file>image/buttondefence/btn_defence_bypass_bubble2.png</file>
<file>image/buttondefence/btn_defence_bypass_circle.png</file>
<file>image/buttondefence/btn_defence_bypass_msg.png</file>
<file>image/buttondefence/btn_defence_bypass_msg2.png</file>
<file>image/buttondefence/btn_defence_bypass_police.png</file>
<file>image/buttondefence/btn_defence_disarming_bubble.png</file>
<file>image/buttondefence/btn_defence_disarming_bubble2.png</file>
<file>image/buttondefence/btn_defence_disarming_circle.png</file>
<file>image/buttondefence/btn_defence_disarming_msg.png</file>
<file>image/buttondefence/btn_defence_disarming_msg2.png</file>
<file>image/buttondefence/btn_defence_disarming_police.png</file>
<file>image/buttondefence/btn_defence_error_bubble.png</file>
<file>image/buttondefence/btn_defence_error_bubble2.png</file>
<file>image/buttondefence/btn_defence_error_circle.png</file>
<file>image/buttondefence/btn_defence_error_msg.png</file>
<file>image/buttondefence/btn_defence_error_msg2.png</file>
<file>image/buttondefence/btn_defence_error_police.png</file>
</qresource>
</RCC>

View File

@ -1,20 +1,20 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#include "buttondefence.h" #include "devicebutton.h"
#include "qpainter.h" #include "qpainter.h"
#include "qevent.h" #include "qevent.h"
#include "qtimer.h" #include "qtimer.h"
#include "qdebug.h" #include "qdebug.h"
ButtonDefence::ButtonDefence(QWidget *parent) : QWidget(parent) DeviceButton::DeviceButton(QWidget *parent) : QWidget(parent)
{ {
canMove = false; canMove = false;
text = "1"; text = "1";
buttonStyle = ButtonStyle_Police; buttonStyle = ButtonStyle_Police;
buttonStatus = ButtonStatus_Arming; buttonColor = ButtonColor_Green;
type = "police"; type = "police";
imgName = QString(":/image/buttondefence/btn_defence_disarming_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_green_%1.png").arg(type);
isDark = false; isDark = false;
timer = new QTimer(this); timer = new QTimer(this);
@ -24,14 +24,14 @@ ButtonDefence::ButtonDefence(QWidget *parent) : QWidget(parent)
this->installEventFilter(this); this->installEventFilter(this);
} }
ButtonDefence::~ButtonDefence() DeviceButton::~DeviceButton()
{ {
if (timer->isActive()) { if (timer->isActive()) {
timer->stop(); timer->stop();
} }
} }
void ButtonDefence::paintEvent(QPaintEvent *) void DeviceButton::paintEvent(QPaintEvent *)
{ {
double width = this->width(); double width = this->width();
double height = this->height(); double height = this->height();
@ -77,7 +77,7 @@ void ButtonDefence::paintEvent(QPaintEvent *)
painter.drawText(rect, Qt::AlignCenter, text); painter.drawText(rect, Qt::AlignCenter, text);
} }
bool ButtonDefence::eventFilter(QObject *watched, QEvent *event) bool DeviceButton::eventFilter(QObject *watched, QEvent *event)
{ {
if (canMove) { if (canMove) {
static QPoint lastPoint; static QPoint lastPoint;
@ -109,54 +109,54 @@ bool ButtonDefence::eventFilter(QObject *watched, QEvent *event)
return QWidget::eventFilter(watched, event); return QWidget::eventFilter(watched, event);
} }
bool ButtonDefence::getCanMove() const bool DeviceButton::getCanMove() const
{ {
return this->canMove; return this->canMove;
} }
QString ButtonDefence::getText() const QString DeviceButton::getText() const
{ {
return this->text; return this->text;
} }
ButtonDefence::ButtonStyle ButtonDefence::getButtonStyle() const DeviceButton::ButtonStyle DeviceButton::getButtonStyle() const
{ {
return this->buttonStyle; return this->buttonStyle;
} }
ButtonDefence::ButtonStatus ButtonDefence::getButtonStatus() const DeviceButton::ButtonColor DeviceButton::getButtonColor() const
{ {
return this->buttonStatus; return this->buttonColor;
} }
QSize ButtonDefence::sizeHint() const QSize DeviceButton::sizeHint() const
{ {
return QSize(50, 50); return QSize(50, 50);
} }
QSize ButtonDefence::minimumSizeHint() const QSize DeviceButton::minimumSizeHint() const
{ {
return QSize(10, 10); return QSize(10, 10);
} }
void ButtonDefence::checkAlarm() void DeviceButton::checkAlarm()
{ {
if (isDark) { if (isDark) {
imgName = QString(":/image/buttondefence/btn_defence_error_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_black_%1.png").arg(type);
} else { } else {
imgName = QString(":/image/buttondefence/btn_defence_alarm_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_red_%1.png").arg(type);
} }
isDark = !isDark; isDark = !isDark;
this->update(); this->update();
} }
void ButtonDefence::setCanMove(bool canMove) void DeviceButton::setCanMove(bool canMove)
{ {
this->canMove = canMove; this->canMove = canMove;
} }
void ButtonDefence::setText(const QString &text) void DeviceButton::setText(const QString &text)
{ {
if (this->text != text) { if (this->text != text) {
this->text = text; this->text = text;
@ -164,7 +164,7 @@ void ButtonDefence::setText(const QString &text)
} }
} }
void ButtonDefence::setButtonStyle(const ButtonDefence::ButtonStyle &buttonStyle) void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle)
{ {
this->buttonStyle = buttonStyle; this->buttonStyle = buttonStyle;
if (buttonStyle == ButtonStyle_Circle) { if (buttonStyle == ButtonStyle_Circle) {
@ -183,26 +183,26 @@ void ButtonDefence::setButtonStyle(const ButtonDefence::ButtonStyle &buttonStyle
type = "circle"; type = "circle";
} }
setButtonStatus(buttonStatus); setButtonColor(buttonColor);
} }
void ButtonDefence::setButtonStatus(const ButtonDefence::ButtonStatus &buttonStatus) void DeviceButton::setButtonColor(const DeviceButton::ButtonColor &buttonColor)
{ {
this->buttonStatus = buttonStatus; this->buttonColor = buttonColor;
isDark = false; isDark = false;
if (timer->isActive()) { if (timer->isActive()) {
timer->stop(); timer->stop();
} }
if (buttonStatus == ButtonStatus_Arming) { if (buttonColor == ButtonColor_Green) {
imgName = QString(":/image/buttondefence/btn_defence_arming_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_green_%1.png").arg(type);
} else if (buttonStatus == ButtonStatus_Disarming) { } else if (buttonColor == ButtonColor_Blue) {
imgName = QString(":/image/buttondefence/btn_defence_disarming_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_blue_%1.png").arg(type);
} else if (buttonStatus == ButtonStatus_Bypass) { } else if (buttonColor == ButtonColor_Gray) {
imgName = QString(":/image/buttondefence/btn_defence_bypass_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_gray_%1.png").arg(type);
} else if (buttonStatus == ButtonStatus_Error) { } else if (buttonColor == ButtonColor_Black) {
imgName = QString(":/image/buttondefence/btn_defence_error_%1.png").arg(type); imgName = QString(":/image/devicebutton/devicebutton_black_%1.png").arg(type);
} else if (buttonStatus == ButtonStatus_Alarm) { } else if (buttonColor == ButtonColor_Red) {
checkAlarm(); checkAlarm();
if (!timer->isActive()) { if (!timer->isActive()) {
timer->start(); timer->start();

View File

@ -0,0 +1,99 @@
#ifndef DEVICEBUTTON_H
#define DEVICEBUTTON_H
/**
* :feiyangqingyun(QQ:517216493) 2018-7-2
* 1. 22
* 2.
* 3.
* 4.
* 5.
* 6.
*/
#include <QWidget>
#ifdef quc
class Q_DECL_EXPORT DeviceButton : public QWidget
#else
class DeviceButton : public QWidget
#endif
{
Q_OBJECT
Q_ENUMS(ButtonStyle)
Q_ENUMS(ButtonColor)
Q_PROPERTY(bool canMove READ getCanMove WRITE setCanMove)
Q_PROPERTY(QString text READ getText WRITE setText)
Q_PROPERTY(ButtonStyle buttonStyle READ getButtonStyle WRITE setButtonStyle)
Q_PROPERTY(ButtonColor buttonColor READ getButtonColor WRITE setButtonColor)
public:
//设备按钮样式
enum ButtonStyle {
ButtonStyle_Circle = 0, //圆形
ButtonStyle_Police = 1, //警察
ButtonStyle_Bubble = 2, //气泡
ButtonStyle_Bubble2 = 3, //气泡2
ButtonStyle_Msg = 4, //消息
ButtonStyle_Msg2 = 5 //消息2
};
//设备按钮颜色
enum ButtonColor {
ButtonColor_Green = 0, //绿色 设备激活状态
ButtonColor_Blue = 1, //蓝色 设备在线状态
ButtonColor_Red = 2, //红色 设备报警状态
ButtonColor_Gray = 3, //灰色 设备离线状态
ButtonColor_Black = 4 //黑色 设备故障状态
};
explicit DeviceButton(QWidget *parent = 0);
~DeviceButton();
protected:
void paintEvent(QPaintEvent *);
bool eventFilter(QObject *watched, QEvent *event);
private:
bool canMove; //是否可移动
QString text; //显示文字
ButtonStyle buttonStyle; //按钮样式
ButtonColor buttonColor; //按钮颜色
QString type; //图片末尾类型
QString imgName; //背景图片名称
bool isDark; //是否加深报警
QTimer *timer; //报警闪烁定时器
private slots:
void checkAlarm(); //切换报警状态
public:
bool getCanMove() const;
QString getText() const;
ButtonStyle getButtonStyle() const;
ButtonColor getButtonColor() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置可移动
void setCanMove(bool canMove);
//设置显示文字
void setText(const QString &text);
//设置样式
void setButtonStyle(const ButtonStyle &buttonStyle);
//设置颜色
void setButtonColor(const ButtonColor &buttonColor);
Q_SIGNALS:
void clicked();
void doubleClicked();
};
#endif //DEVICEBUTTON_H

View File

@ -8,18 +8,18 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = buttondefence TARGET = devicebutton
TEMPLATE = app TEMPLATE = app
DESTDIR = $$PWD/../bin DESTDIR = $$PWD/../bin
CONFIG += warn_off CONFIG += warn_off
SOURCES += main.cpp SOURCES += main.cpp
SOURCES += frmbuttondefence.cpp SOURCES += frmdevicebutton.cpp
SOURCES += buttondefence.cpp SOURCES += devicebutton.cpp
HEADERS += frmbuttondefence.h HEADERS += frmdevicebutton.h
HEADERS += buttondefence.h HEADERS += devicebutton.h
FORMS += frmbuttondefence.ui FORMS += frmdevicebutton.ui
RESOURCES += main.qrc RESOURCES += main.qrc

View File

@ -0,0 +1,71 @@
#include "frmdevicebutton.h"
#include "ui_frmdevicebutton.h"
#include "devicebutton.h"
#include "qdebug.h"
frmDeviceButton::frmDeviceButton(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceButton)
{
ui->setupUi(this);
this->initForm();
}
frmDeviceButton::~frmDeviceButton()
{
delete ui;
}
void frmDeviceButton::initForm()
{
//设置背景地图
ui->labMap->setStyleSheet("border-image:url(:/image/bg_call.jpg);");
btn1 = new DeviceButton(ui->labMap);
btn1->setText("#1");
btn1->setGeometry(5, 5, 35, 35);
btn2 = new DeviceButton(ui->labMap);
btn2->setText("#2");
btn2->setGeometry(45, 5, 35, 35);
btn3 = new DeviceButton(ui->labMap);
btn3->setText("#3");
btn3->setGeometry(85, 5, 35, 35);
btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2;
foreach (QPushButton *btn, btnStyle) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle()));
}
btnColor << ui->btnGreen << ui->btnBlue << ui->btnRed << ui->btnGray << ui->btnBlack;
foreach (QPushButton *btn, btnColor) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeColor()));
}
}
void frmDeviceButton::changeStyle()
{
QPushButton *btn = (QPushButton *)sender();
int index = btnStyle.indexOf(btn);
DeviceButton::ButtonStyle style = (DeviceButton::ButtonStyle)index;
btn1->setButtonStyle(style);
btn2->setButtonStyle(style);
btn3->setButtonStyle(style);
}
void frmDeviceButton::changeColor()
{
QPushButton *btn = (QPushButton *)sender();
int index = btnColor.indexOf(btn);
DeviceButton::ButtonColor style = (DeviceButton::ButtonColor)index;
btn1->setButtonColor(style);
btn2->setButtonColor(style);
btn3->setButtonColor(style);
}
void frmDeviceButton::on_ckCanMove_stateChanged(int arg1)
{
bool canMove = (arg1 != 0);
btn1->setCanMove(canMove);
btn2->setCanMove(canMove);
btn3->setCanMove(canMove);
}

View File

@ -0,0 +1,36 @@
#ifndef FRMDEVICEBUTTON_H
#define FRMDEVICEBUTTON_H
#include <QWidget>
class DeviceButton;
class QPushButton;
namespace Ui {
class frmDeviceButton;
}
class frmDeviceButton : public QWidget
{
Q_OBJECT
public:
explicit frmDeviceButton(QWidget *parent = 0);
~frmDeviceButton();
private slots:
void initForm();
void changeStyle();
void changeColor();
void on_ckCanMove_stateChanged(int arg1);
private:
Ui::frmDeviceButton *ui;
DeviceButton *btn1;
DeviceButton *btn2;
DeviceButton *btn3;
QList<QPushButton *> btnStyle;
QList<QPushButton *> btnColor;
};
#endif // FRMDEVICEBUTTON_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>frmButtonDefence</class> <class>frmDeviceButton</class>
<widget class="QWidget" name="frmButtonDefence"> <widget class="QWidget" name="frmDeviceButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -95,37 +95,37 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnArming"> <widget class="QPushButton" name="btnGreen">
<property name="text"> <property name="text">
<string>布防</string> <string>绿色</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnDisarming"> <widget class="QPushButton" name="btnBlue">
<property name="text"> <property name="text">
<string>撤防</string> <string>蓝色</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnAlarm"> <widget class="QPushButton" name="btnRed">
<property name="text"> <property name="text">
<string>报警</string> <string>红色</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnBypass"> <widget class="QPushButton" name="btnGray">
<property name="text"> <property name="text">
<string>旁路</string> <string>灰色</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="btnError"> <widget class="QPushButton" name="btnBlack">
<property name="text"> <property name="text">
<string>故障</string> <string>黑色</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 203 KiB

View File

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 588 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 416 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 588 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 919 B

After

Width:  |  Height:  |  Size: 919 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 588 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 848 B

After

Width:  |  Height:  |  Size: 848 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 588 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 588 B

View File

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 534 B

View File

Before

Width:  |  Height:  |  Size: 953 B

After

Width:  |  Height:  |  Size: 953 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -1,6 +1,6 @@
#pragma execution_character_set("utf-8") #pragma execution_character_set("utf-8")
#include "frmbuttondefence.h" #include "frmdevicebutton.h"
#include <QApplication> #include <QApplication>
#include <QTextCodec> #include <QTextCodec>
@ -23,8 +23,8 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForLocale(codec); QTextCodec::setCodecForLocale(codec);
#endif #endif
frmButtonDefence w; frmDeviceButton w;
w.setWindowTitle("防区按钮控件"); w.setWindowTitle("设备按钮控件");
w.show(); w.show();
return a.exec(); return a.exec();

35
devicebutton/main.qrc Normal file
View File

@ -0,0 +1,35 @@
<RCC>
<qresource prefix="/">
<file>image/bg_call.jpg</file>
<file>image/devicebutton/devicebutton_black_bubble.png</file>
<file>image/devicebutton/devicebutton_black_bubble2.png</file>
<file>image/devicebutton/devicebutton_black_circle.png</file>
<file>image/devicebutton/devicebutton_black_msg.png</file>
<file>image/devicebutton/devicebutton_black_msg2.png</file>
<file>image/devicebutton/devicebutton_black_police.png</file>
<file>image/devicebutton/devicebutton_blue_bubble.png</file>
<file>image/devicebutton/devicebutton_blue_bubble2.png</file>
<file>image/devicebutton/devicebutton_blue_circle.png</file>
<file>image/devicebutton/devicebutton_blue_msg.png</file>
<file>image/devicebutton/devicebutton_blue_msg2.png</file>
<file>image/devicebutton/devicebutton_blue_police.png</file>
<file>image/devicebutton/devicebutton_gray_bubble.png</file>
<file>image/devicebutton/devicebutton_gray_bubble2.png</file>
<file>image/devicebutton/devicebutton_gray_circle.png</file>
<file>image/devicebutton/devicebutton_gray_msg.png</file>
<file>image/devicebutton/devicebutton_gray_msg2.png</file>
<file>image/devicebutton/devicebutton_gray_police.png</file>
<file>image/devicebutton/devicebutton_green_bubble.png</file>
<file>image/devicebutton/devicebutton_green_bubble2.png</file>
<file>image/devicebutton/devicebutton_green_circle.png</file>
<file>image/devicebutton/devicebutton_green_msg.png</file>
<file>image/devicebutton/devicebutton_green_msg2.png</file>
<file>image/devicebutton/devicebutton_green_police.png</file>
<file>image/devicebutton/devicebutton_red_bubble.png</file>
<file>image/devicebutton/devicebutton_red_bubble2.png</file>
<file>image/devicebutton/devicebutton_red_circle.png</file>
<file>image/devicebutton/devicebutton_red_msg.png</file>
<file>image/devicebutton/devicebutton_red_msg2.png</file>
<file>image/devicebutton/devicebutton_red_police.png</file>
</qresource>
</RCC>

File diff suppressed because one or more lines are too long