更新文档

This commit is contained in:
feiyangqingyun
2023-09-08 13:52:30 +08:00
parent 9af16093a2
commit 8173abef29
39 changed files with 1556 additions and 1464 deletions

View File

@@ -144,86 +144,6 @@ void Battery::updateValue()
this->update();
}
double Battery::getMinValue() const
{
return this->minValue;
}
double Battery::getMaxValue() const
{
return this->maxValue;
}
double Battery::getValue() const
{
return this->value;
}
double Battery::getAlarmValue() const
{
return this->alarmValue;
}
bool Battery::getAnimation() const
{
return this->animation;
}
double Battery::getAnimationStep() const
{
return this->animationStep;
}
int Battery::getBorderWidth() const
{
return this->borderWidth;
}
int Battery::getBorderRadius() const
{
return this->borderRadius;
}
int Battery::getBgRadius() const
{
return this->bgRadius;
}
int Battery::getHeadRadius() const
{
return this->headRadius;
}
QColor Battery::getBorderColorStart() const
{
return this->borderColorStart;
}
QColor Battery::getBorderColorEnd() const
{
return this->borderColorEnd;
}
QColor Battery::getAlarmColorStart() const
{
return this->alarmColorStart;
}
QColor Battery::getAlarmColorEnd() const
{
return this->alarmColorEnd;
}
QColor Battery::getNormalColorStart() const
{
return this->normalColorStart;
}
QColor Battery::getNormalColorEnd() const
{
return this->normalColorEnd;
}
QSize Battery::sizeHint() const
{
return QSize(150, 80);
@@ -260,16 +180,31 @@ void Battery::setRange(int minValue, int maxValue)
setRange((double)minValue, (double)maxValue);
}
double Battery::getMinValue() const
{
return this->minValue;
}
void Battery::setMinValue(double minValue)
{
setRange(minValue, maxValue);
}
double Battery::getMaxValue() const
{
return this->maxValue;
}
void Battery::setMaxValue(double maxValue)
{
setRange(minValue, maxValue);
}
double Battery::getValue() const
{
return this->value;
}
void Battery::setValue(double value)
{
//值和当前值一致则无需处理
@@ -310,6 +245,11 @@ void Battery::setValue(int value)
setValue((double)value);
}
double Battery::getAlarmValue() const
{
return this->alarmValue;
}
void Battery::setAlarmValue(double alarmValue)
{
if (this->alarmValue != alarmValue) {
@@ -323,6 +263,12 @@ void Battery::setAlarmValue(int alarmValue)
setAlarmValue((double)alarmValue);
}
bool Battery::getAnimation() const
{
return this->animation;
}
void Battery::setAnimation(bool animation)
{
if (this->animation != animation) {
@@ -331,6 +277,11 @@ void Battery::setAnimation(bool animation)
}
}
double Battery::getAnimationStep() const
{
return this->animationStep;
}
void Battery::setAnimationStep(double animationStep)
{
if (this->animationStep != animationStep) {
@@ -339,6 +290,11 @@ void Battery::setAnimationStep(double animationStep)
}
}
int Battery::getBorderWidth() const
{
return this->borderWidth;
}
void Battery::setBorderWidth(int borderWidth)
{
if (this->borderWidth != borderWidth) {
@@ -347,6 +303,11 @@ void Battery::setBorderWidth(int borderWidth)
}
}
int Battery::getBorderRadius() const
{
return this->borderRadius;
}
void Battery::setBorderRadius(int borderRadius)
{
if (this->borderRadius != borderRadius) {
@@ -355,6 +316,11 @@ void Battery::setBorderRadius(int borderRadius)
}
}
int Battery::getBgRadius() const
{
return this->bgRadius;
}
void Battery::setBgRadius(int bgRadius)
{
if (this->bgRadius != bgRadius) {
@@ -363,6 +329,11 @@ void Battery::setBgRadius(int bgRadius)
}
}
int Battery::getHeadRadius() const
{
return this->headRadius;
}
void Battery::setHeadRadius(int headRadius)
{
if (this->headRadius != headRadius) {
@@ -371,6 +342,11 @@ void Battery::setHeadRadius(int headRadius)
}
}
QColor Battery::getBorderColorStart() const
{
return this->borderColorStart;
}
void Battery::setBorderColorStart(const QColor &borderColorStart)
{
if (this->borderColorStart != borderColorStart) {
@@ -379,6 +355,11 @@ void Battery::setBorderColorStart(const QColor &borderColorStart)
}
}
QColor Battery::getBorderColorEnd() const
{
return this->borderColorEnd;
}
void Battery::setBorderColorEnd(const QColor &borderColorEnd)
{
if (this->borderColorEnd != borderColorEnd) {
@@ -387,6 +368,11 @@ void Battery::setBorderColorEnd(const QColor &borderColorEnd)
}
}
QColor Battery::getAlarmColorStart() const
{
return this->alarmColorStart;
}
void Battery::setAlarmColorStart(const QColor &alarmColorStart)
{
if (this->alarmColorStart != alarmColorStart) {
@@ -395,6 +381,11 @@ void Battery::setAlarmColorStart(const QColor &alarmColorStart)
}
}
QColor Battery::getAlarmColorEnd() const
{
return this->alarmColorEnd;
}
void Battery::setAlarmColorEnd(const QColor &alarmColorEnd)
{
if (this->alarmColorEnd != alarmColorEnd) {
@@ -403,6 +394,11 @@ void Battery::setAlarmColorEnd(const QColor &alarmColorEnd)
}
}
QColor Battery::getNormalColorStart() const
{
return this->normalColorStart;
}
void Battery::setNormalColorStart(const QColor &normalColorStart)
{
if (this->normalColorStart != normalColorStart) {
@@ -411,6 +407,11 @@ void Battery::setNormalColorStart(const QColor &normalColorStart)
}
}
QColor Battery::getNormalColorEnd() const
{
return this->normalColorEnd;
}
void Battery::setNormalColorEnd(const QColor &normalColorEnd)
{
if (this->normalColorEnd != normalColorEnd) {
@@ -418,4 +419,3 @@ void Battery::setNormalColorEnd(const QColor &normalColorEnd)
this->update();
}
}

View File

@@ -58,102 +58,107 @@ private slots:
void updateValue();
private:
double minValue; //最小值
double maxValue; //最大值
double value; //目标电量
double alarmValue; //电池电量警戒值
double minValue; //最小值
double maxValue; //最大值
double value; //目标电量
double alarmValue; //电池电量警戒值
bool animation; //是否启用动画显示
double animationStep; //动画显示时步长
bool animation; //是否启用动画显示
double animationStep; //动画显示时步长
int borderWidth; //边框粗细
int borderRadius; //边框圆角角度
int bgRadius; //背景进度圆角角度
int headRadius; //头部圆角角度
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; //是否往前移
double currentValue; //当前电量
QRectF batteryRect; //电池主体区域
QTimer *timer; //绘制定时器
bool isForward; //是否往前移
double currentValue; //当前电量
QRectF batteryRect; //电池主体区域
QTimer *timer; //绘制定时器
public:
double getMinValue() const;
double getMaxValue() const;
double getValue() const;
double getAlarmValue() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
bool getAnimation() const;
double getAnimationStep() const;
int getBorderWidth() const;
int getBorderRadius() const;
int getBgRadius() const;
int getHeadRadius() const;
QColor getBorderColorStart() const;
QColor getBorderColorEnd() const;
QColor getAlarmColorStart() const;
QColor getAlarmColorEnd() const;
QColor getNormalColorStart() const;
QColor getNormalColorEnd() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置范围值
void setRange(double minValue, double maxValue);
void setRange(int minValue, int maxValue);
//设置最大最小值
//获取和设置最小值
double getMinValue() const;
void setMinValue(double minValue);
//获取和设置最大值
double getMaxValue() const;
void setMaxValue(double maxValue);
//设置电池电量值
//获取和设置电池电量值
double getValue() const;
void setValue(double value);
void setValue(int value);
//设置电池电量警戒值
//获取和设置电池电量警戒值
double getAlarmValue() const;
void setAlarmValue(double alarmValue);
void setAlarmValue(int alarmValue);
//设置是否启用动画显示
//获取和设置是否启用动画显示
bool getAnimation() const;
void setAnimation(bool animation);
//设置动画显示的步长
//获取和设置动画显示的步长
double getAnimationStep() const;
void setAnimationStep(double animationStep);
//设置边框粗细
//获取和设置边框粗细
int getBorderWidth() const;
void setBorderWidth(int borderWidth);
//设置边框圆角角度
//获取和设置边框圆角角度
int getBorderRadius() const;
void setBorderRadius(int borderRadius);
//设置背景圆角角度
//获取和设置背景圆角角度
int getBgRadius() const;
void setBgRadius(int bgRadius);
//设置头部圆角角度
//获取和设置头部圆角角度
int getHeadRadius() const;
void setHeadRadius(int headRadius);
//设置边框渐变颜色
//获取和设置边框渐变颜色
QColor getBorderColorStart() const;
void setBorderColorStart(const QColor &borderColorStart);
QColor getBorderColorEnd() const;
void setBorderColorEnd(const QColor &borderColorEnd);
//设置电池电量报警时的渐变颜色
//获取和设置电池电量报警时的渐变颜色
QColor getAlarmColorStart() const;
void setAlarmColorStart(const QColor &alarmColorStart);
QColor getAlarmColorEnd() const;
void setAlarmColorEnd(const QColor &alarmColorEnd);
//设置电池电量正常时的渐变颜色
//获取和设置电池电量正常时的渐变颜色
QColor getNormalColorStart() const;
void setNormalColorStart(const QColor &normalColorStart);
QColor getNormalColorEnd() const;
void setNormalColorEnd(const QColor &normalColorEnd);
public Q_SLOTS:
void setValue(int value);
void setAlarmValue(int alarmValue);
Q_SIGNALS:
void valueChanged(double value);
};

View File

@@ -114,36 +114,6 @@ bool DeviceButton::eventFilter(QObject *watched, QEvent *event)
return QWidget::eventFilter(watched, event);
}
bool DeviceButton::getCanMove() const
{
return this->canMove;
}
QString DeviceButton::getText() const
{
return this->text;
}
QString DeviceButton::getColorNormal() const
{
return this->colorNormal;
}
QString DeviceButton::getColorAlarm() const
{
return this->colorAlarm;
}
DeviceButton::ButtonStyle DeviceButton::getButtonStyle() const
{
return this->buttonStyle;
}
DeviceButton::ButtonColor DeviceButton::getButtonColor() const
{
return this->buttonColor;
}
QSize DeviceButton::sizeHint() const
{
return QSize(50, 50);
@@ -166,11 +136,21 @@ void DeviceButton::checkAlarm()
this->update();
}
bool DeviceButton::getCanMove() const
{
return this->canMove;
}
void DeviceButton::setCanMove(bool canMove)
{
this->canMove = canMove;
}
QString DeviceButton::getText() const
{
return this->text;
}
void DeviceButton::setText(const QString &text)
{
if (this->text != text) {
@@ -179,6 +159,11 @@ void DeviceButton::setText(const QString &text)
}
}
QString DeviceButton::getColorNormal() const
{
return this->colorNormal;
}
void DeviceButton::setColorNormal(const QString &colorNormal)
{
if (this->colorNormal != colorNormal) {
@@ -187,6 +172,11 @@ void DeviceButton::setColorNormal(const QString &colorNormal)
}
}
QString DeviceButton::getColorAlarm() const
{
return this->colorAlarm;
}
void DeviceButton::setColorAlarm(const QString &colorAlarm)
{
if (this->colorAlarm != colorAlarm) {
@@ -195,6 +185,11 @@ void DeviceButton::setColorAlarm(const QString &colorAlarm)
}
}
DeviceButton::ButtonStyle DeviceButton::getButtonStyle() const
{
return this->buttonStyle;
}
void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle)
{
this->buttonStyle = buttonStyle;
@@ -217,6 +212,11 @@ void DeviceButton::setButtonStyle(const DeviceButton::ButtonStyle &buttonStyle)
setButtonColor(buttonColor);
}
DeviceButton::ButtonColor DeviceButton::getButtonColor() const
{
return this->buttonColor;
}
void DeviceButton::setButtonColor(const DeviceButton::ButtonColor &buttonColor)
{
//先停止定时器

View File

@@ -46,13 +46,13 @@ public:
//设备按钮颜色
enum ButtonColor {
ButtonColor_Green = 0, //绿色 激活状态
ButtonColor_Blue = 1, //蓝色 在线状态
ButtonColor_Red = 2, //红色 报警状态
ButtonColor_Gray = 3, //灰色 离线状态
ButtonColor_Black = 4, //黑色 故障状态
ButtonColor_Purple = 5, //紫色 其他状态
ButtonColor_Yellow = 6 //黄色 其他状态
ButtonColor_Green = 0, //绿色(激活状态)
ButtonColor_Blue = 1, //蓝色(在线状态)
ButtonColor_Red = 2, //红色(报警状态)
ButtonColor_Gray = 3, //灰色(离线状态)
ButtonColor_Black = 4, //黑色(故障状态)
ButtonColor_Purple = 5, //紫色(其他状态)
ButtonColor_Yellow = 6 //黄色(其他状态)
};
explicit DeviceButton(QWidget *parent = 0);
@@ -63,54 +63,55 @@ protected:
bool eventFilter(QObject *watched, QEvent *event);
private:
bool canMove; //是否可移动
QString text; //显示文字
bool canMove; //是否可移动
QString text; //显示文字
QString colorNormal; //正常颜色
QString colorAlarm; //报警颜色
QString colorNormal; //正常颜色
QString colorAlarm; //报警颜色
ButtonStyle buttonStyle; //按钮样式
ButtonColor buttonColor; //按钮颜色
ButtonStyle buttonStyle;//按钮样式
ButtonColor buttonColor;//按钮颜色
bool isPressed; //鼠标是否按下
QPoint lastPoint; //鼠标按下最后坐标
bool isPressed; //鼠标是否按下
QPoint lastPoint; //鼠标按下最后坐标
QString type; //图片末尾类型
QString imgPath; //背景图片路径
QString imgName; //背景图片名称
QString type; //图片末尾类型
QString imgPath; //背景图片路径
QString imgName; //背景图片名称
bool isDark; //是否加深报警
QTimer *timer; //报警闪烁定时器
bool isDark; //是否加深报警
QTimer *timer; //报警闪烁定时器
private slots:
void checkAlarm(); //切换报警状态
void checkAlarm(); //切换报警状态
public:
bool getCanMove() const;
QString getText() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
QString getColorNormal() const;
QString getColorAlarm() const;
ButtonStyle getButtonStyle() const;
ButtonColor getButtonColor() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置可移动
//获取和设置可移动
bool getCanMove() const;
void setCanMove(bool canMove);
//设置显示文字
//获取和设置显示文字
QString getText() const;
void setText(const QString &text);
//设置正常颜色和报警颜色
//获取和设置正常颜色
QString getColorNormal() const;
void setColorNormal(const QString &colorNormal);
//获取和设置报警颜色
QString getColorAlarm() const;
void setColorAlarm(const QString &colorAlarm);
//设置样式
//获取和设置样式
ButtonStyle getButtonStyle() const;
void setButtonStyle(const ButtonStyle &buttonStyle);
//设置颜色
//获取和设置颜色
ButtonColor getButtonColor() const;
void setButtonColor(const ButtonColor &buttonColor);
Q_SIGNALS:

View File

@@ -59,128 +59,6 @@ DeviceSizeTable::DeviceSizeTable(QWidget *parent) : QTableWidget(parent)
//QTimer::singleShot(10, this, SLOT(load()));
}
QColor DeviceSizeTable::getBgColor() const
{
return this->bgColor;
}
QColor DeviceSizeTable::getChunkColor1() const
{
return this->chunkColor1;
}
QColor DeviceSizeTable::getChunkColor2() const
{
return this->chunkColor2;
}
QColor DeviceSizeTable::getChunkColor3() const
{
return this->chunkColor3;
}
QColor DeviceSizeTable::getTextColor1() const
{
return this->textColor1;
}
QColor DeviceSizeTable::getTextColor2() const
{
return this->textColor2;
}
QColor DeviceSizeTable::getTextColor3() const
{
return this->textColor3;
}
void DeviceSizeTable::load()
{
//清空原有数据
int row = this->rowCount();
for (int i = 0; i < row; ++i) {
this->removeRow(0);
}
#ifdef Q_OS_WIN
QFileInfoList list = QDir::drives();
foreach (QFileInfo dir, list) {
QString dirName = dir.absolutePath();
LPCWSTR lpcwstrDriver = (LPCWSTR)dirName.utf16();
ULARGE_INTEGER liFreeBytesAvailable, liTotalBytes, liTotalFreeBytes;
if (GetDiskFreeSpaceEx(lpcwstrDriver, &liFreeBytesAvailable, &liTotalBytes, &liTotalFreeBytes)) {
QString use = QString::number((double)(liTotalBytes.QuadPart - liTotalFreeBytes.QuadPart) / GB, 'f', 1);
use += "G";
QString free = QString::number((double) liTotalFreeBytes.QuadPart / GB, 'f', 1);
free += "G";
QString all = QString::number((double) liTotalBytes.QuadPart / GB, 'f', 1);
all += "G";
int percent = 100 - ((double)liTotalFreeBytes.QuadPart / liTotalBytes.QuadPart) * 100;
insertSize(dirName, use, free, all, percent);
}
}
#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
process->start("df", QStringList() << "-h");
#endif
}
void DeviceSizeTable::setBgColor(const QColor &bgColor)
{
if (this->bgColor != bgColor) {
this->bgColor = bgColor;
this->load();
}
}
void DeviceSizeTable::setChunkColor1(const QColor &chunkColor1)
{
if (this->chunkColor1 != chunkColor1) {
this->chunkColor1 = chunkColor1;
this->load();
}
}
void DeviceSizeTable::setChunkColor2(const QColor &chunkColor2)
{
if (this->chunkColor2 != chunkColor2) {
this->chunkColor2 = chunkColor2;
this->load();
}
}
void DeviceSizeTable::setChunkColor3(const QColor &chunkColor3)
{
if (this->chunkColor3 != chunkColor3) {
this->chunkColor3 = chunkColor3;
this->load();
}
}
void DeviceSizeTable::setTextColor1(const QColor &textColor1)
{
if (this->textColor1 != textColor1) {
this->textColor1 = textColor1;
this->load();
}
}
void DeviceSizeTable::setTextColor2(const QColor &textColor2)
{
if (this->textColor2 != textColor2) {
this->textColor2 = textColor2;
this->load();
}
}
void DeviceSizeTable::setTextColor3(const QColor &textColor3)
{
if (this->textColor3 != textColor3) {
this->textColor3 = textColor3;
this->load();
}
}
void DeviceSizeTable::readData()
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
@@ -292,3 +170,125 @@ QSize DeviceSizeTable::minimumSizeHint() const
{
return QSize(200, 150);
}
QColor DeviceSizeTable::getBgColor() const
{
return this->bgColor;
}
void DeviceSizeTable::setBgColor(const QColor &bgColor)
{
if (this->bgColor != bgColor) {
this->bgColor = bgColor;
this->load();
}
}
QColor DeviceSizeTable::getChunkColor1() const
{
return this->chunkColor1;
}
void DeviceSizeTable::setChunkColor1(const QColor &chunkColor1)
{
if (this->chunkColor1 != chunkColor1) {
this->chunkColor1 = chunkColor1;
this->load();
}
}
QColor DeviceSizeTable::getChunkColor2() const
{
return this->chunkColor2;
}
void DeviceSizeTable::setChunkColor2(const QColor &chunkColor2)
{
if (this->chunkColor2 != chunkColor2) {
this->chunkColor2 = chunkColor2;
this->load();
}
}
QColor DeviceSizeTable::getChunkColor3() const
{
return this->chunkColor3;
}
void DeviceSizeTable::setChunkColor3(const QColor &chunkColor3)
{
if (this->chunkColor3 != chunkColor3) {
this->chunkColor3 = chunkColor3;
this->load();
}
}
QColor DeviceSizeTable::getTextColor1() const
{
return this->textColor1;
}
void DeviceSizeTable::setTextColor1(const QColor &textColor1)
{
if (this->textColor1 != textColor1) {
this->textColor1 = textColor1;
this->load();
}
}
QColor DeviceSizeTable::getTextColor2() const
{
return this->textColor2;
}
void DeviceSizeTable::setTextColor2(const QColor &textColor2)
{
if (this->textColor2 != textColor2) {
this->textColor2 = textColor2;
this->load();
}
}
QColor DeviceSizeTable::getTextColor3() const
{
return this->textColor3;
}
void DeviceSizeTable::setTextColor3(const QColor &textColor3)
{
if (this->textColor3 != textColor3) {
this->textColor3 = textColor3;
this->load();
}
}
void DeviceSizeTable::load()
{
//清空原有数据
int row = this->rowCount();
for (int i = 0; i < row; ++i) {
this->removeRow(0);
}
#ifdef Q_OS_WIN
QFileInfoList list = QDir::drives();
foreach (QFileInfo dir, list) {
QString dirName = dir.absolutePath();
LPCWSTR lpcwstrDriver = (LPCWSTR)dirName.utf16();
ULARGE_INTEGER liFreeBytesAvailable, liTotalBytes, liTotalFreeBytes;
if (GetDiskFreeSpaceEx(lpcwstrDriver, &liFreeBytesAvailable, &liTotalBytes, &liTotalFreeBytes)) {
QString use = QString::number((double)(liTotalBytes.QuadPart - liTotalFreeBytes.QuadPart) / GB, 'f', 1);
use += "G";
QString free = QString::number((double) liTotalFreeBytes.QuadPart / GB, 'f', 1);
free += "G";
QString all = QString::number((double) liTotalBytes.QuadPart / GB, 'f', 1);
all += "G";
int percent = 100 - ((double)liTotalFreeBytes.QuadPart / liTotalBytes.QuadPart) * 100;
insertSize(dirName, use, free, all, percent);
}
}
#elif defined(Q_OS_UNIX) && !defined(Q_OS_WASM)
process->start("df", QStringList() << "-h");
#endif
}

View File

@@ -26,6 +26,7 @@ class DeviceSizeTable : public QTableWidget
Q_PROPERTY(QColor chunkColor1 READ getChunkColor1 WRITE setChunkColor1)
Q_PROPERTY(QColor chunkColor2 READ getChunkColor2 WRITE setChunkColor2)
Q_PROPERTY(QColor chunkColor3 READ getChunkColor3 WRITE setChunkColor3)
Q_PROPERTY(QColor textColor1 READ getTextColor1 WRITE setTextColor1)
Q_PROPERTY(QColor textColor2 READ getTextColor2 WRITE setTextColor2)
Q_PROPERTY(QColor textColor3 READ getTextColor3 WRITE setTextColor3)
@@ -34,15 +35,16 @@ public:
explicit DeviceSizeTable(QWidget *parent = 0);
private:
QProcess *process; //执行命令进程
QProcess *process; //执行命令进程
QColor bgColor; //背景颜色
QColor chunkColor1; //进度颜色1
QColor chunkColor2; //进度颜色2
QColor chunkColor3; //进度颜色3
QColor textColor1; //文字颜色1
QColor textColor2; //文字颜色2
QColor textColor3; //文字颜色3
QColor bgColor; //背景颜色
QColor chunkColor1; //进度颜色1
QColor chunkColor2; //进度颜色2
QColor chunkColor3; //进度颜色3
QColor textColor1; //文字颜色1
QColor textColor2; //文字颜色2
QColor textColor3; //文字颜色3
private slots:
void readData();
@@ -50,34 +52,42 @@ private slots:
void insertSize(const QString &name, const QString &use, const QString &free, const QString &all, int percent);
public:
QColor getBgColor() const;
QColor getChunkColor1() const;
QColor getChunkColor2() const;
QColor getChunkColor3() const;
QColor getTextColor1() const;
QColor getTextColor2() const;
QColor getTextColor3() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
//获取和设置背景颜色
QColor getBgColor() const;
void setBgColor(const QColor &bgColor);
//获取和设置进度颜色1
QColor getChunkColor1() const;
void setChunkColor1(const QColor &chunkColor1);
//获取和设置进度颜色2
QColor getChunkColor2() const;
void setChunkColor2(const QColor &chunkColor2);
//获取和设置进度颜色3
QColor getChunkColor3() const;
void setChunkColor3(const QColor &chunkColor3);
//获取和设置文字颜色1
QColor getTextColor1() const;
void setTextColor1(const QColor &textColor1);
//获取和设置文字颜色2
QColor getTextColor2() const;
void setTextColor2(const QColor &textColor2);
//获取和设置文字颜色3
QColor getTextColor3() const;
void setTextColor3(const QColor &textColor3);
public Q_SLOTS:
//载入容量
void load();
//设置背景颜色
void setBgColor(const QColor &bgColor);
//设置进度颜色
void setChunkColor1(const QColor &chunkColor1);
void setChunkColor2(const QColor &chunkColor2);
void setChunkColor3(const QColor &chunkColor3);
//设置文字颜色
void setTextColor1(const QColor &textColor1);
void setTextColor2(const QColor &textColor2);
void setTextColor3(const QColor &textColor3);
Q_SIGNALS:
void sdcardReceive(const QString &sdcardName);
void udiskReceive(const QString &udiskName);

View File

@@ -36,16 +36,6 @@ void ImageSwitch::paintEvent(QPaintEvent *)
painter.drawImage(point, img);
}
bool ImageSwitch::getChecked() const
{
return isChecked;
}
ImageSwitch::ButtonStyle ImageSwitch::getButtonStyle() const
{
return this->buttonStyle;
}
QSize ImageSwitch::sizeHint() const
{
return QSize(87, 28);
@@ -56,6 +46,11 @@ QSize ImageSwitch::minimumSizeHint() const
return QSize(87, 28);
}
bool ImageSwitch::getChecked() const
{
return isChecked;
}
void ImageSwitch::setChecked(bool isChecked)
{
if (this->isChecked != isChecked) {
@@ -65,6 +60,11 @@ void ImageSwitch::setChecked(bool isChecked)
}
}
ImageSwitch::ButtonStyle ImageSwitch::getButtonStyle() const
{
return this->buttonStyle;
}
void ImageSwitch::setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle)
{
if (this->buttonStyle != buttonStyle) {

View File

@@ -36,24 +36,24 @@ protected:
void paintEvent(QPaintEvent *event);
private:
bool isChecked;
ButtonStyle buttonStyle;
bool isChecked; //是否选中
ButtonStyle buttonStyle; //按钮样式
QString imgOffFile;
QString imgOnFile;
QString imgFile;
QString imgOffFile; //关闭图片
QString imgOnFile; //开启图片
QString imgFile; //当前图片
public:
bool getChecked() const;
ButtonStyle getButtonStyle() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置是否选中
//获取和设置是否选中
bool getChecked() const;
void setChecked(bool isChecked);
//设置按钮样式
//获取和设置按钮样式
ButtonStyle getButtonStyle() const;
void setButtonStyle(const ImageSwitch::ButtonStyle &buttonStyle);
Q_SIGNALS:

View File

@@ -144,11 +144,6 @@ void IPAddress::textChanged(const QString &text)
ip = QString("%1.%2.%3.%4").arg(txtIP1->text()).arg(txtIP2->text()).arg(txtIP3->text()).arg(txtIP4->text());
}
QString IPAddress::getIP() const
{
return this->ip;
}
QSize IPAddress::sizeHint() const
{
return QSize(250, 20);
@@ -159,6 +154,11 @@ QSize IPAddress::minimumSizeHint() const
return QSize(30, 10);
}
QString IPAddress::getIP() const
{
return this->ip;
}
void IPAddress::setIP(const QString &ip)
{
//先检测IP地址是否合法

View File

@@ -52,15 +52,14 @@ private slots:
void textChanged(const QString &text);
public:
//获取IP地址
QString getIP() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置IP地址
//获取和设置IP地址
QString getIP() const;
void setIP(const QString &ip);
//清空
void clear();
@@ -70,7 +69,6 @@ public Q_SLOTS:
void setBorderColor(const QString &borderColor);
//设置边框圆角角度
void setBorderRadius(int borderRadius);
};
#endif // IPADDRESS_H

View File

@@ -185,71 +185,6 @@ void LightButton::drawOverlay(QPainter *painter)
painter->restore();
}
QString LightButton::getText() const
{
return this->text;
}
QColor LightButton::getTextColor() const
{
return this->textColor;
}
QColor LightButton::getAlarmColor() const
{
return this->alarmColor;
}
QColor LightButton::getNormalColor() const
{
return this->normalColor;
}
QColor LightButton::getBorderOutColorStart() const
{
return this->borderOutColorStart;
}
QColor LightButton::getBorderOutColorEnd() const
{
return this->borderOutColorEnd;
}
QColor LightButton::getBorderInColorStart() const
{
return this->borderInColorStart;
}
QColor LightButton::getBorderInColorEnd() const
{
return this->borderInColorEnd;
}
QColor LightButton::getBgColor() const
{
return this->bgColor;
}
bool LightButton::getCanMove() const
{
return this->canMove;
}
bool LightButton::getShowRect() const
{
return this->showRect;
}
bool LightButton::getShowOverlay() const
{
return this->showOverlay;
}
QColor LightButton::getOverlayColor() const
{
return this->overlayColor;
}
QSize LightButton::sizeHint() const
{
return QSize(100, 100);
@@ -260,6 +195,11 @@ QSize LightButton::minimumSizeHint() const
return QSize(10, 10);
}
QString LightButton::getText() const
{
return this->text;
}
void LightButton::setText(const QString &text)
{
if (this->text != text) {
@@ -268,6 +208,11 @@ void LightButton::setText(const QString &text)
}
}
QColor LightButton::getTextColor() const
{
return this->textColor;
}
void LightButton::setTextColor(const QColor &textColor)
{
if (this->textColor != textColor) {
@@ -276,6 +221,11 @@ void LightButton::setTextColor(const QColor &textColor)
}
}
QColor LightButton::getAlarmColor() const
{
return this->alarmColor;
}
void LightButton::setAlarmColor(const QColor &alarmColor)
{
if (this->alarmColor != alarmColor) {
@@ -284,6 +234,11 @@ void LightButton::setAlarmColor(const QColor &alarmColor)
}
}
QColor LightButton::getNormalColor() const
{
return this->normalColor;
}
void LightButton::setNormalColor(const QColor &normalColor)
{
if (this->normalColor != normalColor) {
@@ -292,6 +247,11 @@ void LightButton::setNormalColor(const QColor &normalColor)
}
}
QColor LightButton::getBorderOutColorStart() const
{
return this->borderOutColorStart;
}
void LightButton::setBorderOutColorStart(const QColor &borderOutColorStart)
{
if (this->borderOutColorStart != borderOutColorStart) {
@@ -300,6 +260,11 @@ void LightButton::setBorderOutColorStart(const QColor &borderOutColorStart)
}
}
QColor LightButton::getBorderOutColorEnd() const
{
return this->borderOutColorEnd;
}
void LightButton::setBorderOutColorEnd(const QColor &borderOutColorEnd)
{
if (this->borderOutColorEnd != borderOutColorEnd) {
@@ -308,6 +273,11 @@ void LightButton::setBorderOutColorEnd(const QColor &borderOutColorEnd)
}
}
QColor LightButton::getBorderInColorStart() const
{
return this->borderInColorStart;
}
void LightButton::setBorderInColorStart(const QColor &borderInColorStart)
{
if (this->borderInColorStart != borderInColorStart) {
@@ -316,6 +286,11 @@ void LightButton::setBorderInColorStart(const QColor &borderInColorStart)
}
}
QColor LightButton::getBorderInColorEnd() const
{
return this->borderInColorEnd;
}
void LightButton::setBorderInColorEnd(const QColor &borderInColorEnd)
{
if (this->borderInColorEnd != borderInColorEnd) {
@@ -324,6 +299,11 @@ void LightButton::setBorderInColorEnd(const QColor &borderInColorEnd)
}
}
QColor LightButton::getBgColor() const
{
return this->bgColor;
}
void LightButton::setBgColor(const QColor &bgColor)
{
if (this->bgColor != bgColor) {
@@ -332,6 +312,11 @@ void LightButton::setBgColor(const QColor &bgColor)
}
}
bool LightButton::getCanMove() const
{
return this->canMove;
}
void LightButton::setCanMove(bool canMove)
{
if (this->canMove != canMove) {
@@ -340,6 +325,11 @@ void LightButton::setCanMove(bool canMove)
}
}
bool LightButton::getShowRect() const
{
return this->showRect;
}
void LightButton::setShowRect(bool showRect)
{
if (this->showRect != showRect) {
@@ -348,6 +338,11 @@ void LightButton::setShowRect(bool showRect)
}
}
bool LightButton::getShowOverlay() const
{
return this->showOverlay;
}
void LightButton::setShowOverlay(bool showOverlay)
{
if (this->showOverlay != showOverlay) {
@@ -356,6 +351,11 @@ void LightButton::setShowOverlay(bool showOverlay)
}
}
QColor LightButton::getOverlayColor() const
{
return this->overlayColor;
}
void LightButton::setOverlayColor(const QColor &overlayColor)
{
if (this->overlayColor != overlayColor) {

View File

@@ -55,78 +55,84 @@ protected:
void drawOverlay(QPainter *painter);
private:
QString text; //文本
QColor textColor; //文字颜色
QColor alarmColor; //报警颜色
QColor normalColor; //正常颜色
QString text; //文本
QColor textColor; //文字颜色
QColor alarmColor; //报警颜色
QColor normalColor; //正常颜色
QColor borderOutColorStart; //外边框渐变开始颜色
QColor borderOutColorEnd; //外边框渐变结束颜色
QColor borderInColorStart; //里边框渐变开始颜色
QColor borderInColorEnd; //里边框渐变结束颜色
QColor bgColor; //背景颜色
QColor borderOutColorStart; //外边框渐变开始颜色
QColor borderOutColorEnd; //外边框渐变结束颜色
QColor borderInColorStart; //里边框渐变开始颜色
QColor borderInColorEnd; //里边框渐变结束颜色
QColor bgColor; //背景颜色
bool showRect; //显示成矩形
bool canMove; //是否能够移动
bool showOverlay; //是否显示遮罩层
QColor overlayColor; //遮罩层颜色
bool showRect; //显示成矩形
bool canMove; //是否能够移动
bool showOverlay; //是否显示遮罩层
QColor overlayColor; //遮罩层颜色
bool pressed; //鼠标是否按下
QPoint lastPoint; //鼠标最后按下坐标
bool pressed; //鼠标是否按下
QPoint lastPoint; //鼠标最后按下坐标
bool isAlarm; //是否报警
QTimer *timerAlarm; //定时器切换颜色
bool isAlarm; //是否报警
QTimer *timerAlarm; //定时器切换颜色
public:
QString getText() const;
QColor getTextColor() const;
QColor getAlarmColor() const;
QColor getNormalColor() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
QColor getBorderOutColorStart() const;
QColor getBorderOutColorEnd() const;
QColor getBorderInColorStart() const;
QColor getBorderInColorEnd() const;
QColor getBgColor() const;
bool getCanMove() const;
bool getShowRect() const;
bool getShowOverlay() const;
QColor getOverlayColor() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置文本
//获取和设置文本
QString getText() const;
void setText(const QString &text);
//设置文本颜色
//获取和设置文本颜色
QColor getTextColor() const;
void setTextColor(const QColor &textColor);
//设置报警颜色+正常颜色
//获取和设置报警颜色
QColor getAlarmColor() const;
void setAlarmColor(const QColor &alarmColor);
//获取和设置正常颜色
QColor getNormalColor() const;
void setNormalColor(const QColor &normalColor);
//设置外边框渐变颜色
//获取和设置外边框渐变颜色
QColor getBorderOutColorStart() const;
void setBorderOutColorStart(const QColor &borderOutColorStart);
QColor getBorderOutColorEnd() const;
void setBorderOutColorEnd(const QColor &borderOutColorEnd);
//设置里边框渐变颜色
//获取和设置里边框渐变颜色
QColor getBorderInColorStart() const;
void setBorderInColorStart(const QColor &borderInColorStart);
QColor getBorderInColorEnd() const;
void setBorderInColorEnd(const QColor &borderInColorEnd);
//设置背景色
//获取和设置背景色
QColor getBgColor() const;
void setBgColor(const QColor &bgColor);
//设置是否可移动
//获取和设置是否可移动
bool getCanMove() const;
void setCanMove(bool canMove);
//设置是否显示矩形
//获取和设置是否显示矩形
bool getShowRect() const;
void setShowRect(bool showRect);
//设置是否显示遮罩层
//获取和设置是否显示遮罩层
bool getShowOverlay() const;
void setShowOverlay(bool showOverlay);
//设置遮罩层颜色
//获取和设置遮罩层颜色
QColor getOverlayColor() const;
void setOverlayColor(const QColor &overlayColor);
public Q_SLOTS:
//设置为绿色
void setGreen();
//设置为红色
@@ -139,6 +145,7 @@ public Q_SLOTS:
void setGray();
//设置为蓝色
void setBlue();
//设置为淡蓝色
void setLightBlue();
//设置为淡红色

View File

@@ -249,136 +249,6 @@ void NavButton::drawTriangle(QPainter *painter)
painter->restore();
}
int NavButton::getPaddingLeft() const
{
return this->paddingLeft;
}
int NavButton::getPaddingRight() const
{
return this->paddingRight;
}
int NavButton::getPaddingTop() const
{
return this->paddingTop;
}
int NavButton::getPaddingBottom() const
{
return this->paddingBottom;
}
NavButton::TextAlign NavButton::getTextAlign() const
{
return this->textAlign;
}
bool NavButton::getShowTriangle() const
{
return this->showTriangle;
}
int NavButton::getTriangleLen() const
{
return this->triangleLen;
}
NavButton::TrianglePosition NavButton::getTrianglePosition() const
{
return this->trianglePosition;
}
QColor NavButton::getTriangleColor() const
{
return this->triangleColor;
}
bool NavButton::getShowIcon() const
{
return this->showIcon;
}
int NavButton::getIconSpace() const
{
return this->iconSpace;
}
QSize NavButton::getIconSize() const
{
return this->iconSize;
}
QPixmap NavButton::getIconNormal() const
{
return this->iconNormal;
}
QPixmap NavButton::getIconHover() const
{
return this->iconHover;
}
QPixmap NavButton::getIconCheck() const
{
return this->iconCheck;
}
bool NavButton::getShowLine() const
{
return this->showLine;
}
int NavButton::getLineSpace() const
{
return this->lineSpace;
}
int NavButton::getLineWidth() const
{
return this->lineWidth;
}
NavButton::LinePosition NavButton::getLinePosition() const
{
return this->linePosition;
}
QColor NavButton::getLineColor() const
{
return this->lineColor;
}
QColor NavButton::getNormalBgColor() const
{
return this->normalBgColor;
}
QColor NavButton::getHoverBgColor() const
{
return this->hoverBgColor;
}
QColor NavButton::getCheckBgColor() const
{
return this->checkBgColor;
}
QColor NavButton::getNormalTextColor() const
{
return this->normalTextColor;
}
QColor NavButton::getHoverTextColor() const
{
return this->hoverTextColor;
}
QColor NavButton::getCheckTextColor() const
{
return this->checkTextColor;
}
QSize NavButton::sizeHint() const
{
return QSize(100, 30);
@@ -389,6 +259,11 @@ QSize NavButton::minimumSizeHint() const
return QSize(20, 10);
}
int NavButton::getPaddingLeft() const
{
return this->paddingLeft;
}
void NavButton::setPaddingLeft(int paddingLeft)
{
if (this->paddingLeft != paddingLeft) {
@@ -397,6 +272,11 @@ void NavButton::setPaddingLeft(int paddingLeft)
}
}
int NavButton::getPaddingRight() const
{
return this->paddingRight;
}
void NavButton::setPaddingRight(int paddingRight)
{
if (this->paddingRight != paddingRight) {
@@ -405,6 +285,11 @@ void NavButton::setPaddingRight(int paddingRight)
}
}
int NavButton::getPaddingTop() const
{
return this->paddingTop;
}
void NavButton::setPaddingTop(int paddingTop)
{
if (this->paddingTop != paddingTop) {
@@ -413,6 +298,11 @@ void NavButton::setPaddingTop(int paddingTop)
}
}
int NavButton::getPaddingBottom() const
{
return this->paddingBottom;
}
void NavButton::setPaddingBottom(int paddingBottom)
{
if (this->paddingBottom != paddingBottom) {
@@ -435,6 +325,11 @@ void NavButton::setPadding(int paddingLeft, int paddingRight, int paddingTop, in
this->update();
}
NavButton::TextAlign NavButton::getTextAlign() const
{
return this->textAlign;
}
void NavButton::setTextAlign(const NavButton::TextAlign &textAlign)
{
if (this->textAlign != textAlign) {
@@ -443,6 +338,11 @@ void NavButton::setTextAlign(const NavButton::TextAlign &textAlign)
}
}
bool NavButton::getShowTriangle() const
{
return this->showTriangle;
}
void NavButton::setShowTriangle(bool showTriangle)
{
if (this->showTriangle != showTriangle) {
@@ -451,6 +351,11 @@ void NavButton::setShowTriangle(bool showTriangle)
}
}
int NavButton::getTriangleLen() const
{
return this->triangleLen;
}
void NavButton::setTriangleLen(int triangleLen)
{
if (this->triangleLen != triangleLen) {
@@ -459,6 +364,11 @@ void NavButton::setTriangleLen(int triangleLen)
}
}
NavButton::TrianglePosition NavButton::getTrianglePosition() const
{
return this->trianglePosition;
}
void NavButton::setTrianglePosition(const NavButton::TrianglePosition &trianglePosition)
{
if (this->trianglePosition != trianglePosition) {
@@ -467,6 +377,11 @@ void NavButton::setTrianglePosition(const NavButton::TrianglePosition &triangleP
}
}
QColor NavButton::getTriangleColor() const
{
return this->triangleColor;
}
void NavButton::setTriangleColor(const QColor &triangleColor)
{
if (this->triangleColor != triangleColor) {
@@ -475,6 +390,11 @@ void NavButton::setTriangleColor(const QColor &triangleColor)
}
}
bool NavButton::getShowIcon() const
{
return this->showIcon;
}
void NavButton::setShowIcon(bool showIcon)
{
if (this->showIcon != showIcon) {
@@ -483,6 +403,11 @@ void NavButton::setShowIcon(bool showIcon)
}
}
int NavButton::getIconSpace() const
{
return this->iconSpace;
}
void NavButton::setIconSpace(int iconSpace)
{
if (this->iconSpace != iconSpace) {
@@ -491,6 +416,11 @@ void NavButton::setIconSpace(int iconSpace)
}
}
QSize NavButton::getIconSize() const
{
return this->iconSize;
}
void NavButton::setIconSize(const QSize &iconSize)
{
if (this->iconSize != iconSize) {
@@ -499,24 +429,44 @@ void NavButton::setIconSize(const QSize &iconSize)
}
}
QPixmap NavButton::getIconNormal() const
{
return this->iconNormal;
}
void NavButton::setIconNormal(const QPixmap &iconNormal)
{
this->iconNormal = iconNormal;
this->update();
}
QPixmap NavButton::getIconHover() const
{
return this->iconHover;
}
void NavButton::setIconHover(const QPixmap &iconHover)
{
this->iconHover = iconHover;
this->update();
}
QPixmap NavButton::getIconCheck() const
{
return this->iconCheck;
}
void NavButton::setIconCheck(const QPixmap &iconCheck)
{
this->iconCheck = iconCheck;
this->update();
}
bool NavButton::getShowLine() const
{
return this->showLine;
}
void NavButton::setShowLine(bool showLine)
{
if (this->showLine != showLine) {
@@ -525,6 +475,11 @@ void NavButton::setShowLine(bool showLine)
}
}
int NavButton::getLineSpace() const
{
return this->lineSpace;
}
void NavButton::setLineSpace(int lineSpace)
{
if (this->lineSpace != lineSpace) {
@@ -533,6 +488,11 @@ void NavButton::setLineSpace(int lineSpace)
}
}
int NavButton::getLineWidth() const
{
return this->lineWidth;
}
void NavButton::setLineWidth(int lineWidth)
{
if (this->lineWidth != lineWidth) {
@@ -541,6 +501,11 @@ void NavButton::setLineWidth(int lineWidth)
}
}
NavButton::LinePosition NavButton::getLinePosition() const
{
return this->linePosition;
}
void NavButton::setLinePosition(const NavButton::LinePosition &linePosition)
{
if (this->linePosition != linePosition) {
@@ -549,6 +514,11 @@ void NavButton::setLinePosition(const NavButton::LinePosition &linePosition)
}
}
QColor NavButton::getLineColor() const
{
return this->lineColor;
}
void NavButton::setLineColor(const QColor &lineColor)
{
if (this->lineColor != lineColor) {
@@ -557,6 +527,11 @@ void NavButton::setLineColor(const QColor &lineColor)
}
}
QColor NavButton::getNormalBgColor() const
{
return this->normalBgColor;
}
void NavButton::setNormalBgColor(const QColor &normalBgColor)
{
if (this->normalBgColor != normalBgColor) {
@@ -565,6 +540,11 @@ void NavButton::setNormalBgColor(const QColor &normalBgColor)
}
}
QColor NavButton::getHoverBgColor() const
{
return this->hoverBgColor;
}
void NavButton::setHoverBgColor(const QColor &hoverBgColor)
{
if (this->hoverBgColor != hoverBgColor) {
@@ -573,6 +553,11 @@ void NavButton::setHoverBgColor(const QColor &hoverBgColor)
}
}
QColor NavButton::getCheckBgColor() const
{
return this->checkBgColor;
}
void NavButton::setCheckBgColor(const QColor &checkBgColor)
{
if (this->checkBgColor != checkBgColor) {
@@ -581,6 +566,11 @@ void NavButton::setCheckBgColor(const QColor &checkBgColor)
}
}
QColor NavButton::getNormalTextColor() const
{
return this->normalTextColor;
}
void NavButton::setNormalTextColor(const QColor &normalTextColor)
{
if (this->normalTextColor != normalTextColor) {
@@ -589,6 +579,12 @@ void NavButton::setNormalTextColor(const QColor &normalTextColor)
}
}
QColor NavButton::getHoverTextColor() const
{
return this->hoverTextColor;
}
void NavButton::setHoverTextColor(const QColor &hoverTextColor)
{
if (this->hoverTextColor != hoverTextColor) {
@@ -597,6 +593,11 @@ void NavButton::setHoverTextColor(const QColor &hoverTextColor)
}
}
QColor NavButton::getCheckTextColor() const
{
return this->checkTextColor;
}
void NavButton::setCheckTextColor(const QColor &checkTextColor)
{
if (this->checkTextColor != checkTextColor) {

View File

@@ -102,135 +102,154 @@ protected:
void drawTriangle(QPainter *painter);
private:
int paddingLeft; //文字左侧间隔
int paddingRight; //文字右侧间隔
int paddingTop; //文字顶部间隔
int paddingBottom; //文字底部间隔
TextAlign textAlign; //文字对齐
int paddingLeft; //文字左侧间隔
int paddingRight; //文字右侧间隔
int paddingTop; //文字顶部间隔
int paddingBottom; //文字底部间隔
TextAlign textAlign; //文字对齐
bool showTriangle; //显示倒三角
int triangleLen; //倒三角边长
TrianglePosition trianglePosition; //倒三角位置
QColor triangleColor; //倒三角颜色
bool showTriangle; //显示倒三角
int triangleLen; //倒三角边长
TrianglePosition trianglePosition;//倒三角位置
QColor triangleColor; //倒三角颜色
bool showIcon; //显示图标
int iconSpace; //图标间隔
QSize iconSize; //图标尺寸
QPixmap iconNormal; //正常图标
QPixmap iconHover; //悬停图标
QPixmap iconCheck; //选中图标
bool showIcon; //显示图标
int iconSpace; //图标间隔
QSize iconSize; //图标尺寸
QPixmap iconNormal; //正常图标
QPixmap iconHover; //悬停图标
QPixmap iconCheck; //选中图标
bool showLine; //显示线条
int lineSpace; //线条间隔
int lineWidth; //线条宽度
LinePosition linePosition; //线条位置
QColor lineColor; //线条颜色
bool showLine; //显示线条
int lineSpace; //线条间隔
int lineWidth; //线条宽度
LinePosition linePosition; //线条位置
QColor lineColor; //线条颜色
QColor normalBgColor; //正常背景颜色
QColor hoverBgColor; //悬停背景颜色
QColor checkBgColor; //选中背景颜色
QColor normalTextColor; //正常文字颜色
QColor hoverTextColor; //悬停文字颜色
QColor checkTextColor; //选中文字颜色
QColor normalBgColor; //正常背景颜色
QColor hoverBgColor; //悬停背景颜色
QColor checkBgColor; //选中背景颜色
QColor normalTextColor; //正常文字颜色
QColor hoverTextColor; //悬停文字颜色
QColor checkTextColor; //选中文字颜色
QBrush normalBgBrush; //正常背景画刷
QBrush hoverBgBrush; //悬停背景画刷
QBrush checkBgBrush; //选中背景画刷
QBrush normalBgBrush; //正常背景画刷
QBrush hoverBgBrush; //悬停背景画刷
QBrush checkBgBrush; //选中背景画刷
bool hover; //悬停标志位
bool hover; //悬停标志位
public:
int getPaddingLeft() const;
int getPaddingRight() const;
int getPaddingTop() const;
int getPaddingBottom() const;
TextAlign getTextAlign() const;
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
bool getShowTriangle() const;
int getTriangleLen() const;
TrianglePosition getTrianglePosition()const;
QColor getTriangleColor() const;
bool getShowIcon() const;
int getIconSpace() const;
QSize getIconSize() const;
QPixmap getIconNormal() const;
QPixmap getIconHover() const;
QPixmap getIconCheck() const;
bool getShowLine() const;
int getLineSpace() const;
int getLineWidth() const;
LinePosition getLinePosition() const;
QColor getLineColor() const;
QColor getNormalBgColor() const;
QColor getHoverBgColor() const;
QColor getCheckBgColor() const;
QColor getNormalTextColor() const;
QColor getHoverTextColor() const;
QColor getCheckTextColor() const;
QSize sizeHint() const;
QSize minimumSizeHint() const;
public Q_SLOTS:
//设置文字间隔
//获取和设置文字左侧间隔
int getPaddingLeft() const;
void setPaddingLeft(int paddingLeft);
//获取和设置文字左侧间隔
int getPaddingRight() const;
void setPaddingRight(int paddingRight);
//获取和设置文字顶部间隔
int getPaddingTop() const;
void setPaddingTop(int paddingTop);
//获取和设置文字底部间隔
int getPaddingBottom() const;
void setPaddingBottom(int paddingBottom);
//设置边距
void setPadding(int padding);
void setPadding(int paddingLeft, int paddingRight, int paddingTop, int paddingBottom);
//设置文字对齐
//获取和设置文字对齐
TextAlign getTextAlign() const;
void setTextAlign(const TextAlign &textAlign);
//设置显示倒三角
//获取和设置显示倒三角
bool getShowTriangle() const;
void setShowTriangle(bool showTriangle);
//设置倒三角边长
//获取和设置倒三角边长
int getTriangleLen() const;
void setTriangleLen(int triangleLen);
//设置倒三角位置
//获取和设置倒三角位置
TrianglePosition getTrianglePosition() const;
void setTrianglePosition(const TrianglePosition &trianglePosition);
//设置倒三角颜色
//获取和设置倒三角颜色
QColor getTriangleColor() const;
void setTriangleColor(const QColor &triangleColor);
//设置显示图标
//获取和设置显示图标
bool getShowIcon() const;
void setShowIcon(bool showIcon);
//设置图标间隔
//获取和设置图标间隔
int getIconSpace() const;
void setIconSpace(int iconSpace);
//设置图标尺寸
//获取和设置图标尺寸
QSize getIconSize() const;
void setIconSize(const QSize &iconSize);
//设置正常图标
//获取和设置正常图标
QPixmap getIconNormal() const;
void setIconNormal(const QPixmap &iconNormal);
//设置悬停图标
//获取和设置悬停图标
QPixmap getIconHover() const;
void setIconHover(const QPixmap &iconHover);
//设置按下图标
//获取和设置按下图标
QPixmap getIconCheck() const;
void setIconCheck(const QPixmap &iconCheck);
//设置显示线条
//获取和设置显示线条
bool getShowLine() const;
void setShowLine(bool showLine);
//设置线条间隔
//获取和设置线条间隔
int getLineSpace() const;
void setLineSpace(int lineSpace);
//设置线条宽度
//获取和设置线条宽度
int getLineWidth() const;
void setLineWidth(int lineWidth);
//设置线条位置
//获取和设置线条位置
LinePosition getLinePosition() const;
void setLinePosition(const LinePosition &linePosition);
//设置线条颜色
//获取和设置线条颜色
QColor getLineColor() const;
void setLineColor(const QColor &lineColor);
//设置正常背景颜色
//获取和设置正常背景颜色
QColor getNormalBgColor() const;
void setNormalBgColor(const QColor &normalBgColor);
//设置悬停背景颜色
//获取和设置悬停背景颜色
QColor getHoverBgColor() const;
void setHoverBgColor(const QColor &hoverBgColor);
//设置选中背景颜色
//获取和设置选中背景颜色
QColor getCheckBgColor() const;
void setCheckBgColor(const QColor &checkBgColor);
//设置正常文字颜色
//获取和设置正常文字颜色
QColor getNormalTextColor() const;
void setNormalTextColor(const QColor &normalTextColor);
//设置悬停文字颜色
//获取和设置悬停文字颜色
QColor getHoverTextColor() const;
void setHoverTextColor(const QColor &hoverTextColor);
//设置选中文字颜色
//获取和设置选中文字颜色
QColor getCheckTextColor() const;
void setCheckTextColor(const QColor &checkTextColor);
//设置正常背景画刷
@@ -239,7 +258,6 @@ public Q_SLOTS:
void setHoverBgBrush(const QBrush &hoverBgBrush);
//设置选中背景画刷
void setCheckBgBrush(const QBrush &checkBgBrush);
};
#endif // NAVBUTTON_H

View File

@@ -123,7 +123,7 @@ SaveLog::SaveLog(QObject *parent) : QObject(parent)
SaveLog::~SaveLog()
{
file->close();
this->stop();
}
void SaveLog::openFile(const QString &fileName)

View File

@@ -39,6 +39,11 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
connect(timerSave, SIGNAL(timeout()), this, SLOT(saveLog()));
}
SaveRunTime::~SaveRunTime()
{
this->stop();
}
void SaveRunTime::getDiffValue(const QDateTime &startTime, const QDateTime &endTime, int &day, int &hour, int &minute)
{
qint64 sec = startTime.secsTo(endTime);

View File

@@ -26,6 +26,7 @@ class SaveRunTime : public QObject
public:
static SaveRunTime *Instance();
explicit SaveRunTime(QObject *parent = 0);
~SaveRunTime();
private:
static QScopedPointer<SaveRunTime> self;