重新上传
BIN
0snap/miniblink.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
@@ -45,6 +45,7 @@
|
||||
| 38 | designer | QtDesigner4源码 |
|
||||
| 39 | netserver | 网络中转服务器 |
|
||||
| 40 | mpvdemo | 视频流播放mpv内核 |
|
||||
| 41 | miniblink | miniblink示例 |
|
||||
|
||||
### 二、学习群
|
||||
1. **Qt交流大会群 853086607(雨田哥)**
|
||||
@@ -92,4 +93,5 @@
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
@@ -13,6 +13,7 @@ Battery::Battery(QWidget *parent) : QWidget(parent)
|
||||
alarmValue = 30;
|
||||
step = 0.5;
|
||||
|
||||
borderWidth = 5;
|
||||
borderRadius = 8;
|
||||
bgRadius = 5;
|
||||
headRadius = 3;
|
||||
@@ -57,15 +58,15 @@ void Battery::drawBorder(QPainter *painter)
|
||||
{
|
||||
painter->save();
|
||||
|
||||
qreal headWidth = width() / 10;
|
||||
qreal batteryWidth = width() - headWidth;
|
||||
double headWidth = width() / 15;
|
||||
double batteryWidth = width() - headWidth;
|
||||
|
||||
//绘制电池边框
|
||||
QPointF topLeft(5, 5);
|
||||
QPointF bottomRight(batteryWidth, height() - 5);
|
||||
QPointF topLeft(borderWidth, borderWidth);
|
||||
QPointF bottomRight(batteryWidth, height() - borderWidth);
|
||||
batteryRect = QRectF(topLeft, bottomRight);
|
||||
|
||||
painter->setPen(QPen(borderColorStart, 5));
|
||||
painter->setPen(QPen(borderColorStart, borderWidth));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawRoundedRect(batteryRect, borderRadius, borderRadius);
|
||||
|
||||
@@ -74,6 +75,10 @@ void Battery::drawBorder(QPainter *painter)
|
||||
|
||||
void Battery::drawBg(QPainter *painter)
|
||||
{
|
||||
if (value == minValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
painter->save();
|
||||
|
||||
QLinearGradient batteryGradient(QPointF(0, 0), QPointF(0, height()));
|
||||
@@ -86,10 +91,10 @@ void Battery::drawBg(QPainter *painter)
|
||||
}
|
||||
|
||||
int margin = qMin(width(), height()) / 20;
|
||||
qreal unit = (batteryRect.width() - (margin * 2)) / 100;
|
||||
qreal width = currentValue * unit;
|
||||
double unit = (batteryRect.width() - (margin * 2)) / 100;
|
||||
double width = currentValue * unit;
|
||||
QPointF topLeft(batteryRect.topLeft().x() + margin, batteryRect.topLeft().y() + margin);
|
||||
QPointF bottomRight(width + margin + 5, batteryRect.bottomRight().y() - margin);
|
||||
QPointF bottomRight(width + margin + borderWidth, batteryRect.bottomRight().y() - margin);
|
||||
QRectF rect(topLeft, bottomRight);
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
@@ -122,13 +127,11 @@ void Battery::updateValue()
|
||||
{
|
||||
if (isForward) {
|
||||
currentValue -= step;
|
||||
|
||||
if (currentValue <= value) {
|
||||
timer->stop();
|
||||
}
|
||||
} else {
|
||||
currentValue += step;
|
||||
|
||||
if (currentValue >= value) {
|
||||
timer->stop();
|
||||
}
|
||||
@@ -137,31 +140,36 @@ void Battery::updateValue()
|
||||
this->update();
|
||||
}
|
||||
|
||||
qreal Battery::getMinValue() const
|
||||
double Battery::getMinValue() const
|
||||
{
|
||||
return this->minValue;
|
||||
}
|
||||
|
||||
qreal Battery::getMaxValue() const
|
||||
double Battery::getMaxValue() const
|
||||
{
|
||||
return this->maxValue;
|
||||
}
|
||||
|
||||
qreal Battery::getValue() const
|
||||
double Battery::getValue() const
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
|
||||
qreal Battery::getAlarmValue() const
|
||||
double Battery::getAlarmValue() const
|
||||
{
|
||||
return this->alarmValue;
|
||||
}
|
||||
|
||||
qreal Battery::getStep() const
|
||||
double Battery::getStep() const
|
||||
{
|
||||
return this->step;
|
||||
}
|
||||
|
||||
int Battery::getBorderWidth() const
|
||||
{
|
||||
return this->borderWidth;
|
||||
}
|
||||
|
||||
int Battery::getBorderRadius() const
|
||||
{
|
||||
return this->borderRadius;
|
||||
@@ -217,7 +225,7 @@ QSize Battery::minimumSizeHint() const
|
||||
return QSize(30, 10);
|
||||
}
|
||||
|
||||
void Battery::setRange(qreal minValue, qreal maxValue)
|
||||
void Battery::setRange(double minValue, double maxValue)
|
||||
{
|
||||
//如果最小值大于或者等于最大值则不设置
|
||||
if (minValue >= maxValue) {
|
||||
@@ -240,20 +248,20 @@ void Battery::setRange(qreal minValue, qreal maxValue)
|
||||
|
||||
void Battery::setRange(int minValue, int maxValue)
|
||||
{
|
||||
setRange((qreal)minValue, (qreal)maxValue);
|
||||
setRange((double)minValue, (double)maxValue);
|
||||
}
|
||||
|
||||
void Battery::setMinValue(qreal minValue)
|
||||
void Battery::setMinValue(double minValue)
|
||||
{
|
||||
setRange(minValue, maxValue);
|
||||
}
|
||||
|
||||
void Battery::setMaxValue(qreal maxValue)
|
||||
void Battery::setMaxValue(double maxValue)
|
||||
{
|
||||
setRange(minValue, maxValue);
|
||||
}
|
||||
|
||||
void Battery::setValue(qreal value)
|
||||
void Battery::setValue(double value)
|
||||
{
|
||||
//值和当前值一致则无需处理
|
||||
if (value == this->value) {
|
||||
@@ -272,21 +280,24 @@ void Battery::setValue(qreal value)
|
||||
} else if (value < currentValue) {
|
||||
isForward = true;
|
||||
} else {
|
||||
this->value = value;
|
||||
this->update();
|
||||
return;
|
||||
}
|
||||
|
||||
this->value = value;
|
||||
this->update();
|
||||
emit valueChanged(value);
|
||||
timer->stop();
|
||||
timer->start();
|
||||
}
|
||||
|
||||
void Battery::setValue(int value)
|
||||
{
|
||||
setValue((qreal)value);
|
||||
setValue((double)value);
|
||||
}
|
||||
|
||||
void Battery::setAlarmValue(qreal alarmValue)
|
||||
void Battery::setAlarmValue(double alarmValue)
|
||||
{
|
||||
if (this->alarmValue != alarmValue) {
|
||||
this->alarmValue = alarmValue;
|
||||
@@ -296,10 +307,10 @@ void Battery::setAlarmValue(qreal alarmValue)
|
||||
|
||||
void Battery::setAlarmValue(int alarmValue)
|
||||
{
|
||||
setAlarmValue((qreal)alarmValue);
|
||||
setAlarmValue((double)alarmValue);
|
||||
}
|
||||
|
||||
void Battery::setStep(qreal step)
|
||||
void Battery::setStep(double step)
|
||||
{
|
||||
if (this->step != step) {
|
||||
this->step = step;
|
||||
@@ -309,7 +320,15 @@ void Battery::setStep(qreal step)
|
||||
|
||||
void Battery::setStep(int step)
|
||||
{
|
||||
setStep((qreal)step);
|
||||
setStep((double)step);
|
||||
}
|
||||
|
||||
void Battery::setBorderWidth(int borderWidth)
|
||||
{
|
||||
if (this->borderWidth != borderWidth) {
|
||||
this->borderWidth = borderWidth;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void Battery::setBorderRadius(int borderRadius)
|
||||
|
||||
@@ -14,25 +14,20 @@
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT Battery : public QWidget
|
||||
class Q_DECL_EXPORT Battery : public QWidget
|
||||
#else
|
||||
class Battery : public QWidget
|
||||
#endif
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(qreal minValue READ getMinValue WRITE setMinValue)
|
||||
Q_PROPERTY(qreal maxValue READ getMaxValue WRITE setMaxValue)
|
||||
Q_PROPERTY(qreal value READ getValue WRITE setValue)
|
||||
Q_PROPERTY(qreal alarmValue READ getAlarmValue WRITE setAlarmValue)
|
||||
Q_PROPERTY(double minValue READ getMinValue WRITE setMinValue)
|
||||
Q_PROPERTY(double maxValue READ getMaxValue WRITE setMaxValue)
|
||||
Q_PROPERTY(double value READ getValue WRITE setValue)
|
||||
Q_PROPERTY(double alarmValue READ getAlarmValue WRITE setAlarmValue)
|
||||
|
||||
Q_PROPERTY(qreal step READ getStep WRITE setStep)
|
||||
Q_PROPERTY(double step READ getStep WRITE setStep)
|
||||
Q_PROPERTY(int borderWidth READ getBorderWidth WRITE setBorderWidth)
|
||||
Q_PROPERTY(int borderRadius READ getBorderRadius WRITE setBorderRadius)
|
||||
Q_PROPERTY(int bgRadius READ getBgRadius WRITE setBgRadius)
|
||||
Q_PROPERTY(int headRadius READ getHeadRadius WRITE setHeadRadius)
|
||||
@@ -60,74 +55,78 @@ private slots:
|
||||
void updateValue();
|
||||
|
||||
private:
|
||||
qreal minValue; //最小值
|
||||
qreal maxValue; //最大值
|
||||
qreal value; //目标电量
|
||||
qreal alarmValue; //电池电量警戒值
|
||||
double minValue; //最小值
|
||||
double maxValue; //最大值
|
||||
double value; //目标电量
|
||||
double alarmValue; //电池电量警戒值
|
||||
|
||||
qreal step; //每次移动的步长
|
||||
int borderRadius; //边框圆角角度
|
||||
int bgRadius; //背景进度圆角角度
|
||||
int headRadius; //头部圆角角度
|
||||
double step; //每次移动的步长
|
||||
int borderWidth; //边框粗细
|
||||
int borderRadius; //边框圆角角度
|
||||
int bgRadius; //背景进度圆角角度
|
||||
int headRadius; //头部圆角角度
|
||||
|
||||
QColor borderColorStart; //边框渐变开始颜色
|
||||
QColor borderColorEnd; //边框渐变结束颜色
|
||||
QColor borderColorStart; //边框渐变开始颜色
|
||||
QColor borderColorEnd; //边框渐变结束颜色
|
||||
|
||||
QColor alarmColorStart; //电池低电量时的渐变开始颜色
|
||||
QColor alarmColorEnd; //电池低电量时的渐变结束颜色
|
||||
QColor alarmColorStart; //电池低电量时的渐变开始颜色
|
||||
QColor alarmColorEnd; //电池低电量时的渐变结束颜色
|
||||
|
||||
QColor normalColorStart; //电池正常电量时的渐变开始颜色
|
||||
QColor normalColorEnd; //电池正常电量时的渐变结束颜色
|
||||
QColor normalColorStart; //电池正常电量时的渐变开始颜色
|
||||
QColor normalColorEnd; //电池正常电量时的渐变结束颜色
|
||||
|
||||
bool isForward; //是否往前移
|
||||
qreal currentValue; //当前电量
|
||||
QRectF batteryRect; //电池主体区域
|
||||
QTimer *timer; //绘制定时器
|
||||
bool isForward; //是否往前移
|
||||
double currentValue; //当前电量
|
||||
QRectF batteryRect; //电池主体区域
|
||||
QTimer *timer; //绘制定时器
|
||||
|
||||
public:
|
||||
qreal getMinValue() const;
|
||||
qreal getMaxValue() const;
|
||||
qreal getValue() const;
|
||||
qreal getAlarmValue() const;
|
||||
double getMinValue() const;
|
||||
double getMaxValue() const;
|
||||
double getValue() const;
|
||||
double getAlarmValue() const;
|
||||
|
||||
qreal getStep() const;
|
||||
int getBorderRadius() const;
|
||||
int getBgRadius() const;
|
||||
int getHeadRadius() const;
|
||||
double getStep() const;
|
||||
int getBorderWidth() const;
|
||||
int getBorderRadius() const;
|
||||
int getBgRadius() const;
|
||||
int getHeadRadius() const;
|
||||
|
||||
QColor getBorderColorStart()const;
|
||||
QColor getBorderColorEnd() const;
|
||||
QColor getBorderColorStart() const;
|
||||
QColor getBorderColorEnd() const;
|
||||
|
||||
QColor getAlarmColorStart() const;
|
||||
QColor getAlarmColorEnd() const;
|
||||
QColor getAlarmColorStart() const;
|
||||
QColor getAlarmColorEnd() const;
|
||||
|
||||
QColor getNormalColorStart()const;
|
||||
QColor getNormalColorEnd() const;
|
||||
QColor getNormalColorStart() const;
|
||||
QColor getNormalColorEnd() const;
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
//设置范围值
|
||||
void setRange(qreal minValue, qreal maxValue);
|
||||
void setRange(double minValue, double maxValue);
|
||||
void setRange(int minValue, int maxValue);
|
||||
|
||||
//设置最大最小值
|
||||
void setMinValue(qreal minValue);
|
||||
void setMaxValue(qreal maxValue);
|
||||
void setMinValue(double minValue);
|
||||
void setMaxValue(double maxValue);
|
||||
|
||||
//设置电池电量值
|
||||
void setValue(qreal value);
|
||||
void setValue(double value);
|
||||
void setValue(int value);
|
||||
|
||||
//设置电池电量警戒值
|
||||
void setAlarmValue(qreal alarmValue);
|
||||
void setAlarmValue(double alarmValue);
|
||||
void setAlarmValue(int alarmValue);
|
||||
|
||||
//设置步长
|
||||
void setStep(qreal step);
|
||||
void setStep(double step);
|
||||
void setStep(int step);
|
||||
|
||||
//设置边框粗细
|
||||
void setBorderWidth(int borderWidth);
|
||||
//设置边框圆角角度
|
||||
void setBorderRadius(int borderRadius);
|
||||
//设置背景圆角角度
|
||||
@@ -148,7 +147,7 @@ public Q_SLOTS:
|
||||
void setNormalColorEnd(const QColor &normalColorEnd);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(qreal value);
|
||||
void valueChanged(double value);
|
||||
};
|
||||
|
||||
#endif // BATTERY_H
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "ui_widget.h"
|
||||
#include "qevent.h"
|
||||
#include "qdebug.h"
|
||||
#include <QTimer>
|
||||
#include<QWheelEvent>
|
||||
|
||||
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -24,7 +23,6 @@ bool Widget::eventFilter(QObject *watched, QEvent *evt)
|
||||
static int index = 1;
|
||||
static QPoint mousePoint;
|
||||
static bool mousePressed = false;
|
||||
static bool is_smooth_scrolling = false;
|
||||
|
||||
QMouseEvent *event = static_cast<QMouseEvent *>(evt);
|
||||
if (event->type() == QEvent::MouseButtonPress) {
|
||||
@@ -54,29 +52,5 @@ bool Widget::eventFilter(QObject *watched, QEvent *evt)
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::Wheel) {
|
||||
QWheelEvent *event = static_cast<QWheelEvent *>(evt);
|
||||
if(is_smooth_scrolling == false) {
|
||||
if (event->delta() > 0) {
|
||||
is_smooth_scrolling = true;
|
||||
if (index == 5) {
|
||||
index = 1;
|
||||
} else {
|
||||
index++;
|
||||
}
|
||||
} else if (event->delta() < 0) {
|
||||
is_smooth_scrolling = true;
|
||||
if (index != 1) {
|
||||
index--;
|
||||
} else {
|
||||
index =5;
|
||||
}
|
||||
}
|
||||
ui->widget->setStyleSheet(QString("background-image:url(:/image/%1.png);").arg(index));
|
||||
QTimer::singleShot(400, [&]() { is_smooth_scrolling = false; });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void ButtonDefence::setButtonStyle(const ButtonDefence::ButtonStyle &buttonStyle
|
||||
} else if (buttonStyle == ButtonStyle_Msg2) {
|
||||
type = "msg2";
|
||||
} else {
|
||||
type = "custom";
|
||||
type = "circle";
|
||||
}
|
||||
|
||||
setButtonStatus(buttonStatus);
|
||||
|
||||
@@ -14,13 +14,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT ButtonDefence : public QWidget
|
||||
class Q_DECL_EXPORT ButtonDefence : public QWidget
|
||||
#else
|
||||
class ButtonDefence : public QWidget
|
||||
#endif
|
||||
@@ -37,16 +31,14 @@ class ButtonDefence : public QWidget
|
||||
Q_PROPERTY(ButtonStatus buttonStatus READ getButtonStatus WRITE setButtonStatus)
|
||||
|
||||
public:
|
||||
//防区样式 圆形、警察、气泡、气泡2、消息、消息2、自定义
|
||||
//如果设置的自定义的,则图片拓展名 btn_defence_alarm_custom
|
||||
//防区样式 圆形、警察、气泡、气泡2、消息、消息2
|
||||
enum ButtonStyle {
|
||||
ButtonStyle_Circle = 0,
|
||||
ButtonStyle_Police = 1,
|
||||
ButtonStyle_Bubble = 2,
|
||||
ButtonStyle_Bubble2 = 3,
|
||||
ButtonStyle_Msg = 4,
|
||||
ButtonStyle_Msg2 = 5,
|
||||
ButtonStyle_Custom = 6
|
||||
ButtonStyle_Msg2 = 5
|
||||
};
|
||||
|
||||
//防区状态 布防、撤防、报警、旁路、故障
|
||||
|
||||
@@ -31,7 +31,7 @@ void frmButtonDefence::initForm()
|
||||
btn3->setText("#3");
|
||||
btn3->setGeometry(85, 5, 35, 35);
|
||||
|
||||
btnStyle << ui->btnCircle << ui->btnPolice << ui->btnBubble << ui->btnBubble2 << ui->btnMsg << ui->btnMsg2 << ui->btnCustom;
|
||||
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()));
|
||||
}
|
||||
@@ -50,16 +50,6 @@ void frmButtonDefence::changeStyle()
|
||||
btn1->setButtonStyle(style);
|
||||
btn2->setButtonStyle(style);
|
||||
btn3->setButtonStyle(style);
|
||||
|
||||
if (index == 6) {
|
||||
btn1->setText("");
|
||||
btn2->setText("");
|
||||
btn3->setText("");
|
||||
} else {
|
||||
btn1->setText("#1");
|
||||
btn2->setText("#2");
|
||||
btn3->setText("#3");
|
||||
}
|
||||
}
|
||||
|
||||
void frmButtonDefence::changeStatus()
|
||||
@@ -79,10 +69,3 @@ void frmButtonDefence::on_ckCanMove_stateChanged(int arg1)
|
||||
btn2->setCanMove(canMove);
|
||||
btn3->setCanMove(canMove);
|
||||
}
|
||||
|
||||
void frmButtonDefence::on_btnPoint_clicked()
|
||||
{
|
||||
qDebug() << "btn1" << "x" << btn1->geometry().x() << "y" << btn1->geometry().y();
|
||||
qDebug() << "btn2" << "x" << btn2->geometry().x() << "y" << btn2->geometry().y();
|
||||
qDebug() << "btn3" << "x" << btn3->geometry().x() << "y" << btn3->geometry().y();
|
||||
}
|
||||
|
||||
@@ -25,8 +25,6 @@ private slots:
|
||||
void changeStatus();
|
||||
void on_ckCanMove_stateChanged(int arg1);
|
||||
|
||||
void on_btnPoint_clicked();
|
||||
|
||||
private:
|
||||
Ui::frmButtonDefence *ui;
|
||||
ButtonDefence *btn1;
|
||||
|
||||
@@ -87,13 +87,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCustom">
|
||||
<property name="text">
|
||||
<string>自定义</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
@@ -136,13 +129,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ckCanMove">
|
||||
<property name="text">
|
||||
@@ -150,13 +136,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnPoint">
|
||||
<property name="text">
|
||||
<string>坐标</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -176,21 +155,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
<tabstop>btnCircle</tabstop>
|
||||
<tabstop>btnPolice</tabstop>
|
||||
<tabstop>btnBubble</tabstop>
|
||||
<tabstop>btnBubble2</tabstop>
|
||||
<tabstop>btnMsg</tabstop>
|
||||
<tabstop>btnMsg2</tabstop>
|
||||
<tabstop>btnCustom</tabstop>
|
||||
<tabstop>btnArming</tabstop>
|
||||
<tabstop>btnDisarming</tabstop>
|
||||
<tabstop>btnAlarm</tabstop>
|
||||
<tabstop>btnBypass</tabstop>
|
||||
<tabstop>btnError</tabstop>
|
||||
<tabstop>ckCanMove</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -31,10 +31,5 @@
|
||||
<file>image/btn_defence_error_msg2.png</file>
|
||||
<file>image/btn_defence_error_police.png</file>
|
||||
<file>image/bg_call.jpg</file>
|
||||
<file>image/btn_defence_alarm_custom.png</file>
|
||||
<file>image/btn_defence_arming_custom.png</file>
|
||||
<file>image/btn_defence_bypass_custom.png</file>
|
||||
<file>image/btn_defence_disarming_custom.png</file>
|
||||
<file>image/btn_defence_error_custom.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -105,7 +105,7 @@ ColorWidget::ColorWidget(QWidget *parent) : QWidget(parent)
|
||||
}
|
||||
|
||||
ColorWidget::~ColorWidget()
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
void ColorWidget::mousePressEvent(QMouseEvent *e)
|
||||
@@ -128,10 +128,7 @@ void ColorWidget::showColorValue()
|
||||
|
||||
int x = QCursor::pos().x();
|
||||
int y = QCursor::pos().y();
|
||||
|
||||
txtPoint->setText(tr("x:%1 y:%2").arg(x).arg(y));
|
||||
QString strDecimalValue, strHex, strTextColor;
|
||||
int red, green, blue;
|
||||
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
||||
QPixmap pixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), x, y, 2, 2);
|
||||
@@ -140,9 +137,10 @@ void ColorWidget::showColorValue()
|
||||
QPixmap pixmap = screen->grabWindow(QApplication::desktop()->winId(), x, y, 2, 2);
|
||||
#endif
|
||||
|
||||
int red, green, blue;
|
||||
QString strDecimalValue, strHex;
|
||||
if (!pixmap.isNull()) {
|
||||
QImage image = pixmap.toImage();
|
||||
|
||||
if (!image.isNull()) {
|
||||
if (image.valid(0, 0)) {
|
||||
QColor color = image.pixel(0, 0);
|
||||
@@ -159,13 +157,12 @@ void ColorWidget::showColorValue()
|
||||
}
|
||||
}
|
||||
|
||||
if (red > 200 && green > 200 && blue > 200) {
|
||||
strTextColor = "10, 10, 10";
|
||||
} else {
|
||||
strTextColor = "255, 255, 255";
|
||||
}
|
||||
//根据背景色自动计算合适的前景色
|
||||
QColor color(red, green, blue);
|
||||
double gray = (0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255;
|
||||
QColor textColor = gray > 0.5 ? Qt::black : Qt::white;
|
||||
|
||||
QString str = tr("background-color: rgb(%1);color: rgb(%2)").arg(strDecimalValue).arg(strTextColor);
|
||||
QString str = tr("background:rgb(%1);color:%2").arg(strDecimalValue).arg(textColor.name());
|
||||
labColor->setStyleSheet(str);
|
||||
txtRgb->setText(strDecimalValue);
|
||||
txtWeb->setText(strHex);
|
||||
|
||||
@@ -9,13 +9,7 @@ class QLabel;
|
||||
class QLineEdit;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT ColorWidget : public QWidget
|
||||
class Q_DECL_EXPORT ColorWidget : public QWidget
|
||||
#else
|
||||
class ColorWidget : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -528,6 +528,11 @@ QUIMessageBox::~QUIMessageBox()
|
||||
delete widgetMain;
|
||||
}
|
||||
|
||||
void QUIMessageBox::showEvent(QShowEvent *)
|
||||
{
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
void QUIMessageBox::closeEvent(QCloseEvent *)
|
||||
{
|
||||
closeSec = 0;
|
||||
@@ -567,6 +572,7 @@ void QUIMessageBox::initControl()
|
||||
verticalLayout1->setSpacing(0);
|
||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -574,10 +580,12 @@ void QUIMessageBox::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout3 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout3->setSpacing(0);
|
||||
horizontalLayout3->setObjectName(QString::fromUtf8("horizontalLayout3"));
|
||||
horizontalLayout3->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
@@ -586,34 +594,33 @@ void QUIMessageBox::initControl()
|
||||
sizePolicy1.setHeightForWidth(labIco->sizePolicy().hasHeightForWidth());
|
||||
labIco->setSizePolicy(sizePolicy1);
|
||||
labIco->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout3->addWidget(labIco);
|
||||
|
||||
labTitle = new QLabel(widgetTitle);
|
||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
horizontalLayout3->addWidget(labTitle);
|
||||
|
||||
labTime = new QLabel(widgetTitle);
|
||||
labTime->setObjectName(QString::fromUtf8("labTime"));
|
||||
labCountDown = new QLabel(widgetTitle);
|
||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy2.setHorizontalStretch(0);
|
||||
sizePolicy2.setVerticalStretch(0);
|
||||
sizePolicy2.setHeightForWidth(labTime->sizePolicy().hasHeightForWidth());
|
||||
labTime->setSizePolicy(sizePolicy2);
|
||||
labTime->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout3->addWidget(labTime);
|
||||
sizePolicy2.setHeightForWidth(labCountDown->sizePolicy().hasHeightForWidth());
|
||||
labCountDown->setSizePolicy(sizePolicy2);
|
||||
labCountDown->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout3->addWidget(labCountDown);
|
||||
|
||||
widgetMenu = new QWidget(widgetTitle);
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy1);
|
||||
|
||||
horizontalLayout4 = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout4->setSpacing(0);
|
||||
horizontalLayout4->setObjectName(QString::fromUtf8("horizontalLayout4"));
|
||||
horizontalLayout4->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -631,22 +638,27 @@ void QUIMessageBox::initControl()
|
||||
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setSpacing(5);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
frame = new QFrame(widgetMain);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
verticalLayout4 = new QVBoxLayout(frame);
|
||||
verticalLayout4->setObjectName(QString::fromUtf8("verticalLayout4"));
|
||||
verticalLayout4->setContentsMargins(-1, 9, -1, -1);
|
||||
horizontalLayout1 = new QHBoxLayout();
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
|
||||
labIcoMain = new QLabel(frame);
|
||||
labIcoMain->setObjectName(QString::fromUtf8("labIcoMain"));
|
||||
labIcoMain->setAlignment(Qt::AlignCenter);
|
||||
|
||||
verticalLayout4 = new QVBoxLayout(frame);
|
||||
verticalLayout4->setObjectName(QString::fromUtf8("verticalLayout4"));
|
||||
verticalLayout4->setContentsMargins(-1, 9, -1, -1);
|
||||
|
||||
horizontalLayout1 = new QHBoxLayout();
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
horizontalLayout1->addWidget(labIcoMain);
|
||||
horizontalSpacer1 = new QSpacerItem(5, 0, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
horizontalLayout1->addItem(horizontalSpacer1);
|
||||
@@ -673,14 +685,13 @@ void QUIMessageBox::initControl()
|
||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
||||
btnOk->setMinimumSize(QSize(85, 0));
|
||||
btnOk->setFocusPolicy(Qt::StrongFocus);
|
||||
btnOk->setIcon(QIcon(":/image/btn_ok.png"));
|
||||
horizontalLayout2->addWidget(btnOk);
|
||||
btnOk->setDefault(true);
|
||||
|
||||
btnCancel = new QPushButton(frame);
|
||||
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
|
||||
btnCancel->setMinimumSize(QSize(85, 0));
|
||||
btnCancel->setFocusPolicy(Qt::StrongFocus);
|
||||
btnCancel->setIcon(QIcon(":/image/btn_close.png"));
|
||||
horizontalLayout2->addWidget(btnCancel);
|
||||
|
||||
verticalLayout4->addLayout(horizontalLayout2);
|
||||
@@ -693,6 +704,8 @@ void QUIMessageBox::initControl()
|
||||
|
||||
btnOk->setText("确定");
|
||||
btnCancel->setText("取消");
|
||||
QUIHelper::setIconBtn(btnOk, ":/image/btn_ok.png", 0xf00c);
|
||||
QUIHelper::setIconBtn(btnCancel, ":/image/btn_close.png", 0xf00d);
|
||||
|
||||
connect(btnOk, SIGNAL(clicked()), this, SLOT(on_btnOk_clicked()));
|
||||
connect(btnCancel, SIGNAL(clicked()), this, SLOT(on_btnMenu_Close_clicked()));
|
||||
@@ -746,7 +759,7 @@ void QUIMessageBox::checkSec()
|
||||
}
|
||||
|
||||
QString str = QString("关闭倒计时 %1 s").arg(closeSec - currentSec + 1);
|
||||
this->labTime->setText(str);
|
||||
this->labCountDown->setText(str);
|
||||
}
|
||||
|
||||
void QUIMessageBox::on_btnOk_clicked()
|
||||
@@ -766,40 +779,33 @@ void QUIMessageBox::setIconMain(const QChar &str, quint32 size)
|
||||
IconHelper::Instance()->setIcon(this->labIco, str, size);
|
||||
}
|
||||
|
||||
void QUIMessageBox::setIconMsg(const QString &png, const QChar &str)
|
||||
{
|
||||
//图片存在则取图片,不存在则取图形字体
|
||||
int size = this->labIcoMain->size().height();
|
||||
if (QImage(png).isNull()) {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, str, size);
|
||||
} else {
|
||||
this->labIcoMain->setStyleSheet(QString("border-image:url(%1);").arg(png));
|
||||
}
|
||||
}
|
||||
|
||||
void QUIMessageBox::setMessage(const QString &msg, int type, int closeSec)
|
||||
{
|
||||
this->closeSec = closeSec;
|
||||
this->currentSec = 0;
|
||||
this->labTime->clear();
|
||||
this->labCountDown->clear();
|
||||
checkSec();
|
||||
|
||||
//图片存在则取图片,不存在则取图形字体
|
||||
int size = this->labIcoMain->size().height();
|
||||
bool exist = !QImage(":/image/msg_info.png").isNull();
|
||||
if (type == 0) {
|
||||
if (exist) {
|
||||
this->labIcoMain->setStyleSheet("border-image: url(:/image/msg_info.png);");
|
||||
} else {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, 0xf05a, size);
|
||||
}
|
||||
|
||||
setIconMsg(":/image/msg_info.png", 0xf05a);
|
||||
this->btnCancel->setVisible(false);
|
||||
this->labTitle->setText("提示");
|
||||
} else if (type == 1) {
|
||||
if (exist) {
|
||||
this->labIcoMain->setStyleSheet("border-image: url(:/image/msg_question.png);");
|
||||
} else {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, 0xf059, size);
|
||||
}
|
||||
|
||||
setIconMsg(":/image/msg_question.png", 0xf059);
|
||||
this->labTitle->setText("询问");
|
||||
} else if (type == 2) {
|
||||
if (exist) {
|
||||
this->labIcoMain->setStyleSheet("border-image: url(:/image/msg_error.png);");
|
||||
} else {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, 0xf057, size);
|
||||
}
|
||||
|
||||
setIconMsg(":/image/msg_error.png", 0xf057);
|
||||
this->btnCancel->setVisible(false);
|
||||
this->labTitle->setText("错误");
|
||||
}
|
||||
@@ -841,6 +847,11 @@ QUITipBox::~QUITipBox()
|
||||
delete widgetMain;
|
||||
}
|
||||
|
||||
void QUITipBox::showEvent(QShowEvent *)
|
||||
{
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
void QUITipBox::closeEvent(QCloseEvent *)
|
||||
{
|
||||
closeSec = 0;
|
||||
@@ -880,6 +891,7 @@ void QUITipBox::initControl()
|
||||
verticalLayout->setSpacing(0);
|
||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -887,10 +899,12 @@ void QUITipBox::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout2 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout2->setSpacing(0);
|
||||
horizontalLayout2->setObjectName(QString::fromUtf8("horizontalLayout2"));
|
||||
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
labIco->setAlignment(Qt::AlignCenter);
|
||||
@@ -901,15 +915,15 @@ void QUITipBox::initControl()
|
||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
horizontalLayout2->addWidget(labTitle);
|
||||
|
||||
labTime = new QLabel(widgetTitle);
|
||||
labTime->setObjectName(QString::fromUtf8("labTime"));
|
||||
labCountDown = new QLabel(widgetTitle);
|
||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(labTime->sizePolicy().hasHeightForWidth());
|
||||
labTime->setSizePolicy(sizePolicy1);
|
||||
labTime->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout2->addWidget(labTime);
|
||||
sizePolicy1.setHeightForWidth(labCountDown->sizePolicy().hasHeightForWidth());
|
||||
labCountDown->setSizePolicy(sizePolicy1);
|
||||
labCountDown->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout2->addWidget(labCountDown);
|
||||
|
||||
widgetMenu = new QWidget(widgetTitle);
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
@@ -918,10 +932,12 @@ void QUITipBox::initControl()
|
||||
sizePolicy2.setVerticalStretch(0);
|
||||
sizePolicy2.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy2);
|
||||
|
||||
horizontalLayout = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout->setSpacing(0);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -940,11 +956,14 @@ void QUITipBox::initControl()
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
widgetMain->setAutoFillBackground(true);
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
|
||||
labInfo = new QLabel(widgetMain);
|
||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
||||
labInfo->setScaledContents(true);
|
||||
labInfo->setWordWrap(true);
|
||||
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
verticalLayout2->addWidget(labInfo);
|
||||
verticalLayout->addWidget(widgetMain);
|
||||
|
||||
@@ -997,7 +1016,7 @@ void QUITipBox::checkSec()
|
||||
}
|
||||
|
||||
QString str = QString("关闭倒计时 %1 s").arg(closeSec - currentSec + 1);
|
||||
this->labTime->setText(str);
|
||||
this->labCountDown->setText(str);
|
||||
}
|
||||
|
||||
void QUITipBox::on_btnMenu_Close_clicked()
|
||||
@@ -1015,7 +1034,7 @@ void QUITipBox::setTip(const QString &title, const QString &tip, bool fullScreen
|
||||
{
|
||||
this->closeSec = closeSec;
|
||||
this->currentSec = 0;
|
||||
this->labTime->clear();
|
||||
this->labCountDown->clear();
|
||||
checkSec();
|
||||
|
||||
this->fullScreen = fullScreen;
|
||||
@@ -1096,6 +1115,7 @@ void QUIInputBox::initControl()
|
||||
verticalLayout1->setSpacing(0);
|
||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -1103,10 +1123,12 @@ void QUIInputBox::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout1 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout1->setSpacing(0);
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
@@ -1115,34 +1137,33 @@ void QUIInputBox::initControl()
|
||||
sizePolicy1.setHeightForWidth(labIco->sizePolicy().hasHeightForWidth());
|
||||
labIco->setSizePolicy(sizePolicy1);
|
||||
labIco->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout1->addWidget(labIco);
|
||||
|
||||
labTitle = new QLabel(widgetTitle);
|
||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
horizontalLayout1->addWidget(labTitle);
|
||||
|
||||
labTime = new QLabel(widgetTitle);
|
||||
labTime->setObjectName(QString::fromUtf8("labTime"));
|
||||
labCountDown = new QLabel(widgetTitle);
|
||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy2.setHorizontalStretch(0);
|
||||
sizePolicy2.setVerticalStretch(0);
|
||||
sizePolicy2.setHeightForWidth(labTime->sizePolicy().hasHeightForWidth());
|
||||
labTime->setSizePolicy(sizePolicy2);
|
||||
labTime->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout1->addWidget(labTime);
|
||||
sizePolicy2.setHeightForWidth(labCountDown->sizePolicy().hasHeightForWidth());
|
||||
labCountDown->setSizePolicy(sizePolicy2);
|
||||
labCountDown->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout1->addWidget(labCountDown);
|
||||
|
||||
widgetMenu = new QWidget(widgetTitle);
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy1);
|
||||
|
||||
horizontalLayout2 = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout2->setSpacing(0);
|
||||
horizontalLayout2->setObjectName(QString::fromUtf8("horizontalLayout2"));
|
||||
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -1160,20 +1181,24 @@ void QUIInputBox::initControl()
|
||||
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setSpacing(5);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
frame = new QFrame(widgetMain);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
verticalLayout3 = new QVBoxLayout(frame);
|
||||
verticalLayout3->setObjectName(QString::fromUtf8("verticalLayout3"));
|
||||
|
||||
labInfo = new QLabel(frame);
|
||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
||||
labInfo->setScaledContents(false);
|
||||
labInfo->setWordWrap(true);
|
||||
|
||||
verticalLayout3 = new QVBoxLayout(frame);
|
||||
verticalLayout3->setObjectName(QString::fromUtf8("verticalLayout3"));
|
||||
verticalLayout3->addWidget(labInfo);
|
||||
|
||||
txtValue = new QLineEdit(frame);
|
||||
@@ -1192,13 +1217,12 @@ void QUIInputBox::initControl()
|
||||
btnOk = new QPushButton(frame);
|
||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
||||
btnOk->setMinimumSize(QSize(85, 0));
|
||||
btnOk->setIcon(QIcon(":/image/btn_ok.png"));
|
||||
lay->addWidget(btnOk);
|
||||
btnOk->setDefault(true);
|
||||
|
||||
btnCancel = new QPushButton(frame);
|
||||
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
|
||||
btnCancel->setMinimumSize(QSize(85, 0));
|
||||
btnCancel->setIcon(QIcon(":/image/btn_close.png"));
|
||||
lay->addWidget(btnCancel);
|
||||
|
||||
verticalLayout3->addLayout(lay);
|
||||
@@ -1211,6 +1235,8 @@ void QUIInputBox::initControl()
|
||||
labTitle->setText("输入框");
|
||||
btnOk->setText("确定");
|
||||
btnCancel->setText("取消");
|
||||
QUIHelper::setIconBtn(btnOk, ":/image/btn_ok.png", 0xf00c);
|
||||
QUIHelper::setIconBtn(btnCancel, ":/image/btn_close.png", 0xf00d);
|
||||
|
||||
connect(btnOk, SIGNAL(clicked()), this, SLOT(on_btnOk_clicked()));
|
||||
connect(btnCancel, SIGNAL(clicked()), this, SLOT(on_btnMenu_Close_clicked()));
|
||||
@@ -1264,7 +1290,7 @@ void QUIInputBox::checkSec()
|
||||
}
|
||||
|
||||
QString str = QString("关闭倒计时 %1 s").arg(closeSec - currentSec + 1);
|
||||
this->labTime->setText(str);
|
||||
this->labCountDown->setText(str);
|
||||
}
|
||||
|
||||
void QUIInputBox::setParameter(const QString &title, int type, int closeSec,
|
||||
@@ -1273,7 +1299,7 @@ void QUIInputBox::setParameter(const QString &title, int type, int closeSec,
|
||||
{
|
||||
this->closeSec = closeSec;
|
||||
this->currentSec = 0;
|
||||
this->labTime->clear();
|
||||
this->labCountDown->clear();
|
||||
this->labInfo->setText(title);
|
||||
checkSec();
|
||||
|
||||
@@ -1377,6 +1403,11 @@ QUIDateSelect::~QUIDateSelect()
|
||||
delete widgetMain;
|
||||
}
|
||||
|
||||
void QUIDateSelect::showEvent(QShowEvent *)
|
||||
{
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
bool QUIDateSelect::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
static QPoint mousePoint;
|
||||
@@ -1410,6 +1441,7 @@ void QUIDateSelect::initControl()
|
||||
verticalLayout->setSpacing(0);
|
||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -1417,10 +1449,12 @@ void QUIDateSelect::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout1 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout1->setSpacing(0);
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
@@ -1445,10 +1479,12 @@ void QUIDateSelect::initControl()
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy1);
|
||||
|
||||
horizontalLayout = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout->setSpacing(0);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -1466,14 +1502,17 @@ void QUIDateSelect::initControl()
|
||||
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
|
||||
verticalLayout1 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout1->setSpacing(6);
|
||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||
verticalLayout1->setContentsMargins(6, 6, 6, 6);
|
||||
|
||||
frame = new QFrame(widgetMain);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
gridLayout = new QGridLayout(frame);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
labStart = new QLabel(frame);
|
||||
@@ -1486,8 +1525,8 @@ void QUIDateSelect::initControl()
|
||||
btnOk->setMinimumSize(QSize(85, 0));
|
||||
btnOk->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
btnOk->setFocusPolicy(Qt::StrongFocus);
|
||||
btnOk->setIcon(QIcon(":/image/btn_ok.png"));
|
||||
gridLayout->addWidget(btnOk, 0, 2, 1, 1);
|
||||
btnOk->setDefault(true);
|
||||
|
||||
labEnd = new QLabel(frame);
|
||||
labEnd->setObjectName(QString::fromUtf8("labEnd"));
|
||||
@@ -1499,7 +1538,6 @@ void QUIDateSelect::initControl()
|
||||
btnClose->setMinimumSize(QSize(85, 0));
|
||||
btnClose->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
btnClose->setFocusPolicy(Qt::StrongFocus);
|
||||
btnClose->setIcon(QIcon(":/image/btn_close.png"));
|
||||
gridLayout->addWidget(btnClose, 1, 2, 1, 1);
|
||||
|
||||
dateStart = new QDateTimeEdit(frame);
|
||||
@@ -1533,6 +1571,8 @@ void QUIDateSelect::initControl()
|
||||
labEnd->setText("结束时间");
|
||||
btnOk->setText("确定");
|
||||
btnClose->setText("关闭");
|
||||
QUIHelper::setIconBtn(btnOk, ":/image/btn_ok.png", 0xf00c);
|
||||
QUIHelper::setIconBtn(btnClose, ":/image/btn_close.png", 0xf00d);
|
||||
|
||||
dateStart->setDate(QDate::currentDate());
|
||||
dateEnd->setDate(QDate::currentDate().addDays(1));
|
||||
@@ -2138,6 +2178,22 @@ void QUIHelper::initFile(const QString &sourceName, const QString &targetName)
|
||||
}
|
||||
}
|
||||
|
||||
void QUIHelper::setIconBtn(QAbstractButton *btn, const QString &png, const QChar &str)
|
||||
{
|
||||
int size = 16;
|
||||
int width = 18;
|
||||
int height = 18;
|
||||
QPixmap pix;
|
||||
if (QPixmap(png).isNull()) {
|
||||
pix = IconHelper::Instance()->getPixmap(QUIConfig::TextColor, str, size, width, height);
|
||||
} else {
|
||||
pix = QPixmap(png);
|
||||
}
|
||||
|
||||
btn->setIconSize(QSize(width, height));
|
||||
btn->setIcon(QIcon(pix));
|
||||
}
|
||||
|
||||
void QUIHelper::newDir(const QString &dirName)
|
||||
{
|
||||
QString strDir = dirName;
|
||||
@@ -2575,6 +2631,26 @@ bool QUIHelper::isEmail(const QString &email)
|
||||
return true;
|
||||
}
|
||||
|
||||
QString QUIHelper::ipv4IntToString(quint32 ip)
|
||||
{
|
||||
QString result = QString("%1.%2.%3.%4").arg((ip >> 24) & 0xFF).arg((ip >> 16) & 0xFF).arg((ip >> 8) & 0xFF).arg(ip & 0xFF);
|
||||
return result;
|
||||
}
|
||||
|
||||
quint32 QUIHelper::ipv4StringToInt(const QString &ip)
|
||||
{
|
||||
int result = 0;
|
||||
if (isIP(ip)) {
|
||||
QStringList list = ip.split(".");
|
||||
int ip0 = list.at(0).toInt();
|
||||
int ip1 = list.at(1).toInt();
|
||||
int ip2 = list.at(2).toInt();
|
||||
int ip3 = list.at(3).toInt();
|
||||
result = ip3 | ip2 << 8 | ip1 << 16 | ip0 << 24;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int QUIHelper::strHexToDecimal(const QString &strHex)
|
||||
{
|
||||
bool ok;
|
||||
@@ -3509,7 +3585,7 @@ bool QUIHelper::isWebOk()
|
||||
return ipLive("115.239.211.112", 80);
|
||||
}
|
||||
|
||||
void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit)
|
||||
void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit, bool stretchLast)
|
||||
{
|
||||
//取消自动换行
|
||||
tableView->setWordWrap(false);
|
||||
@@ -3522,7 +3598,7 @@ void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVis
|
||||
//选中一行表头是否加粗
|
||||
tableView->horizontalHeader()->setHighlightSections(false);
|
||||
//最后一行拉伸填充
|
||||
tableView->horizontalHeader()->setStretchLastSection(true);
|
||||
tableView->horizontalHeader()->setStretchLastSection(stretchLast);
|
||||
//行标题最小宽度尺寸
|
||||
tableView->horizontalHeader()->setMinimumSectionSize(0);
|
||||
//行标题最大高度
|
||||
|
||||
@@ -71,33 +71,33 @@ class QUIWidget : public QDialog
|
||||
public:
|
||||
//将部分对象作为枚举值暴露给外部
|
||||
enum Widget {
|
||||
Lab_Ico = 0, //左上角图标
|
||||
BtnMenu = 1, //下拉菜单按钮
|
||||
BtnMenu_Min = 2, //最小化按钮
|
||||
BtnMenu_Max = 3, //最大化按钮
|
||||
BtnMenu_Normal = 4, //还原按钮
|
||||
BtnMenu_Close = 5 //关闭按钮
|
||||
Lab_Ico = 0, //左上角图标
|
||||
BtnMenu = 1, //下拉菜单按钮
|
||||
BtnMenu_Min = 2, //最小化按钮
|
||||
BtnMenu_Max = 3, //最大化按钮
|
||||
BtnMenu_Normal = 4, //还原按钮
|
||||
BtnMenu_Close = 5 //关闭按钮
|
||||
};
|
||||
|
||||
//样式枚举
|
||||
enum Style {
|
||||
Style_Silvery = 0, //银色样式
|
||||
Style_Blue = 1, //蓝色样式
|
||||
Style_LightBlue = 2, //淡蓝色样式
|
||||
Style_DarkBlue = 3, //深蓝色样式
|
||||
Style_Gray = 4, //灰色样式
|
||||
Style_LightGray = 5, //浅灰色样式
|
||||
Style_DarkGray = 6, //深灰色样式
|
||||
Style_Black = 7, //黑色样式
|
||||
Style_LightBlack = 8, //浅黑色样式
|
||||
Style_DarkBlack = 9, //深黑色样式
|
||||
Style_PSBlack = 10, //PS黑色样式
|
||||
Style_FlatBlack = 11, //黑色扁平样式
|
||||
Style_FlatWhite = 12, //白色扁平样式
|
||||
Style_FlatBlue = 13, //蓝色扁平样式
|
||||
Style_Purple = 14, //紫色样式
|
||||
Style_BlackBlue = 15, //黑蓝色样式
|
||||
Style_BlackVideo = 16 //视频监控黑色样式
|
||||
Style_Silvery = 0, //银色样式
|
||||
Style_Blue = 1, //蓝色样式
|
||||
Style_LightBlue = 2, //淡蓝色样式
|
||||
Style_DarkBlue = 3, //深蓝色样式
|
||||
Style_Gray = 4, //灰色样式
|
||||
Style_LightGray = 5, //浅灰色样式
|
||||
Style_DarkGray = 6, //深灰色样式
|
||||
Style_Black = 7, //黑色样式
|
||||
Style_LightBlack = 8, //浅黑色样式
|
||||
Style_DarkBlack = 9, //深黑色样式
|
||||
Style_PSBlack = 10, //PS黑色样式
|
||||
Style_FlatBlack = 11, //黑色扁平样式
|
||||
Style_FlatWhite = 12, //白色扁平样式
|
||||
Style_FlatBlue = 13, //蓝色扁平样式
|
||||
Style_Purple = 14, //紫色样式
|
||||
Style_BlackBlue = 15, //黑蓝色样式
|
||||
Style_BlackVideo = 16 //视频监控黑色样式
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -125,11 +125,11 @@ private:
|
||||
QVBoxLayout *verticalLayout3;
|
||||
|
||||
private:
|
||||
QString title; //标题
|
||||
Qt::Alignment alignment; //标题文本对齐
|
||||
bool minHide; //最小化隐藏
|
||||
bool exitAll; //退出整个程序
|
||||
QWidget *mainWidget; //主窗体对象
|
||||
QString title; //标题
|
||||
Qt::Alignment alignment;//标题文本对齐
|
||||
bool minHide; //最小化隐藏
|
||||
bool exitAll; //退出整个程序
|
||||
QWidget *mainWidget; //主窗体对象
|
||||
|
||||
public:
|
||||
QLabel *getLabIco() const;
|
||||
@@ -148,9 +148,9 @@ public:
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void changeStyle(); //更换样式
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void changeStyle(); //更换样式
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Min_clicked();
|
||||
@@ -202,6 +202,7 @@ public:
|
||||
~QUIMessageBox();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
void closeEvent(QCloseEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
@@ -213,7 +214,7 @@ private:
|
||||
QHBoxLayout *horizontalLayout3;
|
||||
QLabel *labIco;
|
||||
QLabel *labTitle;
|
||||
QLabel *labTime;
|
||||
QLabel *labCountDown;
|
||||
QWidget *widgetMenu;
|
||||
QHBoxLayout *horizontalLayout4;
|
||||
QPushButton *btnMenu_Close;
|
||||
@@ -231,13 +232,13 @@ private:
|
||||
QPushButton *btnCancel;
|
||||
|
||||
private:
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
@@ -245,6 +246,7 @@ private slots:
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIconMain(const QChar &str, quint32 size = 12);
|
||||
void setIconMsg(const QString &png, const QChar &str);
|
||||
void setMessage(const QString &msg, int type, int closeSec = 0);
|
||||
};
|
||||
|
||||
@@ -259,6 +261,7 @@ public:
|
||||
~QUITipBox();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
void closeEvent(QCloseEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
@@ -270,7 +273,7 @@ private:
|
||||
QHBoxLayout *horizontalLayout2;
|
||||
QLabel *labIco;
|
||||
QLabel *labTitle;
|
||||
QLabel *labTime;
|
||||
QLabel *labCountDown;
|
||||
QWidget *widgetMenu;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QPushButton *btnMenu_Close;
|
||||
@@ -282,13 +285,13 @@ private:
|
||||
bool fullScreen;
|
||||
|
||||
private:
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Close_clicked();
|
||||
@@ -323,7 +326,7 @@ private:
|
||||
QHBoxLayout *horizontalLayout1;
|
||||
QLabel *labIco;
|
||||
QLabel *labTitle;
|
||||
QLabel *labTime;
|
||||
QLabel *labCountDown;
|
||||
QWidget *widgetMenu;
|
||||
QHBoxLayout *horizontalLayout2;
|
||||
QPushButton *btnMenu_Close;
|
||||
@@ -340,14 +343,14 @@ private:
|
||||
QPushButton *btnCancel;
|
||||
|
||||
private:
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
QString value; //当前值
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
QString value; //当前值
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
@@ -375,6 +378,7 @@ public:
|
||||
~QUIDateSelect();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
@@ -400,13 +404,13 @@ private:
|
||||
QDateTimeEdit *dateEnd;
|
||||
|
||||
private:
|
||||
QString startDateTime; //开始时间
|
||||
QString endDateTime; //结束时间
|
||||
QString format; //日期时间格式
|
||||
QString startDateTime; //开始时间
|
||||
QString endDateTime; //结束时间
|
||||
QString format; //日期时间格式
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
@@ -595,6 +599,9 @@ public:
|
||||
//初始化文件,不存在则拷贝
|
||||
static void initFile(const QString &sourceName, const QString &targetName);
|
||||
|
||||
//设置图标到按钮
|
||||
static void setIconBtn(QAbstractButton *btn, const QString &png, const QChar &str);
|
||||
|
||||
//新建目录
|
||||
static void newDir(const QString &dirName);
|
||||
|
||||
@@ -653,6 +660,10 @@ public:
|
||||
//判断是否是合法的邮箱地址
|
||||
static bool isEmail(const QString &email);
|
||||
|
||||
//IP地址字符串与整型转换
|
||||
static QString ipv4IntToString(quint32 ip);
|
||||
static quint32 ipv4StringToInt(const QString &ip);
|
||||
|
||||
//16进制字符串转10进制
|
||||
static int strHexToDecimal(const QString &strHex);
|
||||
//10进制字符串转10进制
|
||||
@@ -755,7 +766,9 @@ public:
|
||||
static bool isWebOk();
|
||||
|
||||
//初始化表格
|
||||
static void initTableView(QTableView *tableView, int rowHeight = 25, bool headVisible = false, bool edit = false);
|
||||
static void initTableView(QTableView *tableView, int rowHeight = 25,
|
||||
bool headVisible = false, bool edit = false,
|
||||
bool stretchLast = true);
|
||||
|
||||
//弹出框
|
||||
static int showMessageBox(const QString &info, int type = 0, int closeSec = 0, bool exec = false);
|
||||
|
||||
@@ -88,14 +88,15 @@ bool frmCountCode::checkFile(const QString &fileName)
|
||||
void frmCountCode::countCode(const QString &filePath)
|
||||
{
|
||||
QDir dir(filePath);
|
||||
foreach (QFileInfo fileInfo , dir.entryInfoList()) {
|
||||
QFileInfoList fileInfos = dir.entryInfoList();
|
||||
foreach (QFileInfo fileInfo, fileInfos) {
|
||||
QString fileName = fileInfo.fileName();
|
||||
if (fileInfo.isFile()) {
|
||||
QString strFileName = fileInfo.fileName();
|
||||
if (checkFile(strFileName)) {
|
||||
if (checkFile(fileName)) {
|
||||
listFile << fileInfo.filePath();
|
||||
}
|
||||
} else {
|
||||
if(fileInfo.fileName() == "." || fileInfo.fileName() == "..") {
|
||||
if (fileName == "." || fileName == "..") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
BIN
countcode/snap.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
@@ -2,6 +2,7 @@
|
||||
#include "qapplication.h"
|
||||
#include "qtextcodec.h"
|
||||
#include "qsqldatabase.h"
|
||||
#include "qsqlquery.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
/**
|
||||
* 本地存储空间大小控件 作者:feiyangqingyun(QQ:517216493) 2016-11-30
|
||||
* 1:可自动加载本地存储设备的总容量/已用容量
|
||||
* 2:进度条显示已用容量
|
||||
* 3:支持所有操作系统
|
||||
* 4:增加U盘或者SD卡到达信号
|
||||
* 1. 可自动加载本地存储设备的总容量/已用容量
|
||||
* 2. 进度条显示已用容量
|
||||
* 3. 支持所有操作系统
|
||||
* 4. 增加U盘或者SD卡到达信号
|
||||
*/
|
||||
|
||||
#include <QTableWidget>
|
||||
@@ -14,13 +14,7 @@
|
||||
class QProcess;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT DeviceSizeTable : public QTableWidget
|
||||
class Q_DECL_EXPORT DeviceSizeTable : public QTableWidget
|
||||
#else
|
||||
class DeviceSizeTable : public QTableWidget
|
||||
#endif
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>ECharts</title>
|
||||
<!-- 引入 echarts.js -->
|
||||
<script src="echarts.min.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<title>ECharts</title>
|
||||
<script src="echarts.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
|
||||
<div id="main" style="height:300px;"></div>
|
||||
<script type="text/javascript">
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
var myChart = echarts.init(document.getElementById('main'));
|
||||
|
||||
function setGaugeValue(value){
|
||||
<div id="main" style="height:300px;"></div>
|
||||
<script type="text/javascript">
|
||||
var myChart = echarts.init(document.getElementById('main'));
|
||||
function setGaugeValue(value){
|
||||
var option = {
|
||||
tooltip : {
|
||||
formatter: "{a} <br/>{b} : {c}%"
|
||||
@@ -32,17 +28,11 @@ function setGaugeValue(value){
|
||||
data: [{value: value, name: '完成率'}]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
myChart.setOption(option);
|
||||
}
|
||||
|
||||
|
||||
window.onresize = myChart.resize ;
|
||||
|
||||
setGaugeValue(68);
|
||||
|
||||
</script>
|
||||
};
|
||||
myChart.setOption(option);
|
||||
}
|
||||
window.onresize = myChart.resize;
|
||||
setGaugeValue(68);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
11
ffmpegdemo/readme.md
Normal file
@@ -0,0 +1,11 @@
|
||||
### 特别说明
|
||||
1. 编译完成以后记得将dll文件复制到可执行文件同一目录。
|
||||
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
|
||||
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/103946731](https://qtchina.blog.csdn.net/article/details/103946731)
|
||||
|
||||
### 其他说明
|
||||
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)
|
||||
2. 国内站点:[https://gitee.com/feiyangqingyun](https://gitee.com/feiyangqingyun)
|
||||
3. 国际站点:[https://github.com/feiyangqingyun](https://github.com/feiyangqingyun)
|
||||
4. 个人主页:[https://blog.csdn.net/feiyangqingyun](https://blog.csdn.net/feiyangqingyun)
|
||||
5. 知乎主页:[https://www.zhihu.com/people/feiyangqingyun/](https://www.zhihu.com/people/feiyangqingyun/)
|
||||
@@ -1,9 +0,0 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><EFBFBD>ǵý<EFBFBD>dll<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ͬһĿ¼<EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><EFBFBD>dll<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD><EFBFBD>https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA <20><>ȡ<EFBFBD><C8A1>: ujm7
|
||||
|
||||
<EFBFBD>շ<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>汾<EFBFBD><EFBFBD>https://blog.csdn.net/feiyangqingyun/article/details/103946731
|
||||
|
||||
2. <20><><EFBFBD><EFBFBD>վ<EFBFBD>㣺[https://gitee.com/feiyangqingyun](https://gitee.com/feiyangqingyun)
|
||||
3. <20><><EFBFBD><EFBFBD>վ<EFBFBD>㣺[https://github.com/feiyangqingyun](https://github.com/feiyangqingyun)
|
||||
4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>[https://blog.csdn.net/feiyangqingyun](https://blog.csdn.net/feiyangqingyun)
|
||||
5. ֪<><D6AA><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>[https://www.zhihu.com/people/feiyangqingyun/](https://www.zhihu.com/people/feiyangqingyun/)
|
||||
@@ -3,14 +3,14 @@
|
||||
|
||||
/**
|
||||
* FlatUI辅助类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
||||
* 1:按钮样式设置
|
||||
* 2:文本框样式设置
|
||||
* 3:进度条样式
|
||||
* 4:滑块条样式
|
||||
* 5:单选框样式
|
||||
* 6:滚动条样式
|
||||
* 7:可自由设置对象的高度宽度大小等
|
||||
* 8:自带默认参数值
|
||||
* 1. 按钮样式设置
|
||||
* 2. 文本框样式设置
|
||||
* 3. 进度条样式
|
||||
* 4. 滑块条样式
|
||||
* 5. 单选框样式
|
||||
* 6. 滚动条样式
|
||||
* 7. 可自由设置对象的高度宽度大小等
|
||||
* 8. 自带默认参数值
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
@@ -24,13 +24,7 @@ class QCheckBox;
|
||||
class QScrollBar;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT FlatUI : public QObject
|
||||
class Q_DECL_EXPORT FlatUI : public QObject
|
||||
#else
|
||||
class FlatUI : public QObject
|
||||
#endif
|
||||
|
||||
@@ -3,23 +3,17 @@
|
||||
|
||||
/**
|
||||
* 无边框窗体类 作者:feiyangqingyun(QQ:517216493) 2019-10-03
|
||||
* 1:可以指定需要无边框的widget
|
||||
* 2:边框四周八个方位都可以自由拉伸
|
||||
* 3:可设置对应位置的边距,以便识别更大区域
|
||||
* 4:可设置是否允许拖动
|
||||
* 5:可设置是否允许拉伸
|
||||
* 1. 可以指定需要无边框的widget
|
||||
* 2. 边框四周八个方位都可以自由拉伸
|
||||
* 3. 可设置对应位置的边距,以便识别更大区域
|
||||
* 4. 可设置是否允许拖动
|
||||
* 5. 可设置是否允许拉伸
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT FramelessWidget : public QObject
|
||||
class Q_DECL_EXPORT FramelessWidget : public QObject
|
||||
#else
|
||||
class FramelessWidget : public QObject
|
||||
#endif
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
/**
|
||||
* GIF录屏控件 作者:feiyangqingyun(QQ:517216493) 2019-4-3
|
||||
* 1:可设置要录制屏幕的宽高,支持右下角直接拉动改变.
|
||||
* 2:可设置变宽的宽度
|
||||
* 3:可设置录屏控件的背景颜色
|
||||
* 4:可设置录制的帧数
|
||||
* 5:录制区域可自由拖动选择
|
||||
* 1. 可设置要录制屏幕的宽高,支持右下角直接拉动改变.
|
||||
* 2. 可设置变宽的宽度
|
||||
* 3. 可设置录屏控件的背景颜色
|
||||
* 4. 可设置录制的帧数
|
||||
* 5. 录制区域可自由拖动选择
|
||||
*/
|
||||
|
||||
#include <QDialog>
|
||||
@@ -17,13 +17,7 @@ class QLineEdit;
|
||||
class QLabel;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT GifWidget : public QDialog
|
||||
class Q_DECL_EXPORT GifWidget : public QDialog
|
||||
#else
|
||||
class GifWidget : public QDialog
|
||||
#endif
|
||||
|
||||
@@ -3,20 +3,14 @@
|
||||
|
||||
/**
|
||||
* 图片开关控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25
|
||||
* 1:自带三种开关按钮样式
|
||||
* 2:可自定义开关图片
|
||||
* 1. 自带三种开关按钮样式
|
||||
* 2. 可自定义开关图片
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT ImageSwitch : public QWidget
|
||||
class Q_DECL_EXPORT ImageSwitch : public QWidget
|
||||
#else
|
||||
class ImageSwitch : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
#include "qlabel.h"
|
||||
#include "qlineedit.h"
|
||||
#include "qboxlayout.h"
|
||||
#include "qregexp.h"
|
||||
#include "qvalidator.h"
|
||||
#include "qevent.h"
|
||||
#include "qdebug.h"
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
|
||||
#include "qregexp.h"
|
||||
#endif
|
||||
|
||||
IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
@@ -53,6 +55,7 @@ IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
|
||||
txtIP4->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
connect(txtIP4, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
|
||||
//设置IP地址校验过滤
|
||||
QRegExp regExp("(2[0-5]{2}|2[0-4][0-9]|1?[0-9]{1,2})");
|
||||
QRegExpValidator *validator = new QRegExpValidator(regExp, this);
|
||||
@@ -60,6 +63,7 @@ IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
|
||||
txtIP2->setValidator(validator);
|
||||
txtIP3->setValidator(validator);
|
||||
txtIP4->setValidator(validator);
|
||||
#endif
|
||||
|
||||
//绑定事件过滤器,识别键盘按下
|
||||
txtIP1->installEventFilter(this);
|
||||
@@ -79,13 +83,13 @@ IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
|
||||
frame->setStyleSheet(qss.join(""));
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
|
||||
verticalLayout->setMargin(0);
|
||||
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
verticalLayout->setSpacing(0);
|
||||
verticalLayout->addWidget(frame);
|
||||
|
||||
//将控件按照横向布局排列
|
||||
QHBoxLayout *layout = new QHBoxLayout(frame);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(txtIP1);
|
||||
layout->addWidget(labDot1);
|
||||
@@ -153,11 +157,13 @@ QSize IPAddress::minimumSizeHint() const
|
||||
|
||||
void IPAddress::setIP(const QString &ip)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
|
||||
//先检测IP地址是否合法
|
||||
QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)");
|
||||
if (!regExp.exactMatch(ip)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this->ip != ip) {
|
||||
this->ip = ip;
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
/**
|
||||
* IP地址输入框控件 作者:feiyangqingyun(QQ:517216493) 2017-8-11
|
||||
* 1:可设置IP地址,自动填入框
|
||||
* 2:可清空IP地址
|
||||
* 3:支持按下小圆点自动切换
|
||||
* 4:支持退格键自动切换
|
||||
* 5:支持IP地址过滤
|
||||
* 6:可设置背景色/边框颜色/边框圆角角度
|
||||
* 1. 可设置IP地址,自动填入框
|
||||
* 2. 可清空IP地址
|
||||
* 3. 支持按下小圆点自动切换
|
||||
* 4. 支持退格键自动切换
|
||||
* 5. 支持IP地址过滤
|
||||
* 6. 可设置背景色/边框颜色/边框圆角角度
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
@@ -17,13 +17,7 @@ class QLabel;
|
||||
class QLineEdit;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT IPAddress : public QWidget
|
||||
class Q_DECL_EXPORT IPAddress : public QWidget
|
||||
#else
|
||||
class IPAddress : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -3,28 +3,22 @@
|
||||
|
||||
/**
|
||||
* 高亮发光按钮控件 作者:feiyangqingyun(QQ:517216493) 2016-10-16
|
||||
* 1:可设置文本,居中显示
|
||||
* 2:可设置文本颜色
|
||||
* 3:可设置外边框渐变颜色
|
||||
* 4:可设置里边框渐变颜色
|
||||
* 5:可设置背景色
|
||||
* 6:可直接调用内置的设置 绿色/红色/黄色/黑色/蓝色 等公有槽函数
|
||||
* 7:可设置是否在容器中可移动,当成一个对象使用
|
||||
* 8:可设置是否显示矩形
|
||||
* 9:可设置报警颜色+非报警颜色
|
||||
* 10:可控制启动报警和停止报警,报警时闪烁
|
||||
* 1. 可设置文本,居中显示
|
||||
* 2. 可设置文本颜色
|
||||
* 3. 可设置外边框渐变颜色
|
||||
* 4. 可设置里边框渐变颜色
|
||||
* 5. 可设置背景色
|
||||
* 6. 可直接调用内置的设置 绿色/红色/黄色/黑色/蓝色 等公有槽函数
|
||||
* 7. 可设置是否在容器中可移动,当成一个对象使用
|
||||
* 8. 可设置是否显示矩形
|
||||
* 9. 可设置报警颜色+非报警颜色
|
||||
* 10. 可控制启动报警和停止报警,报警时闪烁
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT LightButton : public QWidget
|
||||
class Q_DECL_EXPORT LightButton : public QWidget
|
||||
#else
|
||||
class LightButton : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -3,23 +3,17 @@
|
||||
|
||||
/**
|
||||
* 农历信息类 作者:倪大侠 整理:feiyangqingyun(QQ:517216493) 2016-12-10
|
||||
* 1:计算是否闰年
|
||||
* 2:计算国际节日
|
||||
* 3:计算二十四节气
|
||||
* 4:计算农历年 天干+地支+生肖
|
||||
* 5:计算指定年月日农历信息,包括公历节日和农历节日及二十四节气
|
||||
* 1. 计算是否闰年
|
||||
* 2. 计算国际节日
|
||||
* 3. 计算二十四节气
|
||||
* 4. 计算农历年 天干+地支+生肖
|
||||
* 5. 计算指定年月日农历信息,包括公历节日和农历节日及二十四节气
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT LunarCalendarInfo : public QObject
|
||||
class Q_DECL_EXPORT LunarCalendarInfo : public QObject
|
||||
#else
|
||||
class LunarCalendarInfo : public QObject
|
||||
#endif
|
||||
|
||||
@@ -5,13 +5,7 @@
|
||||
#include <QDate>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT LunarCalendarItem : public QWidget
|
||||
class Q_DECL_EXPORT LunarCalendarItem : public QWidget
|
||||
#else
|
||||
class LunarCalendarItem : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -159,7 +159,7 @@ void LunarCalendarWidget::initWidget()
|
||||
|
||||
//星期布局
|
||||
QHBoxLayout *layoutWeek = new QHBoxLayout(widgetWeek);
|
||||
layoutWeek->setMargin(0);
|
||||
layoutWeek->setContentsMargins(0, 0, 0, 0);
|
||||
layoutWeek->setSpacing(0);
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
@@ -177,7 +177,7 @@ void LunarCalendarWidget::initWidget()
|
||||
|
||||
//日期标签布局
|
||||
QGridLayout *layoutBody = new QGridLayout(widgetBody);
|
||||
layoutBody->setMargin(1);
|
||||
layoutBody->setContentsMargins(1, 1, 1, 1);
|
||||
layoutBody->setHorizontalSpacing(0);
|
||||
layoutBody->setVerticalSpacing(0);
|
||||
|
||||
@@ -191,7 +191,7 @@ void LunarCalendarWidget::initWidget()
|
||||
|
||||
//主布局
|
||||
QVBoxLayout *verLayoutCalendar = new QVBoxLayout(this);
|
||||
verLayoutCalendar->setMargin(0);
|
||||
verLayoutCalendar->setContentsMargins(0, 0, 0, 0);
|
||||
verLayoutCalendar->setSpacing(0);
|
||||
verLayoutCalendar->addWidget(widgetTop);
|
||||
verLayoutCalendar->addWidget(widgetWeek);
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
/**
|
||||
* 自定义农历控件 作者:倪大侠 整理:feiyangqingyun(QQ:517216493) 2017-11-17
|
||||
* 1:可设置边框颜色/周末颜色/角标颜色/农历节日颜色
|
||||
* 2:可设置当前月文字颜色/其他月文字颜色/选中日期文字颜色/悬停日期文字颜色
|
||||
* 3:可设置当前月农历文字颜色/其他月农历文字颜色/选中日期农历文字颜色/悬停日期农历文字颜色
|
||||
* 4:可设置当前月背景颜色/其他月背景颜色/选中日期背景颜色/悬停日期背景颜色
|
||||
* 5:可设置三种选中背景模式,矩形背景+圆形背景+图片背景
|
||||
* 6:可直接切换到上一年/下一年/上一月/下一月/转到今天
|
||||
* 7:可设置是否显示农历信息,不显示则当做正常的日历使用
|
||||
* 8:支持1901年-2099年范围
|
||||
* 9:很方便改成多选日期
|
||||
* 1. 可设置边框颜色/周末颜色/角标颜色/农历节日颜色
|
||||
* 2. 可设置当前月文字颜色/其他月文字颜色/选中日期文字颜色/悬停日期文字颜色
|
||||
* 3. 可设置当前月农历文字颜色/其他月农历文字颜色/选中日期农历文字颜色/悬停日期农历文字颜色
|
||||
* 4. 可设置当前月背景颜色/其他月背景颜色/选中日期背景颜色/悬停日期背景颜色
|
||||
* 5. 可设置三种选中背景模式,矩形背景+圆形背景+图片背景
|
||||
* 6. 可直接切换到上一年/下一年/上一月/下一月/转到今天
|
||||
* 7. 可设置是否显示农历信息,不显示则当做正常的日历使用
|
||||
* 8. 支持1901年-2099年范围
|
||||
* 9. 很方便改成多选日期
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
@@ -25,13 +25,7 @@ class QComboBox;
|
||||
class LunarCalendarItem;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT LunarCalendarWidget : public QWidget
|
||||
class Q_DECL_EXPORT LunarCalendarWidget : public QWidget
|
||||
#else
|
||||
class LunarCalendarWidget : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include "maskwidget.h"
|
||||
#include "qmutex.h"
|
||||
#include "qapplication.h"
|
||||
#include "qdesktopwidget.h"
|
||||
#include "qapplication.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
QScopedPointer<MaskWidget> MaskWidget::self;
|
||||
@@ -56,7 +56,7 @@ void MaskWidget::setOpacity(double opacity)
|
||||
void MaskWidget::setBgColor(const QColor &bgColor)
|
||||
{
|
||||
QPalette palette = this->palette();
|
||||
palette.setBrush(QPalette::Background, bgColor);
|
||||
palette.setBrush(QPalette::Window, bgColor);
|
||||
this->setPalette(palette);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,23 +3,17 @@
|
||||
|
||||
/**
|
||||
* 弹窗遮罩层控件 作者:feiyangqingyun(QQ:517216493) 2016-12-26
|
||||
* 1:可设置需要遮罩的主窗体,自动跟随主窗体位置显示遮罩面积
|
||||
* 2:只需要将弹窗窗体的名称一开始传入队列即可,足够简单
|
||||
* 3:可设置透明度
|
||||
* 4:可设置遮罩层颜色
|
||||
* 5:不阻塞消息循坏
|
||||
* 1. 可设置需要遮罩的主窗体,自动跟随主窗体位置显示遮罩面积
|
||||
* 2. 只需要将弹窗窗体的名称一开始传入队列即可,足够简单
|
||||
* 3. 可设置透明度
|
||||
* 4. 可设置遮罩层颜色
|
||||
* 5. 不阻塞消息循坏
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT MaskWidget : public QWidget
|
||||
class Q_DECL_EXPORT MaskWidget : public QWidget
|
||||
#else
|
||||
class MaskWidget : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -24,29 +24,18 @@ void frmMoveWidget::initForm()
|
||||
btn1->setText("按住我拖动(仅限左键拖动)");
|
||||
MoveWidget *moveWidget1 = new MoveWidget(this);
|
||||
moveWidget1->setWidget(btn1);
|
||||
moveWidget1->setLeftButton(true);
|
||||
moveWidget1->setRightButton(false);
|
||||
|
||||
QPushButton *btn2 = new QPushButton(this);
|
||||
btn2->setGeometry(10, 40, 250, 25);
|
||||
btn2->setText("按住我拖动(仅限右键拖动)");
|
||||
btn2->setText("按住我拖动(支持右键拖动)");
|
||||
MoveWidget *moveWidget2 = new MoveWidget(this);
|
||||
moveWidget2->setWidget(btn2);
|
||||
moveWidget2->setLeftButton(false);
|
||||
moveWidget2->setRightButton(true);
|
||||
|
||||
QPushButton *btn3 = new QPushButton(this);
|
||||
btn3->setGeometry(10, 70, 250, 25);
|
||||
btn3->setText("按住我拖动(支持左右键拖动)");
|
||||
MoveWidget *moveWidget3 = new MoveWidget(this);
|
||||
moveWidget3->setWidget(btn3);
|
||||
moveWidget3->setLeftButton(true);
|
||||
moveWidget3->setRightButton(true);
|
||||
|
||||
QProgressBar *bar = new QProgressBar(this);
|
||||
bar->setGeometry(10, 100, 250, 25);
|
||||
bar->setGeometry(10, 70, 250, 25);
|
||||
bar->setRange(0, 0);
|
||||
bar->setTextVisible(false);
|
||||
MoveWidget *moveWidget4 = new MoveWidget(this);
|
||||
moveWidget4->setWidget(bar);
|
||||
}
|
||||
MoveWidget *moveWidget3 = new MoveWidget(this);
|
||||
moveWidget3->setWidget(bar);
|
||||
}
|
||||
@@ -6,8 +6,7 @@ MoveWidget::MoveWidget(QObject *parent) : QObject(parent)
|
||||
{
|
||||
lastPoint = QPoint(0, 0);
|
||||
pressed = false;
|
||||
leftButton = false;
|
||||
rightButton = false;
|
||||
leftButton = true;
|
||||
inControl = true;
|
||||
widget = 0;
|
||||
}
|
||||
@@ -17,12 +16,8 @@ bool MoveWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
if (widget != 0 && watched == widget) {
|
||||
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||
//如果鼠标左键和鼠标右键都可以拖动
|
||||
if (leftButton && rightButton) {
|
||||
|
||||
}
|
||||
//如果限定了只能鼠标左键拖动则判断当前是否是鼠标左键,如果限定了只能鼠标右键拖动则判断当前是否是鼠标右键
|
||||
else if ((leftButton && mouseEvent->button() != Qt::LeftButton) || (rightButton && mouseEvent->button() != Qt::RightButton)) {
|
||||
//如果限定了只能鼠标左键拖动则判断当前是否是鼠标左键
|
||||
if (leftButton && mouseEvent->button() != Qt::LeftButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,11 +68,6 @@ void MoveWidget::setLeftButton(bool leftButton)
|
||||
this->leftButton = leftButton;
|
||||
}
|
||||
|
||||
void MoveWidget::setRightButton(bool rightButton)
|
||||
{
|
||||
this->rightButton = rightButton;
|
||||
}
|
||||
|
||||
void MoveWidget::setInControl(bool inControl)
|
||||
{
|
||||
this->inControl = inControl;
|
||||
|
||||
@@ -34,15 +34,12 @@ private:
|
||||
QPoint lastPoint; //最后按下的坐标
|
||||
bool pressed; //鼠标是否按下
|
||||
bool leftButton; //限定鼠标左键
|
||||
bool rightButton; //限定鼠标右键
|
||||
bool inControl; //限定在容器内
|
||||
QWidget *widget; //移动的控件
|
||||
|
||||
public Q_SLOTS:
|
||||
//设置是否限定鼠标左键
|
||||
void setLeftButton(bool leftButton);
|
||||
//设置是否限定鼠标右键
|
||||
void setRightButton(bool rightButton);
|
||||
//设置是否限定不能移出容器外面
|
||||
void setInControl(bool inControl);
|
||||
//设置要移动的控件
|
||||
|
||||
@@ -8,7 +8,7 @@ QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = lightbutton
|
||||
TARGET = movewidget
|
||||
TEMPLATE = app
|
||||
DESTDIR = $$PWD/../bin
|
||||
CONFIG += warn_off
|
||||
|
||||
11
mpvdemo/readme.md
Normal file
@@ -0,0 +1,11 @@
|
||||
### 特别说明
|
||||
1. 编译完成以后记得将dll文件复制到可执行文件同一目录。
|
||||
2. 动态库地址:[https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA](https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA) 提取码: ujm7
|
||||
3. 收费增强版:[https://qtchina.blog.csdn.net/article/details/107972067](https://qtchina.blog.csdn.net/article/details/107972067)
|
||||
|
||||
### 其他说明
|
||||
1. 作品大全:[https://qtchina.blog.csdn.net/article/details/97565652](https://qtchina.blog.csdn.net/article/details/97565652)
|
||||
2. 国内站点:[https://gitee.com/feiyangqingyun](https://gitee.com/feiyangqingyun)
|
||||
3. 国际站点:[https://github.com/feiyangqingyun](https://github.com/feiyangqingyun)
|
||||
4. 个人主页:[https://blog.csdn.net/feiyangqingyun](https://blog.csdn.net/feiyangqingyun)
|
||||
5. 知乎主页:[https://www.zhihu.com/people/feiyangqingyun/](https://www.zhihu.com/people/feiyangqingyun/)
|
||||
@@ -1,9 +0,0 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ժ<EFBFBD><EFBFBD>ǵý<EFBFBD>dll<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ͬһĿ¼<EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD><EFBFBD>dll<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ַ<EFBFBD><EFBFBD>https://pan.baidu.com/s/13LDRu6mXC6gaADtrGprNVA <20><>ȡ<EFBFBD><C8A1>: ujm7
|
||||
|
||||
<EFBFBD>շ<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>汾<EFBFBD><EFBFBD>https://blog.csdn.net/feiyangqingyun/article/details/107972067
|
||||
|
||||
2. <20><><EFBFBD><EFBFBD>վ<EFBFBD>㣺[https://gitee.com/feiyangqingyun](https://gitee.com/feiyangqingyun)
|
||||
3. <20><><EFBFBD><EFBFBD>վ<EFBFBD>㣺[https://github.com/feiyangqingyun](https://github.com/feiyangqingyun)
|
||||
4. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>[https://blog.csdn.net/feiyangqingyun](https://blog.csdn.net/feiyangqingyun)
|
||||
5. ֪<><D6AA><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>[https://www.zhihu.com/people/feiyangqingyun/](https://www.zhihu.com/people/feiyangqingyun/)
|
||||
@@ -7,8 +7,12 @@
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
//图形字体处理类
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT IconHelper : public QObject
|
||||
#else
|
||||
class IconHelper : public QObject
|
||||
#endif
|
||||
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ NavButton::NavButton(QWidget *parent) : QPushButton(parent)
|
||||
|
||||
hover = false;
|
||||
setCheckable(true);
|
||||
setText("导航按钮");
|
||||
}
|
||||
|
||||
void NavButton::enterEvent(QEvent *)
|
||||
|
||||
@@ -3,26 +3,20 @@
|
||||
|
||||
/**
|
||||
* 导航按钮控件 作者:feiyangqingyun(QQ:517216493) 2017-12-19
|
||||
* 1:可设置文字的左侧+右侧+顶部+底部间隔
|
||||
* 2:可设置文字对齐方式
|
||||
* 3:可设置显示倒三角/倒三角边长/倒三角位置/倒三角颜色
|
||||
* 4:可设置显示图标/图标间隔/图标尺寸/正常状态图标/悬停状态图标/选中状态图标
|
||||
* 5:可设置显示边框线条/线条宽度/线条间隔/线条位置/线条颜色
|
||||
* 6:可设置正常背景颜色/悬停背景颜色/选中背景颜色
|
||||
* 7:可设置正常文字颜色/悬停文字颜色/选中文字颜色
|
||||
* 8:可设置背景颜色为画刷颜色
|
||||
* 1. 可设置文字的左侧+右侧+顶部+底部间隔
|
||||
* 2. 可设置文字对齐方式
|
||||
* 3. 可设置显示倒三角/倒三角边长/倒三角位置/倒三角颜色
|
||||
* 4. 可设置显示图标/图标间隔/图标尺寸/正常状态图标/悬停状态图标/选中状态图标
|
||||
* 5. 可设置显示边框线条/线条宽度/线条间隔/线条位置/线条颜色
|
||||
* 6. 可设置正常背景颜色/悬停背景颜色/选中背景颜色
|
||||
* 7. 可设置正常文字颜色/悬停文字颜色/选中文字颜色
|
||||
* 8. 可设置背景颜色为画刷颜色
|
||||
*/
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT NavButton : public QPushButton
|
||||
class Q_DECL_EXPORT NavButton : public QPushButton
|
||||
#else
|
||||
class NavButton : public QPushButton
|
||||
#endif
|
||||
|
||||
@@ -528,6 +528,11 @@ QUIMessageBox::~QUIMessageBox()
|
||||
delete widgetMain;
|
||||
}
|
||||
|
||||
void QUIMessageBox::showEvent(QShowEvent *)
|
||||
{
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
void QUIMessageBox::closeEvent(QCloseEvent *)
|
||||
{
|
||||
closeSec = 0;
|
||||
@@ -567,6 +572,7 @@ void QUIMessageBox::initControl()
|
||||
verticalLayout1->setSpacing(0);
|
||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -574,10 +580,12 @@ void QUIMessageBox::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout3 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout3->setSpacing(0);
|
||||
horizontalLayout3->setObjectName(QString::fromUtf8("horizontalLayout3"));
|
||||
horizontalLayout3->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
@@ -586,34 +594,33 @@ void QUIMessageBox::initControl()
|
||||
sizePolicy1.setHeightForWidth(labIco->sizePolicy().hasHeightForWidth());
|
||||
labIco->setSizePolicy(sizePolicy1);
|
||||
labIco->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout3->addWidget(labIco);
|
||||
|
||||
labTitle = new QLabel(widgetTitle);
|
||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
horizontalLayout3->addWidget(labTitle);
|
||||
|
||||
labTime = new QLabel(widgetTitle);
|
||||
labTime->setObjectName(QString::fromUtf8("labTime"));
|
||||
labCountDown = new QLabel(widgetTitle);
|
||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy2.setHorizontalStretch(0);
|
||||
sizePolicy2.setVerticalStretch(0);
|
||||
sizePolicy2.setHeightForWidth(labTime->sizePolicy().hasHeightForWidth());
|
||||
labTime->setSizePolicy(sizePolicy2);
|
||||
labTime->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout3->addWidget(labTime);
|
||||
sizePolicy2.setHeightForWidth(labCountDown->sizePolicy().hasHeightForWidth());
|
||||
labCountDown->setSizePolicy(sizePolicy2);
|
||||
labCountDown->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout3->addWidget(labCountDown);
|
||||
|
||||
widgetMenu = new QWidget(widgetTitle);
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy1);
|
||||
|
||||
horizontalLayout4 = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout4->setSpacing(0);
|
||||
horizontalLayout4->setObjectName(QString::fromUtf8("horizontalLayout4"));
|
||||
horizontalLayout4->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -631,22 +638,27 @@ void QUIMessageBox::initControl()
|
||||
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setSpacing(5);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
frame = new QFrame(widgetMain);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
verticalLayout4 = new QVBoxLayout(frame);
|
||||
verticalLayout4->setObjectName(QString::fromUtf8("verticalLayout4"));
|
||||
verticalLayout4->setContentsMargins(-1, 9, -1, -1);
|
||||
horizontalLayout1 = new QHBoxLayout();
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
|
||||
labIcoMain = new QLabel(frame);
|
||||
labIcoMain->setObjectName(QString::fromUtf8("labIcoMain"));
|
||||
labIcoMain->setAlignment(Qt::AlignCenter);
|
||||
|
||||
verticalLayout4 = new QVBoxLayout(frame);
|
||||
verticalLayout4->setObjectName(QString::fromUtf8("verticalLayout4"));
|
||||
verticalLayout4->setContentsMargins(-1, 9, -1, -1);
|
||||
|
||||
horizontalLayout1 = new QHBoxLayout();
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
horizontalLayout1->addWidget(labIcoMain);
|
||||
horizontalSpacer1 = new QSpacerItem(5, 0, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
horizontalLayout1->addItem(horizontalSpacer1);
|
||||
@@ -673,14 +685,13 @@ void QUIMessageBox::initControl()
|
||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
||||
btnOk->setMinimumSize(QSize(85, 0));
|
||||
btnOk->setFocusPolicy(Qt::StrongFocus);
|
||||
btnOk->setIcon(QIcon(":/image/btn_ok.png"));
|
||||
horizontalLayout2->addWidget(btnOk);
|
||||
btnOk->setDefault(true);
|
||||
|
||||
btnCancel = new QPushButton(frame);
|
||||
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
|
||||
btnCancel->setMinimumSize(QSize(85, 0));
|
||||
btnCancel->setFocusPolicy(Qt::StrongFocus);
|
||||
btnCancel->setIcon(QIcon(":/image/btn_close.png"));
|
||||
horizontalLayout2->addWidget(btnCancel);
|
||||
|
||||
verticalLayout4->addLayout(horizontalLayout2);
|
||||
@@ -693,6 +704,8 @@ void QUIMessageBox::initControl()
|
||||
|
||||
btnOk->setText("确定");
|
||||
btnCancel->setText("取消");
|
||||
QUIHelper::setIconBtn(btnOk, ":/image/btn_ok.png", 0xf00c);
|
||||
QUIHelper::setIconBtn(btnCancel, ":/image/btn_close.png", 0xf00d);
|
||||
|
||||
connect(btnOk, SIGNAL(clicked()), this, SLOT(on_btnOk_clicked()));
|
||||
connect(btnCancel, SIGNAL(clicked()), this, SLOT(on_btnMenu_Close_clicked()));
|
||||
@@ -746,7 +759,7 @@ void QUIMessageBox::checkSec()
|
||||
}
|
||||
|
||||
QString str = QString("关闭倒计时 %1 s").arg(closeSec - currentSec + 1);
|
||||
this->labTime->setText(str);
|
||||
this->labCountDown->setText(str);
|
||||
}
|
||||
|
||||
void QUIMessageBox::on_btnOk_clicked()
|
||||
@@ -766,40 +779,33 @@ void QUIMessageBox::setIconMain(const QChar &str, quint32 size)
|
||||
IconHelper::Instance()->setIcon(this->labIco, str, size);
|
||||
}
|
||||
|
||||
void QUIMessageBox::setIconMsg(const QString &png, const QChar &str)
|
||||
{
|
||||
//图片存在则取图片,不存在则取图形字体
|
||||
int size = this->labIcoMain->size().height();
|
||||
if (QImage(png).isNull()) {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, str, size);
|
||||
} else {
|
||||
this->labIcoMain->setStyleSheet(QString("border-image:url(%1);").arg(png));
|
||||
}
|
||||
}
|
||||
|
||||
void QUIMessageBox::setMessage(const QString &msg, int type, int closeSec)
|
||||
{
|
||||
this->closeSec = closeSec;
|
||||
this->currentSec = 0;
|
||||
this->labTime->clear();
|
||||
this->labCountDown->clear();
|
||||
checkSec();
|
||||
|
||||
//图片存在则取图片,不存在则取图形字体
|
||||
int size = this->labIcoMain->size().height();
|
||||
bool exist = !QImage(":/image/msg_info.png").isNull();
|
||||
if (type == 0) {
|
||||
if (exist) {
|
||||
this->labIcoMain->setStyleSheet("border-image: url(:/image/msg_info.png);");
|
||||
} else {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, 0xf05a, size);
|
||||
}
|
||||
|
||||
setIconMsg(":/image/msg_info.png", 0xf05a);
|
||||
this->btnCancel->setVisible(false);
|
||||
this->labTitle->setText("提示");
|
||||
} else if (type == 1) {
|
||||
if (exist) {
|
||||
this->labIcoMain->setStyleSheet("border-image: url(:/image/msg_question.png);");
|
||||
} else {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, 0xf059, size);
|
||||
}
|
||||
|
||||
setIconMsg(":/image/msg_question.png", 0xf059);
|
||||
this->labTitle->setText("询问");
|
||||
} else if (type == 2) {
|
||||
if (exist) {
|
||||
this->labIcoMain->setStyleSheet("border-image: url(:/image/msg_error.png);");
|
||||
} else {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, 0xf057, size);
|
||||
}
|
||||
|
||||
setIconMsg(":/image/msg_error.png", 0xf057);
|
||||
this->btnCancel->setVisible(false);
|
||||
this->labTitle->setText("错误");
|
||||
}
|
||||
@@ -841,6 +847,11 @@ QUITipBox::~QUITipBox()
|
||||
delete widgetMain;
|
||||
}
|
||||
|
||||
void QUITipBox::showEvent(QShowEvent *)
|
||||
{
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
void QUITipBox::closeEvent(QCloseEvent *)
|
||||
{
|
||||
closeSec = 0;
|
||||
@@ -880,6 +891,7 @@ void QUITipBox::initControl()
|
||||
verticalLayout->setSpacing(0);
|
||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -887,10 +899,12 @@ void QUITipBox::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout2 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout2->setSpacing(0);
|
||||
horizontalLayout2->setObjectName(QString::fromUtf8("horizontalLayout2"));
|
||||
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
labIco->setAlignment(Qt::AlignCenter);
|
||||
@@ -901,15 +915,15 @@ void QUITipBox::initControl()
|
||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
horizontalLayout2->addWidget(labTitle);
|
||||
|
||||
labTime = new QLabel(widgetTitle);
|
||||
labTime->setObjectName(QString::fromUtf8("labTime"));
|
||||
labCountDown = new QLabel(widgetTitle);
|
||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(labTime->sizePolicy().hasHeightForWidth());
|
||||
labTime->setSizePolicy(sizePolicy1);
|
||||
labTime->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout2->addWidget(labTime);
|
||||
sizePolicy1.setHeightForWidth(labCountDown->sizePolicy().hasHeightForWidth());
|
||||
labCountDown->setSizePolicy(sizePolicy1);
|
||||
labCountDown->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout2->addWidget(labCountDown);
|
||||
|
||||
widgetMenu = new QWidget(widgetTitle);
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
@@ -918,10 +932,12 @@ void QUITipBox::initControl()
|
||||
sizePolicy2.setVerticalStretch(0);
|
||||
sizePolicy2.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy2);
|
||||
|
||||
horizontalLayout = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout->setSpacing(0);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -940,11 +956,14 @@ void QUITipBox::initControl()
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
widgetMain->setAutoFillBackground(true);
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
|
||||
labInfo = new QLabel(widgetMain);
|
||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
||||
labInfo->setScaledContents(true);
|
||||
labInfo->setWordWrap(true);
|
||||
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
verticalLayout2->addWidget(labInfo);
|
||||
verticalLayout->addWidget(widgetMain);
|
||||
|
||||
@@ -997,7 +1016,7 @@ void QUITipBox::checkSec()
|
||||
}
|
||||
|
||||
QString str = QString("关闭倒计时 %1 s").arg(closeSec - currentSec + 1);
|
||||
this->labTime->setText(str);
|
||||
this->labCountDown->setText(str);
|
||||
}
|
||||
|
||||
void QUITipBox::on_btnMenu_Close_clicked()
|
||||
@@ -1015,7 +1034,7 @@ void QUITipBox::setTip(const QString &title, const QString &tip, bool fullScreen
|
||||
{
|
||||
this->closeSec = closeSec;
|
||||
this->currentSec = 0;
|
||||
this->labTime->clear();
|
||||
this->labCountDown->clear();
|
||||
checkSec();
|
||||
|
||||
this->fullScreen = fullScreen;
|
||||
@@ -1096,6 +1115,7 @@ void QUIInputBox::initControl()
|
||||
verticalLayout1->setSpacing(0);
|
||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -1103,10 +1123,12 @@ void QUIInputBox::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout1 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout1->setSpacing(0);
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
@@ -1115,34 +1137,33 @@ void QUIInputBox::initControl()
|
||||
sizePolicy1.setHeightForWidth(labIco->sizePolicy().hasHeightForWidth());
|
||||
labIco->setSizePolicy(sizePolicy1);
|
||||
labIco->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout1->addWidget(labIco);
|
||||
|
||||
labTitle = new QLabel(widgetTitle);
|
||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
horizontalLayout1->addWidget(labTitle);
|
||||
|
||||
labTime = new QLabel(widgetTitle);
|
||||
labTime->setObjectName(QString::fromUtf8("labTime"));
|
||||
labCountDown = new QLabel(widgetTitle);
|
||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy2.setHorizontalStretch(0);
|
||||
sizePolicy2.setVerticalStretch(0);
|
||||
sizePolicy2.setHeightForWidth(labTime->sizePolicy().hasHeightForWidth());
|
||||
labTime->setSizePolicy(sizePolicy2);
|
||||
labTime->setAlignment(Qt::AlignCenter);
|
||||
|
||||
horizontalLayout1->addWidget(labTime);
|
||||
sizePolicy2.setHeightForWidth(labCountDown->sizePolicy().hasHeightForWidth());
|
||||
labCountDown->setSizePolicy(sizePolicy2);
|
||||
labCountDown->setAlignment(Qt::AlignCenter);
|
||||
horizontalLayout1->addWidget(labCountDown);
|
||||
|
||||
widgetMenu = new QWidget(widgetTitle);
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy1);
|
||||
|
||||
horizontalLayout2 = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout2->setSpacing(0);
|
||||
horizontalLayout2->setObjectName(QString::fromUtf8("horizontalLayout2"));
|
||||
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -1160,20 +1181,24 @@ void QUIInputBox::initControl()
|
||||
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
|
||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout2->setSpacing(5);
|
||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
||||
|
||||
frame = new QFrame(widgetMain);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
verticalLayout3 = new QVBoxLayout(frame);
|
||||
verticalLayout3->setObjectName(QString::fromUtf8("verticalLayout3"));
|
||||
|
||||
labInfo = new QLabel(frame);
|
||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
||||
labInfo->setScaledContents(false);
|
||||
labInfo->setWordWrap(true);
|
||||
|
||||
verticalLayout3 = new QVBoxLayout(frame);
|
||||
verticalLayout3->setObjectName(QString::fromUtf8("verticalLayout3"));
|
||||
verticalLayout3->addWidget(labInfo);
|
||||
|
||||
txtValue = new QLineEdit(frame);
|
||||
@@ -1192,13 +1217,12 @@ void QUIInputBox::initControl()
|
||||
btnOk = new QPushButton(frame);
|
||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
||||
btnOk->setMinimumSize(QSize(85, 0));
|
||||
btnOk->setIcon(QIcon(":/image/btn_ok.png"));
|
||||
lay->addWidget(btnOk);
|
||||
btnOk->setDefault(true);
|
||||
|
||||
btnCancel = new QPushButton(frame);
|
||||
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
|
||||
btnCancel->setMinimumSize(QSize(85, 0));
|
||||
btnCancel->setIcon(QIcon(":/image/btn_close.png"));
|
||||
lay->addWidget(btnCancel);
|
||||
|
||||
verticalLayout3->addLayout(lay);
|
||||
@@ -1211,6 +1235,8 @@ void QUIInputBox::initControl()
|
||||
labTitle->setText("输入框");
|
||||
btnOk->setText("确定");
|
||||
btnCancel->setText("取消");
|
||||
QUIHelper::setIconBtn(btnOk, ":/image/btn_ok.png", 0xf00c);
|
||||
QUIHelper::setIconBtn(btnCancel, ":/image/btn_close.png", 0xf00d);
|
||||
|
||||
connect(btnOk, SIGNAL(clicked()), this, SLOT(on_btnOk_clicked()));
|
||||
connect(btnCancel, SIGNAL(clicked()), this, SLOT(on_btnMenu_Close_clicked()));
|
||||
@@ -1264,7 +1290,7 @@ void QUIInputBox::checkSec()
|
||||
}
|
||||
|
||||
QString str = QString("关闭倒计时 %1 s").arg(closeSec - currentSec + 1);
|
||||
this->labTime->setText(str);
|
||||
this->labCountDown->setText(str);
|
||||
}
|
||||
|
||||
void QUIInputBox::setParameter(const QString &title, int type, int closeSec,
|
||||
@@ -1273,7 +1299,7 @@ void QUIInputBox::setParameter(const QString &title, int type, int closeSec,
|
||||
{
|
||||
this->closeSec = closeSec;
|
||||
this->currentSec = 0;
|
||||
this->labTime->clear();
|
||||
this->labCountDown->clear();
|
||||
this->labInfo->setText(title);
|
||||
checkSec();
|
||||
|
||||
@@ -1377,6 +1403,11 @@ QUIDateSelect::~QUIDateSelect()
|
||||
delete widgetMain;
|
||||
}
|
||||
|
||||
void QUIDateSelect::showEvent(QShowEvent *)
|
||||
{
|
||||
this->activateWindow();
|
||||
}
|
||||
|
||||
bool QUIDateSelect::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
static QPoint mousePoint;
|
||||
@@ -1410,6 +1441,7 @@ void QUIDateSelect::initControl()
|
||||
verticalLayout->setSpacing(0);
|
||||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
|
||||
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
widgetTitle = new QWidget(this);
|
||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
@@ -1417,10 +1449,12 @@ void QUIDateSelect::initControl()
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widgetTitle->sizePolicy().hasHeightForWidth());
|
||||
widgetTitle->setSizePolicy(sizePolicy);
|
||||
|
||||
horizontalLayout1 = new QHBoxLayout(widgetTitle);
|
||||
horizontalLayout1->setSpacing(0);
|
||||
horizontalLayout1->setObjectName(QString::fromUtf8("horizontalLayout1"));
|
||||
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
labIco = new QLabel(widgetTitle);
|
||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
@@ -1445,10 +1479,12 @@ void QUIDateSelect::initControl()
|
||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||
widgetMenu->setSizePolicy(sizePolicy1);
|
||||
|
||||
horizontalLayout = new QHBoxLayout(widgetMenu);
|
||||
horizontalLayout->setSpacing(0);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
btnMenu_Close = new QPushButton(widgetMenu);
|
||||
btnMenu_Close->setObjectName(QString::fromUtf8("btnMenu_Close"));
|
||||
QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
@@ -1466,14 +1502,17 @@ void QUIDateSelect::initControl()
|
||||
|
||||
widgetMain = new QWidget(this);
|
||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
||||
|
||||
verticalLayout1 = new QVBoxLayout(widgetMain);
|
||||
verticalLayout1->setSpacing(6);
|
||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||
verticalLayout1->setContentsMargins(6, 6, 6, 6);
|
||||
|
||||
frame = new QFrame(widgetMain);
|
||||
frame->setObjectName(QString::fromUtf8("frame"));
|
||||
frame->setFrameShape(QFrame::Box);
|
||||
frame->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
gridLayout = new QGridLayout(frame);
|
||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||
labStart = new QLabel(frame);
|
||||
@@ -1486,8 +1525,8 @@ void QUIDateSelect::initControl()
|
||||
btnOk->setMinimumSize(QSize(85, 0));
|
||||
btnOk->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
btnOk->setFocusPolicy(Qt::StrongFocus);
|
||||
btnOk->setIcon(QIcon(":/image/btn_ok.png"));
|
||||
gridLayout->addWidget(btnOk, 0, 2, 1, 1);
|
||||
btnOk->setDefault(true);
|
||||
|
||||
labEnd = new QLabel(frame);
|
||||
labEnd->setObjectName(QString::fromUtf8("labEnd"));
|
||||
@@ -1499,7 +1538,6 @@ void QUIDateSelect::initControl()
|
||||
btnClose->setMinimumSize(QSize(85, 0));
|
||||
btnClose->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
btnClose->setFocusPolicy(Qt::StrongFocus);
|
||||
btnClose->setIcon(QIcon(":/image/btn_close.png"));
|
||||
gridLayout->addWidget(btnClose, 1, 2, 1, 1);
|
||||
|
||||
dateStart = new QDateTimeEdit(frame);
|
||||
@@ -1533,6 +1571,8 @@ void QUIDateSelect::initControl()
|
||||
labEnd->setText("结束时间");
|
||||
btnOk->setText("确定");
|
||||
btnClose->setText("关闭");
|
||||
QUIHelper::setIconBtn(btnOk, ":/image/btn_ok.png", 0xf00c);
|
||||
QUIHelper::setIconBtn(btnClose, ":/image/btn_close.png", 0xf00d);
|
||||
|
||||
dateStart->setDate(QDate::currentDate());
|
||||
dateEnd->setDate(QDate::currentDate().addDays(1));
|
||||
@@ -2138,6 +2178,22 @@ void QUIHelper::initFile(const QString &sourceName, const QString &targetName)
|
||||
}
|
||||
}
|
||||
|
||||
void QUIHelper::setIconBtn(QAbstractButton *btn, const QString &png, const QChar &str)
|
||||
{
|
||||
int size = 16;
|
||||
int width = 18;
|
||||
int height = 18;
|
||||
QPixmap pix;
|
||||
if (QPixmap(png).isNull()) {
|
||||
pix = IconHelper::Instance()->getPixmap(QUIConfig::TextColor, str, size, width, height);
|
||||
} else {
|
||||
pix = QPixmap(png);
|
||||
}
|
||||
|
||||
btn->setIconSize(QSize(width, height));
|
||||
btn->setIcon(QIcon(pix));
|
||||
}
|
||||
|
||||
void QUIHelper::newDir(const QString &dirName)
|
||||
{
|
||||
QString strDir = dirName;
|
||||
@@ -2575,6 +2631,26 @@ bool QUIHelper::isEmail(const QString &email)
|
||||
return true;
|
||||
}
|
||||
|
||||
QString QUIHelper::ipv4IntToString(quint32 ip)
|
||||
{
|
||||
QString result = QString("%1.%2.%3.%4").arg((ip >> 24) & 0xFF).arg((ip >> 16) & 0xFF).arg((ip >> 8) & 0xFF).arg(ip & 0xFF);
|
||||
return result;
|
||||
}
|
||||
|
||||
quint32 QUIHelper::ipv4StringToInt(const QString &ip)
|
||||
{
|
||||
int result = 0;
|
||||
if (isIP(ip)) {
|
||||
QStringList list = ip.split(".");
|
||||
int ip0 = list.at(0).toInt();
|
||||
int ip1 = list.at(1).toInt();
|
||||
int ip2 = list.at(2).toInt();
|
||||
int ip3 = list.at(3).toInt();
|
||||
result = ip3 | ip2 << 8 | ip1 << 16 | ip0 << 24;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int QUIHelper::strHexToDecimal(const QString &strHex)
|
||||
{
|
||||
bool ok;
|
||||
@@ -3509,7 +3585,7 @@ bool QUIHelper::isWebOk()
|
||||
return ipLive("115.239.211.112", 80);
|
||||
}
|
||||
|
||||
void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit)
|
||||
void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit, bool stretchLast)
|
||||
{
|
||||
//取消自动换行
|
||||
tableView->setWordWrap(false);
|
||||
@@ -3522,7 +3598,7 @@ void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVis
|
||||
//选中一行表头是否加粗
|
||||
tableView->horizontalHeader()->setHighlightSections(false);
|
||||
//最后一行拉伸填充
|
||||
tableView->horizontalHeader()->setStretchLastSection(true);
|
||||
tableView->horizontalHeader()->setStretchLastSection(stretchLast);
|
||||
//行标题最小宽度尺寸
|
||||
tableView->horizontalHeader()->setMinimumSectionSize(0);
|
||||
//行标题最大高度
|
||||
|
||||
@@ -71,33 +71,33 @@ class QUIWidget : public QDialog
|
||||
public:
|
||||
//将部分对象作为枚举值暴露给外部
|
||||
enum Widget {
|
||||
Lab_Ico = 0, //左上角图标
|
||||
BtnMenu = 1, //下拉菜单按钮
|
||||
BtnMenu_Min = 2, //最小化按钮
|
||||
BtnMenu_Max = 3, //最大化按钮
|
||||
BtnMenu_Normal = 4, //还原按钮
|
||||
BtnMenu_Close = 5 //关闭按钮
|
||||
Lab_Ico = 0, //左上角图标
|
||||
BtnMenu = 1, //下拉菜单按钮
|
||||
BtnMenu_Min = 2, //最小化按钮
|
||||
BtnMenu_Max = 3, //最大化按钮
|
||||
BtnMenu_Normal = 4, //还原按钮
|
||||
BtnMenu_Close = 5 //关闭按钮
|
||||
};
|
||||
|
||||
//样式枚举
|
||||
enum Style {
|
||||
Style_Silvery = 0, //银色样式
|
||||
Style_Blue = 1, //蓝色样式
|
||||
Style_LightBlue = 2, //淡蓝色样式
|
||||
Style_DarkBlue = 3, //深蓝色样式
|
||||
Style_Gray = 4, //灰色样式
|
||||
Style_LightGray = 5, //浅灰色样式
|
||||
Style_DarkGray = 6, //深灰色样式
|
||||
Style_Black = 7, //黑色样式
|
||||
Style_LightBlack = 8, //浅黑色样式
|
||||
Style_DarkBlack = 9, //深黑色样式
|
||||
Style_PSBlack = 10, //PS黑色样式
|
||||
Style_FlatBlack = 11, //黑色扁平样式
|
||||
Style_FlatWhite = 12, //白色扁平样式
|
||||
Style_FlatBlue = 13, //蓝色扁平样式
|
||||
Style_Purple = 14, //紫色样式
|
||||
Style_BlackBlue = 15, //黑蓝色样式
|
||||
Style_BlackVideo = 16 //视频监控黑色样式
|
||||
Style_Silvery = 0, //银色样式
|
||||
Style_Blue = 1, //蓝色样式
|
||||
Style_LightBlue = 2, //淡蓝色样式
|
||||
Style_DarkBlue = 3, //深蓝色样式
|
||||
Style_Gray = 4, //灰色样式
|
||||
Style_LightGray = 5, //浅灰色样式
|
||||
Style_DarkGray = 6, //深灰色样式
|
||||
Style_Black = 7, //黑色样式
|
||||
Style_LightBlack = 8, //浅黑色样式
|
||||
Style_DarkBlack = 9, //深黑色样式
|
||||
Style_PSBlack = 10, //PS黑色样式
|
||||
Style_FlatBlack = 11, //黑色扁平样式
|
||||
Style_FlatWhite = 12, //白色扁平样式
|
||||
Style_FlatBlue = 13, //蓝色扁平样式
|
||||
Style_Purple = 14, //紫色样式
|
||||
Style_BlackBlue = 15, //黑蓝色样式
|
||||
Style_BlackVideo = 16 //视频监控黑色样式
|
||||
};
|
||||
|
||||
public:
|
||||
@@ -125,11 +125,11 @@ private:
|
||||
QVBoxLayout *verticalLayout3;
|
||||
|
||||
private:
|
||||
QString title; //标题
|
||||
Qt::Alignment alignment; //标题文本对齐
|
||||
bool minHide; //最小化隐藏
|
||||
bool exitAll; //退出整个程序
|
||||
QWidget *mainWidget; //主窗体对象
|
||||
QString title; //标题
|
||||
Qt::Alignment alignment;//标题文本对齐
|
||||
bool minHide; //最小化隐藏
|
||||
bool exitAll; //退出整个程序
|
||||
QWidget *mainWidget; //主窗体对象
|
||||
|
||||
public:
|
||||
QLabel *getLabIco() const;
|
||||
@@ -148,9 +148,9 @@ public:
|
||||
QSize minimumSizeHint() const;
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void changeStyle(); //更换样式
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void changeStyle(); //更换样式
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Min_clicked();
|
||||
@@ -202,6 +202,7 @@ public:
|
||||
~QUIMessageBox();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
void closeEvent(QCloseEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
@@ -213,7 +214,7 @@ private:
|
||||
QHBoxLayout *horizontalLayout3;
|
||||
QLabel *labIco;
|
||||
QLabel *labTitle;
|
||||
QLabel *labTime;
|
||||
QLabel *labCountDown;
|
||||
QWidget *widgetMenu;
|
||||
QHBoxLayout *horizontalLayout4;
|
||||
QPushButton *btnMenu_Close;
|
||||
@@ -231,13 +232,13 @@ private:
|
||||
QPushButton *btnCancel;
|
||||
|
||||
private:
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
@@ -245,6 +246,7 @@ private slots:
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIconMain(const QChar &str, quint32 size = 12);
|
||||
void setIconMsg(const QString &png, const QChar &str);
|
||||
void setMessage(const QString &msg, int type, int closeSec = 0);
|
||||
};
|
||||
|
||||
@@ -259,6 +261,7 @@ public:
|
||||
~QUITipBox();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
void closeEvent(QCloseEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
@@ -270,7 +273,7 @@ private:
|
||||
QHBoxLayout *horizontalLayout2;
|
||||
QLabel *labIco;
|
||||
QLabel *labTitle;
|
||||
QLabel *labTime;
|
||||
QLabel *labCountDown;
|
||||
QWidget *widgetMenu;
|
||||
QHBoxLayout *horizontalLayout;
|
||||
QPushButton *btnMenu_Close;
|
||||
@@ -282,13 +285,13 @@ private:
|
||||
bool fullScreen;
|
||||
|
||||
private:
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Close_clicked();
|
||||
@@ -323,7 +326,7 @@ private:
|
||||
QHBoxLayout *horizontalLayout1;
|
||||
QLabel *labIco;
|
||||
QLabel *labTitle;
|
||||
QLabel *labTime;
|
||||
QLabel *labCountDown;
|
||||
QWidget *widgetMenu;
|
||||
QHBoxLayout *horizontalLayout2;
|
||||
QPushButton *btnMenu_Close;
|
||||
@@ -340,14 +343,14 @@ private:
|
||||
QPushButton *btnCancel;
|
||||
|
||||
private:
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
QString value; //当前值
|
||||
int closeSec; //总显示时间
|
||||
int currentSec; //当前已显示时间
|
||||
QString value; //当前值
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void checkSec(); //校验倒计时
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
@@ -375,6 +378,7 @@ public:
|
||||
~QUIDateSelect();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
@@ -400,13 +404,13 @@ private:
|
||||
QDateTimeEdit *dateEnd;
|
||||
|
||||
private:
|
||||
QString startDateTime; //开始时间
|
||||
QString endDateTime; //结束时间
|
||||
QString format; //日期时间格式
|
||||
QString startDateTime; //开始时间
|
||||
QString endDateTime; //结束时间
|
||||
QString format; //日期时间格式
|
||||
|
||||
private slots:
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
void initControl(); //初始化控件
|
||||
void initForm(); //初始化窗体
|
||||
|
||||
private slots:
|
||||
void on_btnOk_clicked();
|
||||
@@ -595,6 +599,9 @@ public:
|
||||
//初始化文件,不存在则拷贝
|
||||
static void initFile(const QString &sourceName, const QString &targetName);
|
||||
|
||||
//设置图标到按钮
|
||||
static void setIconBtn(QAbstractButton *btn, const QString &png, const QChar &str);
|
||||
|
||||
//新建目录
|
||||
static void newDir(const QString &dirName);
|
||||
|
||||
@@ -653,6 +660,10 @@ public:
|
||||
//判断是否是合法的邮箱地址
|
||||
static bool isEmail(const QString &email);
|
||||
|
||||
//IP地址字符串与整型转换
|
||||
static QString ipv4IntToString(quint32 ip);
|
||||
static quint32 ipv4StringToInt(const QString &ip);
|
||||
|
||||
//16进制字符串转10进制
|
||||
static int strHexToDecimal(const QString &strHex);
|
||||
//10进制字符串转10进制
|
||||
@@ -755,7 +766,9 @@ public:
|
||||
static bool isWebOk();
|
||||
|
||||
//初始化表格
|
||||
static void initTableView(QTableView *tableView, int rowHeight = 25, bool headVisible = false, bool edit = false);
|
||||
static void initTableView(QTableView *tableView, int rowHeight = 25,
|
||||
bool headVisible = false, bool edit = false,
|
||||
bool stretchLast = true);
|
||||
|
||||
//弹出框
|
||||
static int showMessageBox(const QString &info, int type = 0, int closeSec = 0, bool exec = false);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="txtNtpIP">
|
||||
<property name="text">
|
||||
<string>ntp1.aliyun.com</string>
|
||||
<string>133.100.11.8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
/**
|
||||
* Ntp校时类 作者:feiyangqingyun(QQ:517216493) 2017-2-16
|
||||
* 1:可设置Ntp服务器IP地址
|
||||
* 2:收到时间信号发出
|
||||
* 1. 可设置Ntp服务器IP地址
|
||||
* 2. 收到时间信号发出
|
||||
*/
|
||||
|
||||
#include <QObject>
|
||||
@@ -12,13 +12,7 @@
|
||||
class QUdpSocket;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT NtpClient : public QObject
|
||||
class Q_DECL_EXPORT NtpClient : public QObject
|
||||
#else
|
||||
class NtpClient : public QObject
|
||||
#endif
|
||||
@@ -45,10 +39,8 @@ signals:
|
||||
public slots:
|
||||
//设置NTP服务器IP
|
||||
void setNtpIP(const QString &ntpIP);
|
||||
|
||||
//获取日期时间
|
||||
void getDateTime();
|
||||
|
||||
};
|
||||
|
||||
#endif // NTPCLIENT_H
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
HEADERS += \
|
||||
$$PWD/appinit.h \
|
||||
$$PWD/iconhelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/appinit.cpp \
|
||||
$$PWD/iconhelper.cpp
|
||||
@@ -1,58 +0,0 @@
|
||||
#include "appinit.h"
|
||||
#include "qmutex.h"
|
||||
#include "qapplication.h"
|
||||
#include "qevent.h"
|
||||
#include "qwidget.h"
|
||||
|
||||
QScopedPointer<AppInit> AppInit::self;
|
||||
AppInit *AppInit::Instance()
|
||||
{
|
||||
if (self.isNull()) {
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (self.isNull()) {
|
||||
self.reset(new AppInit);
|
||||
}
|
||||
}
|
||||
|
||||
return self.data();
|
||||
}
|
||||
|
||||
AppInit::AppInit(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool AppInit::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
QWidget *w = (QWidget *)watched;
|
||||
if (!w->property("canMove").toBool()) {
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
static QPoint mousePoint;
|
||||
static bool mousePressed = false;
|
||||
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
mousePressed = true;
|
||||
mousePoint = mouseEvent->globalPos() - w->pos();
|
||||
return true;
|
||||
}
|
||||
} else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
|
||||
mousePressed = false;
|
||||
return true;
|
||||
} else if (mouseEvent->type() == QEvent::MouseMove) {
|
||||
if (mousePressed && (mouseEvent->buttons() && Qt::LeftButton)) {
|
||||
w->move(mouseEvent->globalPos() - mousePoint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void AppInit::start()
|
||||
{
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef APPINIT_H
|
||||
#define APPINIT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class AppInit : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static AppInit *Instance();
|
||||
explicit AppInit(QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
static QScopedPointer<AppInit> self;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
};
|
||||
|
||||
#endif // APPINIT_H
|
||||
@@ -1,240 +0,0 @@
|
||||
#include "iconhelper.h"
|
||||
|
||||
QScopedPointer<IconHelper> IconHelper::self;
|
||||
IconHelper *IconHelper::Instance()
|
||||
{
|
||||
if (self.isNull()) {
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (self.isNull()) {
|
||||
self.reset(new IconHelper);
|
||||
}
|
||||
}
|
||||
|
||||
return self.data();
|
||||
}
|
||||
|
||||
IconHelper::IconHelper(QObject *parent) : QObject(parent)
|
||||
{
|
||||
//判断图形字体是否存在,不存在则加入
|
||||
QFontDatabase fontDb;
|
||||
if (!fontDb.families().contains("FontAwesome")) {
|
||||
int fontId = fontDb.addApplicationFont(":/image/fontawesome-webfont.ttf");
|
||||
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
||||
if (fontName.count() == 0) {
|
||||
qDebug() << "load fontawesome-webfont.ttf error";
|
||||
}
|
||||
}
|
||||
|
||||
if (fontDb.families().contains("FontAwesome")) {
|
||||
iconFont = QFont("FontAwesome");
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0))
|
||||
iconFont.setHintingPreference(QFont::PreferNoHinting);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void IconHelper::setIcon(QLabel *lab, const QChar &str, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
lab->setFont(iconFont);
|
||||
lab->setText(str);
|
||||
}
|
||||
|
||||
void IconHelper::setIcon(QAbstractButton *btn, const QChar &str, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
btn->setFont(iconFont);
|
||||
btn->setText(str);
|
||||
}
|
||||
|
||||
QPixmap IconHelper::getPixmap(const QColor &color, const QChar &str, quint32 size,
|
||||
quint32 pixWidth, quint32 pixHeight, int flags)
|
||||
{
|
||||
QPixmap pix(pixWidth, pixHeight);
|
||||
pix.fill(Qt::transparent);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&pix);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
painter.setPen(color);
|
||||
|
||||
iconFont.setPixelSize(size);
|
||||
painter.setFont(iconFont);
|
||||
painter.drawText(pix.rect(), flags, str);
|
||||
painter.end();
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
QPixmap IconHelper::getPixmap(QToolButton *btn, bool normal)
|
||||
{
|
||||
QPixmap pix;
|
||||
int index = btns.indexOf(btn);
|
||||
|
||||
if (index >= 0) {
|
||||
if (normal) {
|
||||
pix = pixNormal.at(index);
|
||||
} else {
|
||||
pix = pixDark.at(index);
|
||||
}
|
||||
}
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QWidget *widget, const QString &type, int borderWidth, const QString &borderColor,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
{
|
||||
QString strBorder;
|
||||
if (type == "top") {
|
||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding:%1px %2px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "right") {
|
||||
strBorder = QString("border-width:0px %1px 0px 0px;padding:%2px %1px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "bottom") {
|
||||
strBorder = QString("border-width:0px 0px %1px 0px;padding:%2px %2px %1px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "left") {
|
||||
strBorder = QString("border-width:0px 0px 0px %1px;padding:%2px %2px %2px %1px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
}
|
||||
|
||||
QStringList qss;
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:none;border-radius:0px;padding:5px;color:%2;background:%3;}")
|
||||
.arg(type).arg(normalTextColor).arg(normalBgColor));
|
||||
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton:hover,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:pressed,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:checked{"
|
||||
"border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
||||
.arg(type).arg(strBorder).arg(borderColor).arg(darkTextColor).arg(darkBgColor));
|
||||
|
||||
widget->setStyleSheet(qss.join(""));
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &type, int borderWidth, const QString &borderColor,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
{
|
||||
int btnCount = btns.count();
|
||||
int charCount = pixChar.count();
|
||||
if (btnCount <= 0 || charCount <= 0 || btnCount != charCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString strBorder;
|
||||
if (type == "top") {
|
||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding:%1px %2px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "right") {
|
||||
strBorder = QString("border-width:0px %1px 0px 0px;padding:%2px %1px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "bottom") {
|
||||
strBorder = QString("border-width:0px 0px %1px 0px;padding:%2px %2px %1px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "left") {
|
||||
strBorder = QString("border-width:0px 0px 0px %1px;padding:%2px %2px %2px %1px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
}
|
||||
|
||||
//如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色
|
||||
QStringList qss;
|
||||
if (btns.at(0)->toolButtonStyle() == Qt::ToolButtonTextBesideIcon) {
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:solid;border-radius:0px;%2border-color:%3;color:%4;background:%5;}")
|
||||
.arg(type).arg(strBorder).arg(normalBgColor).arg(normalTextColor).arg(normalBgColor));
|
||||
} else {
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:none;border-radius:0px;padding:5px;color:%2;background:%3;}")
|
||||
.arg(type).arg(normalTextColor).arg(normalBgColor));
|
||||
}
|
||||
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton:hover,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:pressed,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:checked{"
|
||||
"border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
||||
.arg(type).arg(strBorder).arg(borderColor).arg(darkTextColor).arg(darkBgColor));
|
||||
|
||||
qss.append(QString("QWidget#%1{background:%2;}").arg(widget->objectName()).arg(normalBgColor));
|
||||
|
||||
qss.append(QString("QWidget>QToolButton{border-width:0px;}"));
|
||||
qss.append(QString("QWidget>QToolButton{background-color:%1;color:%2;}")
|
||||
.arg(normalBgColor).arg(normalTextColor));
|
||||
qss.append(QString("QWidget>QToolButton:hover,QWidget>QToolButton:pressed,QWidget>QToolButton:checked{background-color:%1;color:%2;}")
|
||||
.arg(darkBgColor).arg(darkTextColor));
|
||||
|
||||
widget->setStyleSheet(qss.join(""));
|
||||
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
|
||||
btns.at(i)->setIcon(QIcon(pixNormal));
|
||||
btns.at(i)->setIconSize(QSize(iconWidth, iconHeight));
|
||||
btns.at(i)->installEventFilter(this);
|
||||
|
||||
this->btns.append(btns.at(i));
|
||||
this->pixNormal.append(pixNormal);
|
||||
this->pixDark.append(pixDark);
|
||||
}
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
{
|
||||
int btnCount = btns.count();
|
||||
int charCount = pixChar.count();
|
||||
if (btnCount <= 0 || charCount <= 0 || btnCount != charCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList qss;
|
||||
qss.append(QString("QFrame>QToolButton{border-style:none;border-width:0px;}"));
|
||||
qss.append(QString("QFrame>QToolButton{background-color:%1;color:%2;}")
|
||||
.arg(normalBgColor).arg(normalTextColor));
|
||||
qss.append(QString("QFrame>QToolButton:hover,QFrame>QToolButton:pressed,QFrame>QToolButton:checked{background-color:%1;color:%2;}")
|
||||
.arg(darkBgColor).arg(darkTextColor));
|
||||
|
||||
frame->setStyleSheet(qss.join(""));
|
||||
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
|
||||
btns.at(i)->setIcon(QIcon(pixNormal));
|
||||
btns.at(i)->setIconSize(QSize(iconWidth, iconHeight));
|
||||
btns.at(i)->installEventFilter(this);
|
||||
|
||||
this->btns.append(btns.at(i));
|
||||
this->pixNormal.append(pixNormal);
|
||||
this->pixDark.append(pixDark);
|
||||
}
|
||||
}
|
||||
|
||||
bool IconHelper::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched->inherits("QToolButton")) {
|
||||
QToolButton *btn = (QToolButton *)watched;
|
||||
int index = btns.indexOf(btn);
|
||||
if (index >= 0) {
|
||||
if (event->type() == QEvent::Enter) {
|
||||
btn->setIcon(QIcon(pixDark.at(index)));
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
if (btn->isChecked()) {
|
||||
btn->setIcon(QIcon(pixDark.at(index)));
|
||||
} else {
|
||||
btn->setIcon(QIcon(pixNormal.at(index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef ICONHELPER_H
|
||||
#define ICONHELPER_H
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
//图形字体处理类
|
||||
class IconHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static IconHelper *Instance();
|
||||
explicit IconHelper(QObject *parent = 0);
|
||||
|
||||
void setIcon(QLabel *lab, const QChar &str, quint32 size = 12);
|
||||
void setIcon(QAbstractButton *btn, const QChar &str, quint32 size = 12);
|
||||
QPixmap getPixmap(const QColor &color, const QChar &str, quint32 size = 12,
|
||||
quint32 pixWidth = 15, quint32 pixHeight = 15,
|
||||
int flags = Qt::AlignCenter);
|
||||
|
||||
//根据按钮获取该按钮对应的图标
|
||||
QPixmap getPixmap(QToolButton *btn, bool normal);
|
||||
|
||||
//指定导航面板样式,不带图标
|
||||
static void setStyle(QWidget *widget, const QString &type = "left", int borderWidth = 3,
|
||||
const QString &borderColor = "#029FEA",
|
||||
const QString &normalBgColor = "#292F38",
|
||||
const QString &darkBgColor = "#1D2025",
|
||||
const QString &normalTextColor = "#54626F",
|
||||
const QString &darkTextColor = "#FDFDFD");
|
||||
|
||||
//指定导航面板样式,带图标和效果切换
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &type = "left", int borderWidth = 3,
|
||||
const QString &borderColor = "#029FEA",
|
||||
const QString &normalBgColor = "#292F38",
|
||||
const QString &darkBgColor = "#1D2025",
|
||||
const QString &normalTextColor = "#54626F",
|
||||
const QString &darkTextColor = "#FDFDFD");
|
||||
|
||||
//指定导航按钮样式,带图标和效果切换
|
||||
void setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &normalBgColor = "#2FC5A2",
|
||||
const QString &darkBgColor = "#3EA7E9",
|
||||
const QString &normalTextColor = "#EEEEEE",
|
||||
const QString &darkTextColor = "#FFFFFF");
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
static QScopedPointer<IconHelper> self;
|
||||
QFont iconFont; //图形字体
|
||||
QList<QToolButton *> btns; //按钮队列
|
||||
QList<QPixmap> pixNormal; //正常图片队列
|
||||
QList<QPixmap> pixDark; //加深图片队列
|
||||
};
|
||||
#endif // ICONHELPER_H
|
||||
@@ -1,8 +0,0 @@
|
||||
FORMS += \
|
||||
$$PWD/frmmain.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/frmmain.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/frmmain.cpp
|
||||
@@ -1,941 +0,0 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "frmmain.h"
|
||||
#include "ui_frmmain.h"
|
||||
#include "iconhelper.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
frmMain::frmMain(QWidget *parent) : QDialog(parent), ui(new Ui::frmMain)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->initForm();
|
||||
}
|
||||
|
||||
frmMain::~frmMain()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool frmMain::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
if (watched == ui->widgetTitle) {
|
||||
on_btnMenu_Max_clicked();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void frmMain::initForm()
|
||||
{
|
||||
this->setProperty("form", true);
|
||||
this->setProperty("canMove", true);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint |
|
||||
Qt::WindowMinMaxButtonsHint);
|
||||
IconHelper::Instance()->setIcon(ui->btnMenu_Min, QChar(0xf068));
|
||||
IconHelper::Instance()->setIcon(ui->btnMenu_Max, QChar(0xf067));
|
||||
IconHelper::Instance()->setIcon(ui->btnMenu_Close, QChar(0xf00d));
|
||||
//ui->widgetMenu->setVisible(false);
|
||||
ui->widgetTitle->installEventFilter(this);
|
||||
ui->widgetTitle->setProperty("form", "title");
|
||||
ui->widgetTop->setProperty("nav", "top");
|
||||
ui->labTitle->setText("压力单位转换工具");
|
||||
ui->labTitle->setFont(QFont("Microsoft Yahei", 20));
|
||||
this->setWindowTitle(ui->labTitle->text());
|
||||
ui->stackedWidget->setStyleSheet("QLabel{font:20pt;}QLineEdit{font:20pt;}QPushButton{font:20pt;}QSpinBox{font:20pt;}");
|
||||
//单独设置指示器大小
|
||||
int addWidth = 20;
|
||||
int addHeight = 10;
|
||||
int rbtnWidth = 15;
|
||||
int ckWidth = 13;
|
||||
int scrWidth = 12;
|
||||
int borderWidth = 3;
|
||||
QStringList qss;
|
||||
qss.append(
|
||||
QString("QComboBox::drop-down,QDateEdit::drop-down,QTimeEdit::drop-down,QDateTimeEdit::drop-down{width:%1px;}").arg(
|
||||
addWidth));
|
||||
qss.append(
|
||||
QString("QComboBox::down-arrow,QDateEdit[calendarPopup=\"true\"]::down-arrow,QTimeEdit[calendarPopup=\"true\"]::down-arrow,"
|
||||
"QDateTimeEdit[calendarPopup=\"true\"]::down-arrow{width:%1px;height:%1px;right:2px;}").arg(
|
||||
addHeight));
|
||||
qss.append(QString("QRadioButton::indicator{width:%1px;height:%1px;}").arg(rbtnWidth));
|
||||
qss.append(
|
||||
QString("QCheckBox::indicator,QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{width:%1px;height:%1px;}").arg(
|
||||
ckWidth));
|
||||
qss.append(
|
||||
QString("QScrollBar:horizontal{min-height:%1px;border-radius:%2px;}QScrollBar::handle:horizontal{border-radius:%2px;}"
|
||||
"QScrollBar:vertical{min-width:%1px;border-radius:%2px;}QScrollBar::handle:vertical{border-radius:%2px;}").arg(
|
||||
scrWidth).arg(scrWidth / 2));
|
||||
qss.append(QString("QWidget#widget_top>QToolButton:pressed,QWidget#widget_top>QToolButton:hover,"
|
||||
"QWidget#widget_top>QToolButton:checked,QWidget#widget_top>QLabel:hover{"
|
||||
"border-width:0px 0px %1px 0px;}").arg(borderWidth));
|
||||
qss.append(QString("QWidget#widgetleft>QPushButton:checked,QWidget#widgetleft>QToolButton:checked,"
|
||||
"QWidget#widgetleft>QPushButton:pressed,QWidget#widgetleft>QToolButton:pressed{"
|
||||
"border-width:0px 0px 0px %1px;}").arg(borderWidth));
|
||||
this->setStyleSheet(qss.join(""));
|
||||
QSize icoSize(32, 32);
|
||||
int icoWidth = 85;
|
||||
//设置顶部导航按钮
|
||||
QList<QToolButton *> tbtns = ui->widgetTop->findChildren<QToolButton *>();
|
||||
|
||||
foreach (QToolButton *btn, tbtns) {
|
||||
btn->setIconSize(icoSize);
|
||||
btn->setMinimumWidth(icoWidth);
|
||||
btn->setCheckable(true);
|
||||
connect(btn, SIGNAL(clicked()), this, SLOT(buttonClick()));
|
||||
}
|
||||
|
||||
QList<QLineEdit *> ledits = ui->page1->findChildren<QLineEdit *>();
|
||||
|
||||
foreach (QLineEdit *ledit, ledits) {
|
||||
connect(ledit, SIGNAL(textEdited(const QString)), this, SLOT(doTextEdited(const QString)));
|
||||
}
|
||||
|
||||
ui->btnMain->click();
|
||||
on_spinBox_rbit_valueChanged(1);
|
||||
}
|
||||
|
||||
void frmMain::buttonClick()
|
||||
{
|
||||
QToolButton *b = (QToolButton *)sender();
|
||||
QString name = b->text();
|
||||
QList<QToolButton *> tbtns = ui->widgetTop->findChildren<QToolButton *>();
|
||||
|
||||
foreach (QToolButton *btn, tbtns) {
|
||||
if (btn == b) {
|
||||
btn->setChecked(true);
|
||||
} else {
|
||||
btn->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "主界面") {
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
} else if (name == "用户退出") {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void frmMain::doTextEdited(const QString str)
|
||||
{
|
||||
QLineEdit *l = (QLineEdit *)sender();
|
||||
QList<QLineEdit *> ledits = ui->page1->findChildren<QLineEdit *>();
|
||||
//转换前单位
|
||||
QString beforeName = l->objectName();
|
||||
//转换前数值
|
||||
double beforeValue = l->text().toDouble();
|
||||
|
||||
foreach (QLineEdit *ledit, ledits) {
|
||||
//转换后单位
|
||||
QString curName = ledit->objectName();
|
||||
|
||||
if (ledit == l) {
|
||||
} else if (curName == "lineEdit_bar") {
|
||||
//巴 (bar)
|
||||
if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.01, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
qDebug() << outStr;
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 1.01325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.0004788, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.03386388, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00009807, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 10, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00133322, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.06894757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00009807, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_kpa") {
|
||||
//千帕 (kPa)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 100.0, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 101.325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.04788026, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 3.38638816, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 1000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.13332237, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 6.894757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 98.0665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mbar") {
|
||||
//毫巴 (mbar)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1000.0, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 10, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1013.25, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.47880257, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 33.86388158, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.01, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1.33322368, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 68.94757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 980.665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_unit") {
|
||||
//标准大气压
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.98692327, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00986923, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00098692, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00047254, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.03342105, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00009678, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 9.86923267, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00098692, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00000987, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00131579, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.06804596, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.96784111, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00009678, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_feet") {
|
||||
//磅力/英尺2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2088.54351212, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 20.88543512, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2.08854351, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2116.21671366, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 70.72619017, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 0.20481615, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 20885.43512121, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2.08854351, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 0.02088544, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2.78449568, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 144, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2048.16152331, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 0.20481615, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_british_hg") {
|
||||
//英吋汞柱
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 29.52998751, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.29529988, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.02952999, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 29.92125984, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.01413903, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.0028959, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 295.29987508, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.02952999, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.0002953, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.03937008, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 2.03602088, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 28.9590252, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.0028959, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10197.16212978, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 101.9716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10332.274528, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 4.88242743, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 345.3154908, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 101971.62129779, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 0.10197162, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 13.59509806, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 703.06954974, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.101325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00004788, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00338639, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00000981, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.000001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00013332, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00689476, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_hpa") {
|
||||
//百帕 (hPa)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到百帕 (hPa)
|
||||
QString outStr = QString::number(beforeValue * 1000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 10, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 1013.25, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.47880257, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 33.86388158, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.01, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 1.33322368, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 68.94757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 980.665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_pascal") {
|
||||
//帕斯卡
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 100000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 1000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 100, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 101325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 47.88025694, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 3386.38815789, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 9.80665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 1000000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 100, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 133.32236842, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 6894.757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 98066.5, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 9.80665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 750.0616827, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 7.50061683, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 0.75006168, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 760, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.35913146, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 25.4, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.07355592, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 7500.61682704, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.75006168, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.00750062, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 51.71493037, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 735.55924007, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 0.07355592, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_cmz") {
|
||||
//磅力/英寸2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 14.50377439, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.14503774, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.01450377, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 14.6959494, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00694444, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.4911541, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00142233, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 145.0377439, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.01450377, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00014504, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.01933678, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 14.22334391, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00142233, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 1.01971621, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.01019716, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00101972, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 1.03322745, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00048824, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.03453155, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00101972, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.0000102, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00135951, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.07030695, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 10197.16212978, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 101.9716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10332.274528, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 4.88242743, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 345.3154908, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 101971.62129779, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 0.10197162, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 13.59509806, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 703.06954974, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void frmMain::on_btnMenu_Min_clicked()
|
||||
{
|
||||
showMinimized();
|
||||
}
|
||||
void frmMain::on_btnMenu_Max_clicked()
|
||||
{
|
||||
static bool max = false;
|
||||
static QRect location = this->geometry();
|
||||
|
||||
if (max) {
|
||||
this->setGeometry(location);
|
||||
} else {
|
||||
location = this->geometry();
|
||||
this->setGeometry(qApp->desktop()->availableGeometry());
|
||||
}
|
||||
|
||||
this->setProperty("canMove", max);
|
||||
max = !max;
|
||||
}
|
||||
void frmMain::on_btnMenu_Close_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
void frmMain::on_spinBox_rbit_valueChanged(int arg1)
|
||||
{
|
||||
numOfDecimalPoints = arg1;
|
||||
QList<QLineEdit *> ledits = ui->page1->findChildren<QLineEdit *>();
|
||||
|
||||
foreach (QLineEdit *ledit, ledits) {
|
||||
ledit->setValidator(new QDoubleValidator(0, __DBL_MAX__, arg1, this));
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef FRMMAIN_H
|
||||
#define FRMMAIN_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class frmMain;
|
||||
}
|
||||
|
||||
class frmMain : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit frmMain(QWidget *parent = 0);
|
||||
~frmMain();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
Ui::frmMain *ui;
|
||||
int numOfDecimalPoints;
|
||||
|
||||
private slots:
|
||||
void initForm();
|
||||
void buttonClick();
|
||||
void doTextEdited(const QString);
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Min_clicked();
|
||||
void on_btnMenu_Max_clicked();
|
||||
void on_btnMenu_Close_clicked();
|
||||
void on_spinBox_rbit_valueChanged(int arg1);
|
||||
};
|
||||
|
||||
#endif // UIDEMO01_H
|
||||
@@ -1,506 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>frmMain</class>
|
||||
<widget class="QDialog" name="frmMain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="widgetTitle" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</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="labIco">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../other/main.qrc">:/image/logo.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetTop" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<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="QToolButton" name="btnMain">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>主界面</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../other/main.qrc">
|
||||
<normaloff>:/image/main_main.png</normaloff>:/image/main_main.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnExit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>用户退出</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../other/main.qrc">
|
||||
<normaloff>:/image/main_exit.png</normaloff>:/image/main_exit.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetMenu" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<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>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="btnMenu_Min">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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>30</width>
|
||||
<height>30</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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="btnMenu_Max">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>104</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_rbit">
|
||||
<property name="text">
|
||||
<string>小数点保留位</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_bar">
|
||||
<property name="text">
|
||||
<string>巴 (bar)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_kpa">
|
||||
<property name="text">
|
||||
<string>千帕 (kPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mbar">
|
||||
<property name="text">
|
||||
<string>毫巴 (mbar)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_unit">
|
||||
<property name="text">
|
||||
<string>标准大气压</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_feet">
|
||||
<property name="text">
|
||||
<string>磅力/英尺2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_british_hg">
|
||||
<property name="text">
|
||||
<string>英吋汞柱</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_kilogram_force">
|
||||
<property name="text">
|
||||
<string>公斤力/米2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_rbit">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_bar"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_kpa"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mbar"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_unit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_feet"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_british_hg"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_kilogram_force"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mpa">
|
||||
<property name="text">
|
||||
<string>兆帕 (MPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_hpa">
|
||||
<property name="text">
|
||||
<string>百帕 (hPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pascal">
|
||||
<property name="text">
|
||||
<string>帕斯卡</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mmhg">
|
||||
<property name="text">
|
||||
<string>毫米汞柱 (托)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_cmz">
|
||||
<property name="text">
|
||||
<string>磅力/英寸2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_kgf_cm2">
|
||||
<property name="text">
|
||||
<string>公斤力/厘米2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mm_water_column">
|
||||
<property name="text">
|
||||
<string>毫米水柱</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mpa"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_hpa"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pascal"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mmhg"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_cmz"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_kgf_cm2"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mm_water_column"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>104</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../other/main.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,51 +0,0 @@
|
||||
#include "frmmain.h"
|
||||
#include "appinit.h"
|
||||
#include "qapplication.h"
|
||||
#include "qtextcodec.h"
|
||||
#include "qfile.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
/* 压力单位转换工具
|
||||
* 10种以上不同压力单位间的快速转换(具有转换的单位,以及转换的系数)
|
||||
* 实时单位转换
|
||||
* 小数点保留位可设(1-10)
|
||||
* 所有压力单位同时显示在界面上
|
||||
* 不需要转换按钮输入时,输入实时转换
|
||||
* 检查输入是否合法
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
a.setFont(QFont("Microsoft Yahei", 9));
|
||||
AppInit::Instance()->start();
|
||||
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
||||
#if _MSC_VER
|
||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
#endif
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
QTextCodec::setCodecForCStrings(codec);
|
||||
QTextCodec::setCodecForTr(codec);
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
#endif
|
||||
|
||||
//加载样式表
|
||||
QFile file(":/qss/psblack.css");
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QString qss = QLatin1String(file.readAll());
|
||||
QString paletteColor = qss.mid(20, 7);
|
||||
qApp->setPalette(QPalette(QColor(paletteColor)));
|
||||
qApp->setStyleSheet(qss);
|
||||
file.close();
|
||||
}
|
||||
|
||||
frmMain w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,8 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>image/fontawesome-webfont.ttf</file>
|
||||
<file>image/main_exit.png</file>
|
||||
<file>image/logo.png</file>
|
||||
<file>image/main_main.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,23 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qss/psblack.css</file>
|
||||
<file>qss/psblack/add_bottom.png</file>
|
||||
<file>qss/psblack/add_left.png</file>
|
||||
<file>qss/psblack/add_right.png</file>
|
||||
<file>qss/psblack/add_top.png</file>
|
||||
<file>qss/psblack/branch_close.png</file>
|
||||
<file>qss/psblack/branch_open.png</file>
|
||||
<file>qss/psblack/calendar_nextmonth.png</file>
|
||||
<file>qss/psblack/calendar_prevmonth.png</file>
|
||||
<file>qss/psblack/checkbox_checked.png</file>
|
||||
<file>qss/psblack/checkbox_checked_disable.png</file>
|
||||
<file>qss/psblack/checkbox_parcial.png</file>
|
||||
<file>qss/psblack/checkbox_parcial_disable.png</file>
|
||||
<file>qss/psblack/checkbox_unchecked.png</file>
|
||||
<file>qss/psblack/checkbox_unchecked_disable.png</file>
|
||||
<file>qss/psblack/radiobutton_checked.png</file>
|
||||
<file>qss/psblack/radiobutton_checked_disable.png</file>
|
||||
<file>qss/psblack/radiobutton_unchecked.png</file>
|
||||
<file>qss/psblack/radiobutton_unchecked_disable.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -1,657 +0,0 @@
|
||||
QPalette{background:#444444;}*{outline:0px;color:#DCDCDC;}
|
||||
|
||||
QWidget[form="true"]{
|
||||
border:1px solid #242424;
|
||||
border-radius:0px;
|
||||
}
|
||||
|
||||
QWidget[form="bottom"]{
|
||||
background:#484848;
|
||||
}
|
||||
|
||||
QWidget[form="bottom"] .QFrame{
|
||||
border:1px solid #DCDCDC;
|
||||
}
|
||||
|
||||
QWidget[form="bottom"] QLabel,QWidget[form="title"] QLabel{
|
||||
border-radius:0px;
|
||||
color:#DCDCDC;
|
||||
background:none;
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
QWidget[form="title"],QWidget[nav="left"],QWidget[nav="top"] QAbstractButton{
|
||||
border-style:none;
|
||||
border-radius:0px;
|
||||
padding:5px;
|
||||
color:#DCDCDC;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
QWidget[nav="top"] QAbstractButton:hover,QWidget[nav="top"] QAbstractButton:pressed,QWidget[nav="top"] QAbstractButton:checked{
|
||||
border-style:solid;
|
||||
border-width:0px 0px 2px 0px;
|
||||
padding:4px 4px 2px 4px;
|
||||
border-color:#00BB9E;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
QWidget[nav="left"] QAbstractButton{
|
||||
border-radius:0px;
|
||||
color:#DCDCDC;
|
||||
background:none;
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
QWidget[nav="left"] QAbstractButton:hover{
|
||||
color:#FFFFFF;
|
||||
background-color:#00BB9E;
|
||||
}
|
||||
|
||||
QWidget[nav="left"] QAbstractButton:checked,QWidget[nav="left"] QAbstractButton:pressed{
|
||||
color:#DCDCDC;
|
||||
border-style:solid;
|
||||
border-width:0px 0px 0px 2px;
|
||||
padding:4px 4px 4px 2px;
|
||||
border-color:#00BB9E;
|
||||
background-color:#444444;
|
||||
}
|
||||
|
||||
QWidget[video="true"] QLabel{
|
||||
color:#DCDCDC;
|
||||
border:1px solid #242424;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
QWidget[video="true"] QLabel:focus{
|
||||
border:1px solid #00BB9E;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
|
||||
border:1px solid #242424;
|
||||
border-radius:3px;
|
||||
padding:2px;
|
||||
background:none;
|
||||
selection-background-color:#00BB9E;
|
||||
selection-color:#FFFFFF;
|
||||
}
|
||||
|
||||
QLineEdit:focus,QTextEdit:focus,QPlainTextEdit:focus,QSpinBox:focus,QDoubleSpinBox:focus,QComboBox:focus,QDateEdit:focus,QTimeEdit:focus,QDateTimeEdit:focus,QLineEdit:hover,QTextEdit:hover,QPlainTextEdit:hover,QSpinBox:hover,QDoubleSpinBox:hover,QComboBox:hover,QDateEdit:hover,QTimeEdit:hover,QDateTimeEdit:hover{
|
||||
border:1px solid #242424;
|
||||
}
|
||||
|
||||
QLineEdit[echoMode="2"]{
|
||||
lineedit-password-character:9679;
|
||||
}
|
||||
|
||||
.QFrame{
|
||||
border:1px solid #242424;
|
||||
border-radius:3px;
|
||||
}
|
||||
|
||||
.QGroupBox{
|
||||
border:1px solid #242424;
|
||||
border-radius:5px;
|
||||
margin-top:3ex;
|
||||
}
|
||||
|
||||
.QGroupBox::title{
|
||||
subcontrol-origin:margin;
|
||||
position:relative;
|
||||
left:10px;
|
||||
}
|
||||
|
||||
.QPushButton,.QToolButton{
|
||||
border-style:none;
|
||||
border:1px solid #242424;
|
||||
color:#DCDCDC;
|
||||
padding:5px;
|
||||
min-height:15px;
|
||||
border-radius:5px;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
.QPushButton:hover,.QToolButton:hover{
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
.QPushButton:pressed,.QToolButton:pressed{
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
.QToolButton::menu-indicator{
|
||||
image:None;
|
||||
}
|
||||
|
||||
QToolButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
|
||||
border-radius:3px;
|
||||
color:#DCDCDC;
|
||||
padding:3px;
|
||||
margin:0px;
|
||||
background:none;
|
||||
border-style:none;
|
||||
}
|
||||
|
||||
QToolButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
|
||||
color:#FFFFFF;
|
||||
margin:1px 1px 2px 1px;
|
||||
background-color:rgba(51,127,209,230);
|
||||
}
|
||||
|
||||
QPushButton#btnMenu_Close:hover{
|
||||
color:#FFFFFF;
|
||||
margin:1px 1px 2px 1px;
|
||||
background-color:rgba(238,0,0,128);
|
||||
}
|
||||
|
||||
QRadioButton::indicator{
|
||||
width:15px;
|
||||
height:15px;
|
||||
}
|
||||
|
||||
QRadioButton::indicator::unchecked{
|
||||
image:url(:/qss/psblack/radiobutton_unchecked.png);
|
||||
}
|
||||
|
||||
QRadioButton::indicator::unchecked:disabled{
|
||||
image:url(:/qss/psblack/radiobutton_unchecked_disable.png);
|
||||
}
|
||||
|
||||
QRadioButton::indicator::checked{
|
||||
image:url(:/qss/psblack/radiobutton_checked.png);
|
||||
}
|
||||
|
||||
QRadioButton::indicator::checked:disabled{
|
||||
image:url(:/qss/psblack/radiobutton_checked_disable.png);
|
||||
}
|
||||
|
||||
QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{
|
||||
padding:0px -3px 0px 0px;
|
||||
}
|
||||
|
||||
QCheckBox::indicator,QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{
|
||||
width:13px;
|
||||
height:13px;
|
||||
}
|
||||
|
||||
QCheckBox::indicator:unchecked,QGroupBox::indicator:unchecked,QTreeWidget::indicator:unchecked,QListWidget::indicator:unchecked{
|
||||
image:url(:/qss/psblack/checkbox_unchecked.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:unchecked:disabled,QGroupBox::indicator:unchecked:disabled,QTreeWidget::indicator:unchecked:disabled,QListWidget::indicator:disabled{
|
||||
image:url(:/qss/psblack/checkbox_unchecked_disable.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked,QGroupBox::indicator:checked,QTreeWidget::indicator:checked,QListWidget::indicator:checked{
|
||||
image:url(:/qss/psblack/checkbox_checked.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:checked:disabled,QGroupBox::indicator:checked:disabled,QTreeWidget::indicator:checked:disabled,QListWidget::indicator:checked:disabled{
|
||||
image:url(:/qss/psblack/checkbox_checked_disable.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:indeterminate,QGroupBox::indicator:indeterminate,QTreeWidget::indicator:indeterminate,QListWidget::indicator:indeterminate{
|
||||
image:url(:/qss/psblack/checkbox_parcial.png);
|
||||
}
|
||||
|
||||
QCheckBox::indicator:indeterminate:disabled,QGroupBox::indicator:indeterminate:disabled,QTreeWidget::indicator:indeterminate:disabled,QListWidget::indicator:indeterminate:disabled{
|
||||
image:url(:/qss/psblack/checkbox_parcial_disable.png);
|
||||
}
|
||||
|
||||
QTimeEdit::up-button,QDateEdit::up-button,QDateTimeEdit::up-button,QDoubleSpinBox::up-button,QSpinBox::up-button{
|
||||
image:url(:/qss/psblack/add_top.png);
|
||||
width:10px;
|
||||
height:10px;
|
||||
padding:2px 5px 0px 0px;
|
||||
}
|
||||
|
||||
QTimeEdit::down-button,QDateEdit::down-button,QDateTimeEdit::down-button,QDoubleSpinBox::down-button,QSpinBox::down-button{
|
||||
image:url(:/qss/psblack/add_bottom.png);
|
||||
width:10px;
|
||||
height:10px;
|
||||
padding:0px 5px 2px 0px;
|
||||
}
|
||||
|
||||
QTimeEdit::up-button:pressed,QDateEdit::up-button:pressed,QDateTimeEdit::up-button:pressed,QDoubleSpinBox::up-button:pressed,QSpinBox::up-button:pressed{
|
||||
top:-2px;
|
||||
}
|
||||
|
||||
QTimeEdit::down-button:pressed,QDateEdit::down-button:pressed,QDateTimeEdit::down-button:pressed,QDoubleSpinBox::down-button:pressed,QSpinBox::down-button:pressed,QSpinBox::down-button:pressed{
|
||||
bottom:-2px;
|
||||
}
|
||||
|
||||
QComboBox::down-arrow,QDateEdit[calendarPopup="true"]::down-arrow,QTimeEdit[calendarPopup="true"]::down-arrow,QDateTimeEdit[calendarPopup="true"]::down-arrow{
|
||||
image:url(:/qss/psblack/add_bottom.png);
|
||||
width:10px;
|
||||
height:10px;
|
||||
right:2px;
|
||||
}
|
||||
|
||||
QComboBox::drop-down,QDateEdit::drop-down,QTimeEdit::drop-down,QDateTimeEdit::drop-down{
|
||||
subcontrol-origin:padding;
|
||||
subcontrol-position:top right;
|
||||
width:15px;
|
||||
border-left-width:0px;
|
||||
border-left-style:solid;
|
||||
border-top-right-radius:3px;
|
||||
border-bottom-right-radius:3px;
|
||||
border-left-color:#242424;
|
||||
}
|
||||
|
||||
QComboBox::drop-down:on{
|
||||
top:1px;
|
||||
}
|
||||
|
||||
QMenuBar::item{
|
||||
color:#DCDCDC;
|
||||
background-color:#484848;
|
||||
margin:0px;
|
||||
padding:3px 10px;
|
||||
}
|
||||
|
||||
QMenu,QMenuBar,QMenu:disabled,QMenuBar:disabled{
|
||||
color:#DCDCDC;
|
||||
background-color:#484848;
|
||||
border:1px solid #242424;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
QMenu::item{
|
||||
padding:3px 20px;
|
||||
}
|
||||
|
||||
QMenu::indicator{
|
||||
width:13px;
|
||||
height:13px;
|
||||
}
|
||||
|
||||
QMenu::item:selected,QMenuBar::item:selected{
|
||||
color:#DCDCDC;
|
||||
border:0px solid #242424;
|
||||
background:#646464;
|
||||
}
|
||||
|
||||
QMenu::separator{
|
||||
height:1px;
|
||||
background:#242424;
|
||||
}
|
||||
|
||||
QProgressBar{
|
||||
min-height:10px;
|
||||
background:#484848;
|
||||
border-radius:5px;
|
||||
text-align:center;
|
||||
border:1px solid #484848;
|
||||
}
|
||||
|
||||
QProgressBar:chunk{
|
||||
border-radius:5px;
|
||||
background-color:#242424;
|
||||
}
|
||||
|
||||
QSlider::groove:horizontal{
|
||||
background:#484848;
|
||||
height:8px;
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
QSlider::add-page:horizontal{
|
||||
background:#484848;
|
||||
height:8px;
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
QSlider::sub-page:horizontal{
|
||||
background:#242424;
|
||||
height:8px;
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
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 #444444,stop:0.8 #242424);
|
||||
}
|
||||
|
||||
QSlider::groove:vertical{
|
||||
width:8px;
|
||||
border-radius:4px;
|
||||
background:#484848;
|
||||
}
|
||||
|
||||
QSlider::add-page:vertical{
|
||||
width:8px;
|
||||
border-radius:4px;
|
||||
background:#484848;
|
||||
}
|
||||
|
||||
QSlider::sub-page:vertical{
|
||||
width:8px;
|
||||
border-radius:4px;
|
||||
background:#242424;
|
||||
}
|
||||
|
||||
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 #444444,stop:0.8 #242424);
|
||||
}
|
||||
|
||||
QScrollBar:horizontal{
|
||||
background:#484848;
|
||||
padding:0px;
|
||||
border-radius:6px;
|
||||
max-height:12px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:horizontal{
|
||||
background:#242424;
|
||||
min-width:50px;
|
||||
border-radius:6px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:horizontal:hover{
|
||||
background:#00BB9E;
|
||||
}
|
||||
|
||||
QScrollBar::handle:horizontal:pressed{
|
||||
background:#00BB9E;
|
||||
}
|
||||
|
||||
QScrollBar::add-page:horizontal{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar::sub-page:horizontal{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar::add-line:horizontal{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar::sub-line:horizontal{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar:vertical{
|
||||
background:#484848;
|
||||
padding:0px;
|
||||
border-radius:6px;
|
||||
max-width:12px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical{
|
||||
background:#242424;
|
||||
min-height:50px;
|
||||
border-radius:6px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical:hover{
|
||||
background:#00BB9E;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical:pressed{
|
||||
background:#00BB9E;
|
||||
}
|
||||
|
||||
QScrollBar::add-page:vertical{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar::sub-page:vertical{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar::add-line:vertical{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollBar::sub-line:vertical{
|
||||
background:none;
|
||||
}
|
||||
|
||||
QScrollArea{
|
||||
border:0px;
|
||||
}
|
||||
|
||||
QTreeView,QListView,QTableView,QTabWidget::pane{
|
||||
border:1px solid #242424;
|
||||
selection-background-color:#646464;
|
||||
selection-color:#DCDCDC;
|
||||
alternate-background-color:#525252;
|
||||
gridline-color:#242424;
|
||||
}
|
||||
|
||||
QTreeView::branch:closed:has-children{
|
||||
margin:4px;
|
||||
border-image:url(:/qss/psblack/branch_open.png);
|
||||
}
|
||||
|
||||
QTreeView::branch:open:has-children{
|
||||
margin:4px;
|
||||
border-image:url(:/qss/psblack/branch_close.png);
|
||||
}
|
||||
|
||||
QTreeView,QListView,QTableView,QSplitter::handle,QTreeView::branch{
|
||||
background:#444444;
|
||||
}
|
||||
|
||||
QTableView::item:selected,QListView::item:selected,QTreeView::item:selected{
|
||||
color:#DCDCDC;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
QTableView::item:hover,QListView::item:hover,QTreeView::item:hover,QHeaderView{
|
||||
color:#DCDCDC;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
QTableView::item,QListView::item,QTreeView::item{
|
||||
padding:1px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
QHeaderView::section,QTableCornerButton:section{
|
||||
padding:3px;
|
||||
margin:0px;
|
||||
color:#DCDCDC;
|
||||
border:1px solid #242424;
|
||||
border-left-width:0px;
|
||||
border-right-width:1px;
|
||||
border-top-width:0px;
|
||||
border-bottom-width:1px;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
QTabBar::tab{
|
||||
border:1px solid #242424;
|
||||
color:#DCDCDC;
|
||||
margin:0px;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
QTabBar::tab:selected,QTabBar::tab:hover{
|
||||
border-style:solid;
|
||||
border-color:#00BB9E;
|
||||
background:#444444;
|
||||
}
|
||||
|
||||
QTabBar::tab:top,QTabBar::tab:bottom{
|
||||
padding:3px 8px 3px 8px;
|
||||
}
|
||||
|
||||
QTabBar::tab:left,QTabBar::tab:right{
|
||||
padding:8px 3px 8px 3px;
|
||||
}
|
||||
|
||||
QTabBar::tab:top:selected,QTabBar::tab:top:hover{
|
||||
border-width:2px 0px 0px 0px;
|
||||
}
|
||||
|
||||
QTabBar::tab:right:selected,QTabBar::tab:right:hover{
|
||||
border-width:0px 0px 0px 2px;
|
||||
}
|
||||
|
||||
QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{
|
||||
border-width:0px 0px 2px 0px;
|
||||
}
|
||||
|
||||
QTabBar::tab:left:selected,QTabBar::tab:left:hover{
|
||||
border-width:0px 2px 0px 0px;
|
||||
}
|
||||
|
||||
QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{
|
||||
border-left-width:1px;
|
||||
border-left-color:#242424;
|
||||
}
|
||||
|
||||
QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{
|
||||
border-top-width:1px;
|
||||
border-top-color:#242424;
|
||||
}
|
||||
|
||||
QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{
|
||||
border-right-width:1px;
|
||||
border-right-color:#242424;
|
||||
}
|
||||
|
||||
QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{
|
||||
border-bottom-width:1px;
|
||||
border-bottom-color:#242424;
|
||||
}
|
||||
|
||||
QStatusBar::item{
|
||||
border:0px solid #484848;
|
||||
border-radius:3px;
|
||||
}
|
||||
|
||||
QToolBox::tab,QGroupBox#gboxDevicePanel,QGroupBox#gboxDeviceTitle,QFrame#gboxDevicePanel,QFrame#gboxDeviceTitle{
|
||||
padding:3px;
|
||||
border-radius:5px;
|
||||
color:#DCDCDC;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
QToolTip{
|
||||
border:0px solid #DCDCDC;
|
||||
padding:1px;
|
||||
color:#DCDCDC;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
QToolBox::tab:selected{
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252);
|
||||
}
|
||||
|
||||
QPrintPreviewDialog QToolButton{
|
||||
border:0px solid #DCDCDC;
|
||||
border-radius:0px;
|
||||
margin:0px;
|
||||
padding:3px;
|
||||
background:none;
|
||||
}
|
||||
|
||||
QColorDialog QPushButton,QFileDialog QPushButton{
|
||||
min-width:80px;
|
||||
}
|
||||
|
||||
QToolButton#qt_calendar_prevmonth{
|
||||
icon-size:0px;
|
||||
min-width:20px;
|
||||
image:url(:/qss/psblack/calendar_prevmonth.png);
|
||||
}
|
||||
|
||||
QToolButton#qt_calendar_nextmonth{
|
||||
icon-size:0px;
|
||||
min-width:20px;
|
||||
image:url(:/qss/psblack/calendar_nextmonth.png);
|
||||
}
|
||||
|
||||
QToolButton#qt_calendar_prevmonth,QToolButton#qt_calendar_nextmonth,QToolButton#qt_calendar_monthbutton,QToolButton#qt_calendar_yearbutton{
|
||||
border:0px solid #DCDCDC;
|
||||
border-radius:3px;
|
||||
margin:3px 3px 3px 3px;
|
||||
padding:3px;
|
||||
background:none;
|
||||
}
|
||||
|
||||
QToolButton#qt_calendar_prevmonth:hover,QToolButton#qt_calendar_nextmonth:hover,QToolButton#qt_calendar_monthbutton:hover,QToolButton#qt_calendar_yearbutton:hover,QToolButton#qt_calendar_prevmonth:pressed,QToolButton#qt_calendar_nextmonth:pressed,QToolButton#qt_calendar_monthbutton:pressed,QToolButton#qt_calendar_yearbutton:pressed{
|
||||
border:1px solid #242424;
|
||||
}
|
||||
|
||||
QCalendarWidget QSpinBox#qt_calendar_yearedit{
|
||||
margin:2px;
|
||||
}
|
||||
|
||||
QCalendarWidget QToolButton::menu-indicator{
|
||||
image:None;
|
||||
}
|
||||
|
||||
QCalendarWidget QTableView{
|
||||
border-width:0px;
|
||||
}
|
||||
|
||||
QCalendarWidget QWidget#qt_calendar_navigationbar{
|
||||
border:1px solid #242424;
|
||||
border-width:1px 1px 0px 1px;
|
||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #484848,stop:1 #383838);
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView::item{
|
||||
min-height:20px;
|
||||
min-width:10px;
|
||||
}
|
||||
|
||||
QTableView[model="true"]::item{
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
QTableView QLineEdit,QTableView QComboBox,QTableView QSpinBox,QTableView QDoubleSpinBox,QTableView QDateEdit,QTableView QTimeEdit,QTableView QDateTimeEdit{
|
||||
border-width:0px;
|
||||
border-radius:0px;
|
||||
}
|
||||
|
||||
QTableView QLineEdit:focus,QTableView QComboBox:focus,QTableView QSpinBox:focus,QTableView QDoubleSpinBox:focus,QTableView QDateEdit:focus,QTableView QTimeEdit:focus,QTableView QDateTimeEdit:focus{
|
||||
border-width:0px;
|
||||
border-radius:0px;
|
||||
}
|
||||
|
||||
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
|
||||
background:#444444;
|
||||
}
|
||||
|
||||
QTabWidget::pane:top{top:-1px;}
|
||||
QTabWidget::pane:bottom{bottom:-1px;}
|
||||
QTabWidget::pane:left{right:-1px;}
|
||||
QTabWidget::pane:right{left:-1px;}
|
||||
|
||||
QDialog {
|
||||
background-color:#444444;
|
||||
color:#DCDCDC;
|
||||
}
|
||||
|
||||
QDialogButtonBox > QPushButton {
|
||||
min-width:50px;
|
||||
}
|
||||
|
||||
*:disabled,QMenu::item:disabled{
|
||||
background:#444444;
|
||||
border-color:#484848;
|
||||
color:#242424;
|
||||
}
|
||||
|
||||
/*TextColor:#DCDCDC*/
|
||||
/*PanelColor:#444444*/
|
||||
/*BorderColor:#242424*/
|
||||
/*NormalColorStart:#484848*/
|
||||
/*NormalColorEnd:#383838*/
|
||||
/*DarkColorStart:#646464*/
|
||||
/*DarkColorEnd:#525252*/
|
||||
/*HighColor:#00BB9E*/
|
||||
|
Before Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 177 B |
|
Before Width: | Height: | Size: 275 B |
|
Before Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 188 B |
|
Before Width: | Height: | Size: 251 B |
|
Before Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 152 B |
|
Before Width: | Height: | Size: 756 B |
|
Before Width: | Height: | Size: 932 B |
|
Before Width: | Height: | Size: 564 B |
|
Before Width: | Height: | Size: 715 B |
@@ -1,31 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2020-04-23T17:38:15
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = pressureconversioncalculator
|
||||
RC_ICONS = other/logo.ico
|
||||
TEMPLATE = app
|
||||
MOC_DIR = temp/moc
|
||||
RCC_DIR = temp/rcc
|
||||
UI_DIR = temp/ui
|
||||
OBJECTS_DIR = temp/obj
|
||||
DESTDIR = $$PWD/../bin
|
||||
|
||||
RESOURCES += other/main.qrc
|
||||
RESOURCES += other/qss.qrc
|
||||
CONFIG += warn_off
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
include ($$PWD/api/api.pri)
|
||||
include ($$PWD/form/form.pri)
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
INCLUDEPATH += $$PWD/api
|
||||
INCLUDEPATH += $$PWD/form
|
||||
|
Before Width: | Height: | Size: 53 KiB |
@@ -8,13 +8,7 @@ class QTcpSocket;
|
||||
class QTcpServer;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT SaveLog : public QObject
|
||||
class Q_DECL_EXPORT SaveLog : public QObject
|
||||
#else
|
||||
class SaveLog : public QObject
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "qfile.h"
|
||||
#include "qtextstream.h"
|
||||
#include "qstringlist.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define NEWLINE "\r\n"
|
||||
@@ -37,6 +36,7 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
|
||||
saveInterval = 1 * 60 * 1000;
|
||||
startTime = QDateTime::currentDateTime();
|
||||
|
||||
//存储运行时间定时器
|
||||
timerSave = new QTimer(this);
|
||||
timerSave->setInterval(saveInterval);
|
||||
connect(timerSave, SIGNAL(timeout()), this, SLOT(saveLog()));
|
||||
@@ -44,6 +44,9 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
|
||||
|
||||
void SaveRunTime::start()
|
||||
{
|
||||
//开始时间变量必须在这,在部分嵌入式系统上开机后的时间不准确比如是1970,而后会变成1999或者其他时间
|
||||
//会在getDiffValue函数执行很久很久
|
||||
startTime = QDateTime::currentDateTime();
|
||||
timerSave->start();
|
||||
|
||||
initLog();
|
||||
@@ -104,19 +107,16 @@ void SaveRunTime::initLog()
|
||||
QTextStream stream(&file);
|
||||
stream << line << NEWLINE;
|
||||
file.close();
|
||||
|
||||
lastID = 0;
|
||||
}
|
||||
} else {
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QString lastLine;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
lastLine = file.readLine();
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
QStringList list = lastLine.split("\t");
|
||||
lastID = list.at(0).toInt();
|
||||
}
|
||||
@@ -169,7 +169,6 @@ void SaveRunTime::saveLog()
|
||||
|
||||
//重新清空文件
|
||||
file.resize(0);
|
||||
|
||||
//如果行数小于2则返回
|
||||
if (content.count() < 2) {
|
||||
file.close();
|
||||
|
||||
@@ -6,13 +6,7 @@
|
||||
class QTimer;
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT SaveRunTime : public QObject
|
||||
class Q_DECL_EXPORT SaveRunTime : public QObject
|
||||
#else
|
||||
class SaveRunTime : public QObject
|
||||
#endif
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
/**
|
||||
* 全局截屏控件 作者:feiyangqingyun(QQ:517216493) 2016-11-11
|
||||
* 1:支持鼠标右键选择菜单
|
||||
* 2:支持全局截屏和局部截屏
|
||||
* 3:支持图片另存为
|
||||
* 1. 支持鼠标右键选择菜单
|
||||
* 2. 支持全局截屏和局部截屏
|
||||
* 3. 支持图片另存为
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
@@ -46,13 +46,7 @@ private:
|
||||
};
|
||||
|
||||
#ifdef quc
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
#else
|
||||
#include <QtUiPlugin/QDesignerExportWidget>
|
||||
#endif
|
||||
|
||||
class QDESIGNER_WIDGET_EXPORT ScreenWidget : public QWidget
|
||||
class Q_DECL_EXPORT ScreenWidget : public QWidget
|
||||
#else
|
||||
class ScreenWidget : public QWidget
|
||||
#endif
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
HEADERS += \
|
||||
$$PWD/appinit.h \
|
||||
$$PWD/iconhelper.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/appinit.cpp \
|
||||
$$PWD/iconhelper.cpp
|
||||
@@ -1,58 +0,0 @@
|
||||
#include "appinit.h"
|
||||
#include "qmutex.h"
|
||||
#include "qapplication.h"
|
||||
#include "qevent.h"
|
||||
#include "qwidget.h"
|
||||
|
||||
QScopedPointer<AppInit> AppInit::self;
|
||||
AppInit *AppInit::Instance()
|
||||
{
|
||||
if (self.isNull()) {
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (self.isNull()) {
|
||||
self.reset(new AppInit);
|
||||
}
|
||||
}
|
||||
|
||||
return self.data();
|
||||
}
|
||||
|
||||
AppInit::AppInit(QObject *parent) : QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool AppInit::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
QWidget *w = (QWidget *)watched;
|
||||
if (!w->property("canMove").toBool()) {
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
static QPoint mousePoint;
|
||||
static bool mousePressed = false;
|
||||
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
mousePressed = true;
|
||||
mousePoint = mouseEvent->globalPos() - w->pos();
|
||||
return true;
|
||||
}
|
||||
} else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
|
||||
mousePressed = false;
|
||||
return true;
|
||||
} else if (mouseEvent->type() == QEvent::MouseMove) {
|
||||
if (mousePressed && (mouseEvent->buttons() && Qt::LeftButton)) {
|
||||
w->move(mouseEvent->globalPos() - mousePoint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void AppInit::start()
|
||||
{
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef APPINIT_H
|
||||
#define APPINIT_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class AppInit : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static AppInit *Instance();
|
||||
explicit AppInit(QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
static QScopedPointer<AppInit> self;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
};
|
||||
|
||||
#endif // APPINIT_H
|
||||
@@ -1,240 +0,0 @@
|
||||
#include "iconhelper.h"
|
||||
|
||||
QScopedPointer<IconHelper> IconHelper::self;
|
||||
IconHelper *IconHelper::Instance()
|
||||
{
|
||||
if (self.isNull()) {
|
||||
static QMutex mutex;
|
||||
QMutexLocker locker(&mutex);
|
||||
if (self.isNull()) {
|
||||
self.reset(new IconHelper);
|
||||
}
|
||||
}
|
||||
|
||||
return self.data();
|
||||
}
|
||||
|
||||
IconHelper::IconHelper(QObject *parent) : QObject(parent)
|
||||
{
|
||||
//判断图形字体是否存在,不存在则加入
|
||||
QFontDatabase fontDb;
|
||||
if (!fontDb.families().contains("FontAwesome")) {
|
||||
int fontId = fontDb.addApplicationFont(":/image/fontawesome-webfont.ttf");
|
||||
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
||||
if (fontName.count() == 0) {
|
||||
qDebug() << "load fontawesome-webfont.ttf error";
|
||||
}
|
||||
}
|
||||
|
||||
if (fontDb.families().contains("FontAwesome")) {
|
||||
iconFont = QFont("FontAwesome");
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0))
|
||||
iconFont.setHintingPreference(QFont::PreferNoHinting);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void IconHelper::setIcon(QLabel *lab, const QChar &str, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
lab->setFont(iconFont);
|
||||
lab->setText(str);
|
||||
}
|
||||
|
||||
void IconHelper::setIcon(QAbstractButton *btn, const QChar &str, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
btn->setFont(iconFont);
|
||||
btn->setText(str);
|
||||
}
|
||||
|
||||
QPixmap IconHelper::getPixmap(const QColor &color, const QChar &str, quint32 size,
|
||||
quint32 pixWidth, quint32 pixHeight, int flags)
|
||||
{
|
||||
QPixmap pix(pixWidth, pixHeight);
|
||||
pix.fill(Qt::transparent);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&pix);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||
painter.setPen(color);
|
||||
|
||||
iconFont.setPixelSize(size);
|
||||
painter.setFont(iconFont);
|
||||
painter.drawText(pix.rect(), flags, str);
|
||||
painter.end();
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
QPixmap IconHelper::getPixmap(QToolButton *btn, bool normal)
|
||||
{
|
||||
QPixmap pix;
|
||||
int index = btns.indexOf(btn);
|
||||
|
||||
if (index >= 0) {
|
||||
if (normal) {
|
||||
pix = pixNormal.at(index);
|
||||
} else {
|
||||
pix = pixDark.at(index);
|
||||
}
|
||||
}
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QWidget *widget, const QString &type, int borderWidth, const QString &borderColor,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
{
|
||||
QString strBorder;
|
||||
if (type == "top") {
|
||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding:%1px %2px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "right") {
|
||||
strBorder = QString("border-width:0px %1px 0px 0px;padding:%2px %1px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "bottom") {
|
||||
strBorder = QString("border-width:0px 0px %1px 0px;padding:%2px %2px %1px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "left") {
|
||||
strBorder = QString("border-width:0px 0px 0px %1px;padding:%2px %2px %2px %1px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
}
|
||||
|
||||
QStringList qss;
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:none;border-radius:0px;padding:5px;color:%2;background:%3;}")
|
||||
.arg(type).arg(normalTextColor).arg(normalBgColor));
|
||||
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton:hover,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:pressed,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:checked{"
|
||||
"border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
||||
.arg(type).arg(strBorder).arg(borderColor).arg(darkTextColor).arg(darkBgColor));
|
||||
|
||||
widget->setStyleSheet(qss.join(""));
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &type, int borderWidth, const QString &borderColor,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
{
|
||||
int btnCount = btns.count();
|
||||
int charCount = pixChar.count();
|
||||
if (btnCount <= 0 || charCount <= 0 || btnCount != charCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString strBorder;
|
||||
if (type == "top") {
|
||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding:%1px %2px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "right") {
|
||||
strBorder = QString("border-width:0px %1px 0px 0px;padding:%2px %1px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "bottom") {
|
||||
strBorder = QString("border-width:0px 0px %1px 0px;padding:%2px %2px %1px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "left") {
|
||||
strBorder = QString("border-width:0px 0px 0px %1px;padding:%2px %2px %2px %1px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
}
|
||||
|
||||
//如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色
|
||||
QStringList qss;
|
||||
if (btns.at(0)->toolButtonStyle() == Qt::ToolButtonTextBesideIcon) {
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:solid;border-radius:0px;%2border-color:%3;color:%4;background:%5;}")
|
||||
.arg(type).arg(strBorder).arg(normalBgColor).arg(normalTextColor).arg(normalBgColor));
|
||||
} else {
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:none;border-radius:0px;padding:5px;color:%2;background:%3;}")
|
||||
.arg(type).arg(normalTextColor).arg(normalBgColor));
|
||||
}
|
||||
|
||||
qss.append(QString("QWidget[flag=\"%1\"] QAbstractButton:hover,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:pressed,"
|
||||
"QWidget[flag=\"%1\"] QAbstractButton:checked{"
|
||||
"border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
||||
.arg(type).arg(strBorder).arg(borderColor).arg(darkTextColor).arg(darkBgColor));
|
||||
|
||||
qss.append(QString("QWidget#%1{background:%2;}").arg(widget->objectName()).arg(normalBgColor));
|
||||
|
||||
qss.append(QString("QWidget>QToolButton{border-width:0px;}"));
|
||||
qss.append(QString("QWidget>QToolButton{background-color:%1;color:%2;}")
|
||||
.arg(normalBgColor).arg(normalTextColor));
|
||||
qss.append(QString("QWidget>QToolButton:hover,QWidget>QToolButton:pressed,QWidget>QToolButton:checked{background-color:%1;color:%2;}")
|
||||
.arg(darkBgColor).arg(darkTextColor));
|
||||
|
||||
widget->setStyleSheet(qss.join(""));
|
||||
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
|
||||
btns.at(i)->setIcon(QIcon(pixNormal));
|
||||
btns.at(i)->setIconSize(QSize(iconWidth, iconHeight));
|
||||
btns.at(i)->installEventFilter(this);
|
||||
|
||||
this->btns.append(btns.at(i));
|
||||
this->pixNormal.append(pixNormal);
|
||||
this->pixDark.append(pixDark);
|
||||
}
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
{
|
||||
int btnCount = btns.count();
|
||||
int charCount = pixChar.count();
|
||||
if (btnCount <= 0 || charCount <= 0 || btnCount != charCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList qss;
|
||||
qss.append(QString("QFrame>QToolButton{border-style:none;border-width:0px;}"));
|
||||
qss.append(QString("QFrame>QToolButton{background-color:%1;color:%2;}")
|
||||
.arg(normalBgColor).arg(normalTextColor));
|
||||
qss.append(QString("QFrame>QToolButton:hover,QFrame>QToolButton:pressed,QFrame>QToolButton:checked{background-color:%1;color:%2;}")
|
||||
.arg(darkBgColor).arg(darkTextColor));
|
||||
|
||||
frame->setStyleSheet(qss.join(""));
|
||||
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, QChar(pixChar.at(i)), iconSize, iconWidth, iconHeight);
|
||||
|
||||
btns.at(i)->setIcon(QIcon(pixNormal));
|
||||
btns.at(i)->setIconSize(QSize(iconWidth, iconHeight));
|
||||
btns.at(i)->installEventFilter(this);
|
||||
|
||||
this->btns.append(btns.at(i));
|
||||
this->pixNormal.append(pixNormal);
|
||||
this->pixDark.append(pixDark);
|
||||
}
|
||||
}
|
||||
|
||||
bool IconHelper::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched->inherits("QToolButton")) {
|
||||
QToolButton *btn = (QToolButton *)watched;
|
||||
int index = btns.indexOf(btn);
|
||||
if (index >= 0) {
|
||||
if (event->type() == QEvent::Enter) {
|
||||
btn->setIcon(QIcon(pixDark.at(index)));
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
if (btn->isChecked()) {
|
||||
btn->setIcon(QIcon(pixDark.at(index)));
|
||||
} else {
|
||||
btn->setIcon(QIcon(pixNormal.at(index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef ICONHELPER_H
|
||||
#define ICONHELPER_H
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
//图形字体处理类
|
||||
class IconHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static IconHelper *Instance();
|
||||
explicit IconHelper(QObject *parent = 0);
|
||||
|
||||
void setIcon(QLabel *lab, const QChar &str, quint32 size = 12);
|
||||
void setIcon(QAbstractButton *btn, const QChar &str, quint32 size = 12);
|
||||
QPixmap getPixmap(const QColor &color, const QChar &str, quint32 size = 12,
|
||||
quint32 pixWidth = 15, quint32 pixHeight = 15,
|
||||
int flags = Qt::AlignCenter);
|
||||
|
||||
//根据按钮获取该按钮对应的图标
|
||||
QPixmap getPixmap(QToolButton *btn, bool normal);
|
||||
|
||||
//指定导航面板样式,不带图标
|
||||
static void setStyle(QWidget *widget, const QString &type = "left", int borderWidth = 3,
|
||||
const QString &borderColor = "#029FEA",
|
||||
const QString &normalBgColor = "#292F38",
|
||||
const QString &darkBgColor = "#1D2025",
|
||||
const QString &normalTextColor = "#54626F",
|
||||
const QString &darkTextColor = "#FDFDFD");
|
||||
|
||||
//指定导航面板样式,带图标和效果切换
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &type = "left", int borderWidth = 3,
|
||||
const QString &borderColor = "#029FEA",
|
||||
const QString &normalBgColor = "#292F38",
|
||||
const QString &darkBgColor = "#1D2025",
|
||||
const QString &normalTextColor = "#54626F",
|
||||
const QString &darkTextColor = "#FDFDFD");
|
||||
|
||||
//指定导航按钮样式,带图标和效果切换
|
||||
void setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> pixChar,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &normalBgColor = "#2FC5A2",
|
||||
const QString &darkBgColor = "#3EA7E9",
|
||||
const QString &normalTextColor = "#EEEEEE",
|
||||
const QString &darkTextColor = "#FFFFFF");
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
static QScopedPointer<IconHelper> self;
|
||||
QFont iconFont; //图形字体
|
||||
QList<QToolButton *> btns; //按钮队列
|
||||
QList<QPixmap> pixNormal; //正常图片队列
|
||||
QList<QPixmap> pixDark; //加深图片队列
|
||||
};
|
||||
#endif // ICONHELPER_H
|
||||
@@ -1,8 +0,0 @@
|
||||
FORMS += \
|
||||
$$PWD/frmmain.ui
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/frmmain.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/frmmain.cpp
|
||||
@@ -1,941 +0,0 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "frmmain.h"
|
||||
#include "ui_frmmain.h"
|
||||
#include "iconhelper.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
frmMain::frmMain(QWidget *parent) : QDialog(parent), ui(new Ui::frmMain)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->initForm();
|
||||
}
|
||||
|
||||
frmMain::~frmMain()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool frmMain::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::MouseButtonDblClick) {
|
||||
if (watched == ui->widgetTitle) {
|
||||
on_btnMenu_Max_clicked();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void frmMain::initForm()
|
||||
{
|
||||
this->setProperty("form", true);
|
||||
this->setProperty("canMove", true);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint |
|
||||
Qt::WindowMinMaxButtonsHint);
|
||||
IconHelper::Instance()->setIcon(ui->btnMenu_Min, QChar(0xf068));
|
||||
IconHelper::Instance()->setIcon(ui->btnMenu_Max, QChar(0xf067));
|
||||
IconHelper::Instance()->setIcon(ui->btnMenu_Close, QChar(0xf00d));
|
||||
//ui->widgetMenu->setVisible(false);
|
||||
ui->widgetTitle->installEventFilter(this);
|
||||
ui->widgetTitle->setProperty("form", "title");
|
||||
ui->widgetTop->setProperty("nav", "top");
|
||||
ui->labTitle->setText("压力单位转换工具");
|
||||
ui->labTitle->setFont(QFont("Microsoft Yahei", 20));
|
||||
this->setWindowTitle(ui->labTitle->text());
|
||||
ui->stackedWidget->setStyleSheet("QLabel{font:20pt;}QLineEdit{font:20pt;}QPushButton{font:20pt;}QSpinBox{font:20pt;}");
|
||||
//单独设置指示器大小
|
||||
int addWidth = 20;
|
||||
int addHeight = 10;
|
||||
int rbtnWidth = 15;
|
||||
int ckWidth = 13;
|
||||
int scrWidth = 12;
|
||||
int borderWidth = 3;
|
||||
QStringList qss;
|
||||
qss.append(
|
||||
QString("QComboBox::drop-down,QDateEdit::drop-down,QTimeEdit::drop-down,QDateTimeEdit::drop-down{width:%1px;}").arg(
|
||||
addWidth));
|
||||
qss.append(
|
||||
QString("QComboBox::down-arrow,QDateEdit[calendarPopup=\"true\"]::down-arrow,QTimeEdit[calendarPopup=\"true\"]::down-arrow,"
|
||||
"QDateTimeEdit[calendarPopup=\"true\"]::down-arrow{width:%1px;height:%1px;right:2px;}").arg(
|
||||
addHeight));
|
||||
qss.append(QString("QRadioButton::indicator{width:%1px;height:%1px;}").arg(rbtnWidth));
|
||||
qss.append(
|
||||
QString("QCheckBox::indicator,QGroupBox::indicator,QTreeWidget::indicator,QListWidget::indicator{width:%1px;height:%1px;}").arg(
|
||||
ckWidth));
|
||||
qss.append(
|
||||
QString("QScrollBar:horizontal{min-height:%1px;border-radius:%2px;}QScrollBar::handle:horizontal{border-radius:%2px;}"
|
||||
"QScrollBar:vertical{min-width:%1px;border-radius:%2px;}QScrollBar::handle:vertical{border-radius:%2px;}").arg(
|
||||
scrWidth).arg(scrWidth / 2));
|
||||
qss.append(QString("QWidget#widget_top>QToolButton:pressed,QWidget#widget_top>QToolButton:hover,"
|
||||
"QWidget#widget_top>QToolButton:checked,QWidget#widget_top>QLabel:hover{"
|
||||
"border-width:0px 0px %1px 0px;}").arg(borderWidth));
|
||||
qss.append(QString("QWidget#widgetleft>QPushButton:checked,QWidget#widgetleft>QToolButton:checked,"
|
||||
"QWidget#widgetleft>QPushButton:pressed,QWidget#widgetleft>QToolButton:pressed{"
|
||||
"border-width:0px 0px 0px %1px;}").arg(borderWidth));
|
||||
this->setStyleSheet(qss.join(""));
|
||||
QSize icoSize(32, 32);
|
||||
int icoWidth = 85;
|
||||
//设置顶部导航按钮
|
||||
QList<QToolButton *> tbtns = ui->widgetTop->findChildren<QToolButton *>();
|
||||
|
||||
foreach (QToolButton *btn, tbtns) {
|
||||
btn->setIconSize(icoSize);
|
||||
btn->setMinimumWidth(icoWidth);
|
||||
btn->setCheckable(true);
|
||||
connect(btn, SIGNAL(clicked()), this, SLOT(buttonClick()));
|
||||
}
|
||||
|
||||
QList<QLineEdit *> ledits = ui->page1->findChildren<QLineEdit *>();
|
||||
|
||||
foreach (QLineEdit *ledit, ledits) {
|
||||
connect(ledit, SIGNAL(textEdited(const QString)), this, SLOT(doTextEdited(const QString)));
|
||||
}
|
||||
|
||||
ui->btnMain->click();
|
||||
on_spinBox_rbit_valueChanged(1);
|
||||
}
|
||||
|
||||
void frmMain::buttonClick()
|
||||
{
|
||||
QToolButton *b = (QToolButton *)sender();
|
||||
QString name = b->text();
|
||||
QList<QToolButton *> tbtns = ui->widgetTop->findChildren<QToolButton *>();
|
||||
|
||||
foreach (QToolButton *btn, tbtns) {
|
||||
if (btn == b) {
|
||||
btn->setChecked(true);
|
||||
} else {
|
||||
btn->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "主界面") {
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
} else if (name == "用户退出") {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void frmMain::doTextEdited(const QString str)
|
||||
{
|
||||
QLineEdit *l = (QLineEdit *)sender();
|
||||
QList<QLineEdit *> ledits = ui->page1->findChildren<QLineEdit *>();
|
||||
//转换前单位
|
||||
QString beforeName = l->objectName();
|
||||
//转换前数值
|
||||
double beforeValue = l->text().toDouble();
|
||||
|
||||
foreach (QLineEdit *ledit, ledits) {
|
||||
//转换后单位
|
||||
QString curName = ledit->objectName();
|
||||
|
||||
if (ledit == l) {
|
||||
} else if (curName == "lineEdit_bar") {
|
||||
//巴 (bar)
|
||||
if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.01, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
qDebug() << outStr;
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 1.01325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.0004788, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.03386388, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00009807, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 10, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00133322, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.06894757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到巴 (bar)
|
||||
QString outStr = QString::number(beforeValue * 0.00009807, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_kpa") {
|
||||
//千帕 (kPa)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 100.0, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 101.325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.04788026, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 3.38638816, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 1000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.13332237, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 6.894757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 98.0665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到千帕 (kPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mbar") {
|
||||
//毫巴 (mbar)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1000.0, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 10, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1013.25, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.47880257, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 33.86388158, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.01, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 1.33322368, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 68.94757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 980.665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到毫巴(mbar)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_unit") {
|
||||
//标准大气压
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.98692327, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00986923, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00098692, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00047254, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.03342105, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00009678, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 9.86923267, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00098692, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00000987, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00131579, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.06804596, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.96784111, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到标准大气压
|
||||
QString outStr = QString::number(beforeValue * 0.00009678, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_feet") {
|
||||
//磅力/英尺2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2088.54351212, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 20.88543512, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2.08854351, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2116.21671366, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 70.72619017, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 0.20481615, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 20885.43512121, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2.08854351, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 0.02088544, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2.78449568, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 144, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 2048.16152331, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到磅力/英尺2
|
||||
QString outStr = QString::number(beforeValue * 0.20481615, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_british_hg") {
|
||||
//英吋汞柱
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 29.52998751, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.29529988, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.02952999, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 29.92125984, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.01413903, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.0028959, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 295.29987508, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.02952999, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.0002953, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.03937008, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 2.03602088, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 28.9590252, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 0.0028959, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10197.16212978, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 101.9716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10332.274528, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 4.88242743, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 345.3154908, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 101971.62129779, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 0.10197162, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 13.59509806, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 703.06954974, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到公斤力/米2
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到英吋汞柱
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.101325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00004788, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00338639, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00000981, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.000001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00013332, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.00689476, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到兆帕(MPa)
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_hpa") {
|
||||
//百帕 (hPa)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到百帕 (hPa)
|
||||
QString outStr = QString::number(beforeValue * 1000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 10, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 1013.25, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.47880257, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 33.86388158, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.01, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 1.33322368, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 68.94757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 980.665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到百帕(hPa)
|
||||
QString outStr = QString::number(beforeValue * 0.0980665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_pascal") {
|
||||
//帕斯卡
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 100000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 1000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 100, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 101325, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 47.88025694, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 3386.38815789, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 9.80665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 1000000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 100, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 133.32236842, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 6894.757, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 98066.5, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到帕斯卡
|
||||
QString outStr = QString::number(beforeValue * 9.80665, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 750.0616827, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 7.50061683, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 0.75006168, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 760, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.35913146, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 25.4, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.07355592, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 7500.61682704, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.75006168, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到毫米汞柱(托)
|
||||
QString outStr = QString::number(beforeValue * 0.00750062, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 51.71493037, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 735.55924007, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到毫米汞柱 (托)
|
||||
QString outStr = QString::number(beforeValue * 0.07355592, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_cmz") {
|
||||
//磅力/英寸2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 14.50377439, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.14503774, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.01450377, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 14.6959494, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00694444, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.4911541, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00142233, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 145.0377439, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.01450377, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00014504, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.01933678, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 14.22334391, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 0.00142233, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 1.01971621, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.01019716, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00101972, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 1.03322745, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00048824, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.03453155, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00101972, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.0000102, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.00135951, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.07030695, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱装换到公斤力/厘米2
|
||||
QString outStr = QString::number(beforeValue * 0.0001, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
} else if (curName == "lineEdit_mm_water_column") {
|
||||
//毫米水柱
|
||||
if (beforeName == "lineEdit_bar") {
|
||||
//从巴 (bar)装换到磅力/英寸2
|
||||
QString outStr = QString::number(beforeValue * 10197.16212978, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kpa") {
|
||||
//从千帕 (kPa)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 101.9716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mbar") {
|
||||
//从毫巴 (mbar)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_unit") {
|
||||
//从标准大气压装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10332.274528, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_feet") {
|
||||
//从磅力/英尺2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 4.88242743, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_british_hg") {
|
||||
//英吋汞柱装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 345.3154908, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kilogram_force") {
|
||||
//公斤力/米2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 1, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mpa") {
|
||||
//兆帕(MPa)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 101971.62129779, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_hpa") {
|
||||
//百帕(hPa)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10.19716213, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_pascal") {
|
||||
//帕斯卡装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 0.10197162, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_mmhg") {
|
||||
//毫米汞柱 (托)装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 13.59509806, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_cmz") {
|
||||
//磅力/英寸2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 703.06954974, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
} else if (beforeName == "lineEdit_kgf_cm2") {
|
||||
//公斤力/厘米2装换到毫米水柱
|
||||
QString outStr = QString::number(beforeValue * 10000, 'f', numOfDecimalPoints);
|
||||
ledit->setText(outStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void frmMain::on_btnMenu_Min_clicked()
|
||||
{
|
||||
showMinimized();
|
||||
}
|
||||
void frmMain::on_btnMenu_Max_clicked()
|
||||
{
|
||||
static bool max = false;
|
||||
static QRect location = this->geometry();
|
||||
|
||||
if (max) {
|
||||
this->setGeometry(location);
|
||||
} else {
|
||||
location = this->geometry();
|
||||
this->setGeometry(qApp->desktop()->availableGeometry());
|
||||
}
|
||||
|
||||
this->setProperty("canMove", max);
|
||||
max = !max;
|
||||
}
|
||||
void frmMain::on_btnMenu_Close_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
void frmMain::on_spinBox_rbit_valueChanged(int arg1)
|
||||
{
|
||||
numOfDecimalPoints = arg1;
|
||||
QList<QLineEdit *> ledits = ui->page1->findChildren<QLineEdit *>();
|
||||
|
||||
foreach (QLineEdit *ledit, ledits) {
|
||||
ledit->setValidator(new QDoubleValidator(0, DBL_MAX, arg1, this));
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef FRMMAIN_H
|
||||
#define FRMMAIN_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class frmMain;
|
||||
}
|
||||
|
||||
class frmMain : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit frmMain(QWidget *parent = 0);
|
||||
~frmMain();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
private:
|
||||
Ui::frmMain *ui;
|
||||
int numOfDecimalPoints;
|
||||
|
||||
private slots:
|
||||
void initForm();
|
||||
void buttonClick();
|
||||
void doTextEdited(const QString);
|
||||
|
||||
private slots:
|
||||
void on_btnMenu_Min_clicked();
|
||||
void on_btnMenu_Max_clicked();
|
||||
void on_btnMenu_Close_clicked();
|
||||
void on_spinBox_rbit_valueChanged(int arg1);
|
||||
};
|
||||
|
||||
#endif // UIDEMO01_H
|
||||
@@ -1,506 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>frmMain</class>
|
||||
<widget class="QDialog" name="frmMain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QWidget" name="widgetTitle" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</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="labIco">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../other/main.qrc">:/image/logo.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetTop" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<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="QToolButton" name="btnMain">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>主界面</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../other/main.qrc">
|
||||
<normaloff>:/image/main_main.png</normaloff>:/image/main_main.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnExit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>用户退出</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../other/main.qrc">
|
||||
<normaloff>:/image/main_exit.png</normaloff>:/image/main_exit.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetMenu" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<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>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="btnMenu_Min">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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>30</width>
|
||||
<height>30</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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="btnMenu_Max">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>104</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_rbit">
|
||||
<property name="text">
|
||||
<string>小数点保留位</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_bar">
|
||||
<property name="text">
|
||||
<string>巴 (bar)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_kpa">
|
||||
<property name="text">
|
||||
<string>千帕 (kPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mbar">
|
||||
<property name="text">
|
||||
<string>毫巴 (mbar)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_unit">
|
||||
<property name="text">
|
||||
<string>标准大气压</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_feet">
|
||||
<property name="text">
|
||||
<string>磅力/英尺2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_british_hg">
|
||||
<property name="text">
|
||||
<string>英吋汞柱</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_kilogram_force">
|
||||
<property name="text">
|
||||
<string>公斤力/米2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_rbit">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_bar"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_kpa"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mbar"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_unit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_feet"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_british_hg"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_kilogram_force"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mpa">
|
||||
<property name="text">
|
||||
<string>兆帕 (MPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_hpa">
|
||||
<property name="text">
|
||||
<string>百帕 (hPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_pascal">
|
||||
<property name="text">
|
||||
<string>帕斯卡</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mmhg">
|
||||
<property name="text">
|
||||
<string>毫米汞柱 (托)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_cmz">
|
||||
<property name="text">
|
||||
<string>磅力/英寸2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_kgf_cm2">
|
||||
<property name="text">
|
||||
<string>公斤力/厘米2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_mm_water_column">
|
||||
<property name="text">
|
||||
<string>毫米水柱</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mpa"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_hpa"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_pascal"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mmhg"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_cmz"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_kgf_cm2"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_mm_water_column"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>104</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../other/main.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "frmmain.h"
|
||||
#include "appinit.h"
|
||||
#include "qapplication.h"
|
||||
#include "qtextcodec.h"
|
||||
#include "qfile.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
a.setFont(QFont("Microsoft Yahei", 9));
|
||||
AppInit::Instance()->start();
|
||||
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
||||
#if _MSC_VER
|
||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
#endif
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
QTextCodec::setCodecForCStrings(codec);
|
||||
QTextCodec::setCodecForTr(codec);
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
#endif
|
||||
|
||||
//加载样式表
|
||||
QFile file(":/qss/psblack.css");
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
QString qss = QLatin1String(file.readAll());
|
||||
QString paletteColor = qss.mid(20, 7);
|
||||
qApp->setPalette(QPalette(QColor(paletteColor)));
|
||||
qApp->setStyleSheet(qss);
|
||||
file.close();
|
||||
}
|
||||
|
||||
frmMain w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||