diff --git a/battery/battery.cpp b/battery/battery.cpp index 8a5a909..9ef0ab1 100644 --- a/battery/battery.cpp +++ b/battery/battery.cpp @@ -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) diff --git a/battery/battery.h b/battery/battery.h index 5f92fe5..7df5486 100644 --- a/battery/battery.h +++ b/battery/battery.h @@ -14,25 +14,20 @@ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#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 diff --git a/buttondefence/buttondefence.cpp b/buttondefence/buttondefence.cpp index 3d424e8..2abc2eb 100644 --- a/buttondefence/buttondefence.cpp +++ b/buttondefence/buttondefence.cpp @@ -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); diff --git a/buttondefence/buttondefence.h b/buttondefence/buttondefence.h index c52f103..8c300bc 100644 --- a/buttondefence/buttondefence.h +++ b/buttondefence/buttondefence.h @@ -14,13 +14,7 @@ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#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 }; //防区状态 布防、撤防、报警、旁路、故障 diff --git a/buttondefence/frmbuttondefence.cpp b/buttondefence/frmbuttondefence.cpp index 8b505b9..03cce01 100644 --- a/buttondefence/frmbuttondefence.cpp +++ b/buttondefence/frmbuttondefence.cpp @@ -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(); -} diff --git a/buttondefence/frmbuttondefence.h b/buttondefence/frmbuttondefence.h index 0d27758..808eb22 100644 --- a/buttondefence/frmbuttondefence.h +++ b/buttondefence/frmbuttondefence.h @@ -25,8 +25,6 @@ private slots: void changeStatus(); void on_ckCanMove_stateChanged(int arg1); - void on_btnPoint_clicked(); - private: Ui::frmButtonDefence *ui; ButtonDefence *btn1; diff --git a/buttondefence/frmbuttondefence.ui b/buttondefence/frmbuttondefence.ui index 3d0af0d..5e914fc 100644 --- a/buttondefence/frmbuttondefence.ui +++ b/buttondefence/frmbuttondefence.ui @@ -87,13 +87,6 @@ - - - - 自定义 - - - @@ -136,13 +129,6 @@ - - - - Qt::Horizontal - - - @@ -150,13 +136,6 @@ - - - - 坐标 - - - @@ -176,21 +155,6 @@ - - btnCircle - btnPolice - btnBubble - btnBubble2 - btnMsg - btnMsg2 - btnCustom - btnArming - btnDisarming - btnAlarm - btnBypass - btnError - ckCanMove - diff --git a/buttondefence/main.qrc b/buttondefence/main.qrc index 2c02e87..562ef7e 100644 --- a/buttondefence/main.qrc +++ b/buttondefence/main.qrc @@ -31,10 +31,5 @@ image/btn_defence_error_msg2.png image/btn_defence_error_police.png image/bg_call.jpg - image/btn_defence_alarm_custom.png - image/btn_defence_arming_custom.png - image/btn_defence_bypass_custom.png - image/btn_defence_disarming_custom.png - image/btn_defence_error_custom.png diff --git a/colorwidget/colorwidget.cpp b/colorwidget/colorwidget.cpp index 192cadd..557f80e 100644 --- a/colorwidget/colorwidget.cpp +++ b/colorwidget/colorwidget.cpp @@ -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); diff --git a/colorwidget/colorwidget.h b/colorwidget/colorwidget.h index faa2934..bc6f927 100644 --- a/colorwidget/colorwidget.h +++ b/colorwidget/colorwidget.h @@ -9,13 +9,7 @@ class QLabel; class QLineEdit; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT ColorWidget : public QWidget +class Q_DECL_EXPORT ColorWidget : public QWidget #else class ColorWidget : public QWidget #endif diff --git a/countcode/frmcountcode.cpp b/countcode/frmcountcode.cpp index c55a301..197eab8 100644 --- a/countcode/frmcountcode.cpp +++ b/countcode/frmcountcode.cpp @@ -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; } diff --git a/countcode/snap.png b/countcode/snap.png new file mode 100644 index 0000000..cc8c1e7 Binary files /dev/null and b/countcode/snap.png differ diff --git a/devicesizetable/devicesizetable.h b/devicesizetable/devicesizetable.h index 9c60881..4fb6057 100644 --- a/devicesizetable/devicesizetable.h +++ b/devicesizetable/devicesizetable.h @@ -3,10 +3,10 @@ /** * 本地存储空间大小控件 作者:feiyangqingyun(QQ:517216493) 2016-11-30 - * 1:可自动加载本地存储设备的总容量/已用容量 - * 2:进度条显示已用容量 - * 3:支持所有操作系统 - * 4:增加U盘或者SD卡到达信号 + * 1. 可自动加载本地存储设备的总容量/已用容量 + * 2. 进度条显示已用容量 + * 3. 支持所有操作系统 + * 4. 增加U盘或者SD卡到达信号 */ #include @@ -14,13 +14,7 @@ class QProcess; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT DeviceSizeTable : public QTableWidget +class Q_DECL_EXPORT DeviceSizeTable : public QTableWidget #else class DeviceSizeTable : public QTableWidget #endif diff --git a/flatui/flatui.h b/flatui/flatui.h index 4009b2c..efeaece 100644 --- a/flatui/flatui.h +++ b/flatui/flatui.h @@ -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 @@ -24,13 +24,7 @@ class QCheckBox; class QScrollBar; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT FlatUI : public QObject +class Q_DECL_EXPORT FlatUI : public QObject #else class FlatUI : public QObject #endif diff --git a/framelesswidget/framelesswidget.h b/framelesswidget/framelesswidget.h index bdc59ee..59fea16 100644 --- a/framelesswidget/framelesswidget.h +++ b/framelesswidget/framelesswidget.h @@ -3,23 +3,17 @@ /** * 无边框窗体类 作者:feiyangqingyun(QQ:517216493) 2019-10-03 - * 1:可以指定需要无边框的widget - * 2:边框四周八个方位都可以自由拉伸 - * 3:可设置对应位置的边距,以便识别更大区域 - * 4:可设置是否允许拖动 - * 5:可设置是否允许拉伸 + * 1. 可以指定需要无边框的widget + * 2. 边框四周八个方位都可以自由拉伸 + * 3. 可设置对应位置的边距,以便识别更大区域 + * 4. 可设置是否允许拖动 + * 5. 可设置是否允许拉伸 */ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT FramelessWidget : public QObject +class Q_DECL_EXPORT FramelessWidget : public QObject #else class FramelessWidget : public QObject #endif diff --git a/gifwidget/gifwidget.h b/gifwidget/gifwidget.h index 4378aa4..b99ce25 100644 --- a/gifwidget/gifwidget.h +++ b/gifwidget/gifwidget.h @@ -3,11 +3,11 @@ /** * GIF录屏控件 作者:feiyangqingyun(QQ:517216493) 2019-4-3 - * 1:可设置要录制屏幕的宽高,支持右下角直接拉动改变. - * 2:可设置变宽的宽度 - * 3:可设置录屏控件的背景颜色 - * 4:可设置录制的帧数 - * 5:录制区域可自由拖动选择 + * 1. 可设置要录制屏幕的宽高,支持右下角直接拉动改变. + * 2. 可设置变宽的宽度 + * 3. 可设置录屏控件的背景颜色 + * 4. 可设置录制的帧数 + * 5. 录制区域可自由拖动选择 */ #include @@ -17,13 +17,7 @@ class QLineEdit; class QLabel; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT GifWidget : public QDialog +class Q_DECL_EXPORT GifWidget : public QDialog #else class GifWidget : public QDialog #endif diff --git a/imageswitch/imageswitch.h b/imageswitch/imageswitch.h index 8a3de52..a07e81d 100644 --- a/imageswitch/imageswitch.h +++ b/imageswitch/imageswitch.h @@ -3,20 +3,14 @@ /** * 图片开关控件 作者:feiyangqingyun(QQ:517216493) 2016-11-25 - * 1:自带三种开关按钮样式 - * 2:可自定义开关图片 + * 1. 自带三种开关按钮样式 + * 2. 可自定义开关图片 */ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT ImageSwitch : public QWidget +class Q_DECL_EXPORT ImageSwitch : public QWidget #else class ImageSwitch : public QWidget #endif diff --git a/ipaddress/ipaddress.cpp b/ipaddress/ipaddress.cpp index 0ed053e..2338ea6 100644 --- a/ipaddress/ipaddress.cpp +++ b/ipaddress/ipaddress.cpp @@ -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; diff --git a/ipaddress/ipaddress.h b/ipaddress/ipaddress.h index 0a48b85..cc95f4e 100644 --- a/ipaddress/ipaddress.h +++ b/ipaddress/ipaddress.h @@ -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 @@ -17,13 +17,7 @@ class QLabel; class QLineEdit; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT IPAddress : public QWidget +class Q_DECL_EXPORT IPAddress : public QWidget #else class IPAddress : public QWidget #endif diff --git a/lightbutton/lightbutton.h b/lightbutton/lightbutton.h index 09b1822..7fa9fa6 100644 --- a/lightbutton/lightbutton.h +++ b/lightbutton/lightbutton.h @@ -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 #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT LightButton : public QWidget +class Q_DECL_EXPORT LightButton : public QWidget #else class LightButton : public QWidget #endif diff --git a/lunarcalendarwidget/lunarcalendarinfo.h b/lunarcalendarwidget/lunarcalendarinfo.h index 845ce03..da108b3 100644 --- a/lunarcalendarwidget/lunarcalendarinfo.h +++ b/lunarcalendarwidget/lunarcalendarinfo.h @@ -3,23 +3,17 @@ /** * 农历信息类 作者:倪大侠 整理:feiyangqingyun(QQ:517216493) 2016-12-10 - * 1:计算是否闰年 - * 2:计算国际节日 - * 3:计算二十四节气 - * 4:计算农历年 天干+地支+生肖 - * 5:计算指定年月日农历信息,包括公历节日和农历节日及二十四节气 + * 1. 计算是否闰年 + * 2. 计算国际节日 + * 3. 计算二十四节气 + * 4. 计算农历年 天干+地支+生肖 + * 5. 计算指定年月日农历信息,包括公历节日和农历节日及二十四节气 */ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT LunarCalendarInfo : public QObject +class Q_DECL_EXPORT LunarCalendarInfo : public QObject #else class LunarCalendarInfo : public QObject #endif diff --git a/lunarcalendarwidget/lunarcalendaritem.h b/lunarcalendarwidget/lunarcalendaritem.h index 4060bee..de3e56e 100644 --- a/lunarcalendarwidget/lunarcalendaritem.h +++ b/lunarcalendarwidget/lunarcalendaritem.h @@ -5,13 +5,7 @@ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT LunarCalendarItem : public QWidget +class Q_DECL_EXPORT LunarCalendarItem : public QWidget #else class LunarCalendarItem : public QWidget #endif diff --git a/lunarcalendarwidget/lunarcalendarwidget.cpp b/lunarcalendarwidget/lunarcalendarwidget.cpp index 7d1c7ae..147b7cd 100644 --- a/lunarcalendarwidget/lunarcalendarwidget.cpp +++ b/lunarcalendarwidget/lunarcalendarwidget.cpp @@ -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); diff --git a/lunarcalendarwidget/lunarcalendarwidget.h b/lunarcalendarwidget/lunarcalendarwidget.h index b6e55ef..3043a2a 100644 --- a/lunarcalendarwidget/lunarcalendarwidget.h +++ b/lunarcalendarwidget/lunarcalendarwidget.h @@ -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 @@ -25,13 +25,7 @@ class QComboBox; class LunarCalendarItem; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT LunarCalendarWidget : public QWidget +class Q_DECL_EXPORT LunarCalendarWidget : public QWidget #else class LunarCalendarWidget : public QWidget #endif diff --git a/maskwidget/maskwidget.cpp b/maskwidget/maskwidget.cpp index ca1a68c..0cf5ede 100644 --- a/maskwidget/maskwidget.cpp +++ b/maskwidget/maskwidget.cpp @@ -2,8 +2,8 @@ #include "maskwidget.h" #include "qmutex.h" -#include "qapplication.h" #include "qdesktopwidget.h" +#include "qapplication.h" #include "qdebug.h" QScopedPointer 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); } diff --git a/maskwidget/maskwidget.h b/maskwidget/maskwidget.h index f3cc0ec..6e28ba4 100644 --- a/maskwidget/maskwidget.h +++ b/maskwidget/maskwidget.h @@ -3,23 +3,17 @@ /** * 弹窗遮罩层控件 作者:feiyangqingyun(QQ:517216493) 2016-12-26 - * 1:可设置需要遮罩的主窗体,自动跟随主窗体位置显示遮罩面积 - * 2:只需要将弹窗窗体的名称一开始传入队列即可,足够简单 - * 3:可设置透明度 - * 4:可设置遮罩层颜色 - * 5:不阻塞消息循坏 + * 1. 可设置需要遮罩的主窗体,自动跟随主窗体位置显示遮罩面积 + * 2. 只需要将弹窗窗体的名称一开始传入队列即可,足够简单 + * 3. 可设置透明度 + * 4. 可设置遮罩层颜色 + * 5. 不阻塞消息循坏 */ #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT MaskWidget : public QWidget +class Q_DECL_EXPORT MaskWidget : public QWidget #else class MaskWidget : public QWidget #endif diff --git a/navbutton/iconhelper.h b/navbutton/iconhelper.h index fb24137..992bc8d 100644 --- a/navbutton/iconhelper.h +++ b/navbutton/iconhelper.h @@ -7,8 +7,12 @@ #include #endif -//图形字体处理类 +#ifdef quc +class Q_DECL_EXPORT IconHelper : public QObject +#else class IconHelper : public QObject +#endif + { Q_OBJECT diff --git a/navbutton/navbutton.cpp b/navbutton/navbutton.cpp index 54b0910..d1000fb 100644 --- a/navbutton/navbutton.cpp +++ b/navbutton/navbutton.cpp @@ -43,6 +43,7 @@ NavButton::NavButton(QWidget *parent) : QPushButton(parent) hover = false; setCheckable(true); + setText("导航按钮"); } void NavButton::enterEvent(QEvent *) diff --git a/navbutton/navbutton.h b/navbutton/navbutton.h index fb8a671..69fc6f1 100644 --- a/navbutton/navbutton.h +++ b/navbutton/navbutton.h @@ -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 #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT NavButton : public QPushButton +class Q_DECL_EXPORT NavButton : public QPushButton #else class NavButton : public QPushButton #endif diff --git a/ntpclient/frmntpclient.ui b/ntpclient/frmntpclient.ui index 9d069ce..ac6e8db 100644 --- a/ntpclient/frmntpclient.ui +++ b/ntpclient/frmntpclient.ui @@ -33,7 +33,7 @@ - ntp1.aliyun.com + 133.100.11.8 diff --git a/ntpclient/ntpclient.h b/ntpclient/ntpclient.h index 7f1e475..f270b03 100644 --- a/ntpclient/ntpclient.h +++ b/ntpclient/ntpclient.h @@ -3,8 +3,8 @@ /** * Ntp校时类 作者:feiyangqingyun(QQ:517216493) 2017-2-16 - * 1:可设置Ntp服务器IP地址 - * 2:收到时间信号发出 + * 1. 可设置Ntp服务器IP地址 + * 2. 收到时间信号发出 */ #include @@ -12,13 +12,7 @@ class QUdpSocket; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#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 diff --git a/savelog/savelog.h b/savelog/savelog.h index 1b91931..b9d3190 100644 --- a/savelog/savelog.h +++ b/savelog/savelog.h @@ -8,13 +8,7 @@ class QTcpSocket; class QTcpServer; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT SaveLog : public QObject +class Q_DECL_EXPORT SaveLog : public QObject #else class SaveLog : public QObject #endif diff --git a/saveruntime/saveruntime.cpp b/saveruntime/saveruntime.cpp index d8ef753..5bfe6d2 100644 --- a/saveruntime/saveruntime.cpp +++ b/saveruntime/saveruntime.cpp @@ -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(); diff --git a/saveruntime/saveruntime.h b/saveruntime/saveruntime.h index 060539d..61394fc 100644 --- a/saveruntime/saveruntime.h +++ b/saveruntime/saveruntime.h @@ -6,13 +6,7 @@ class QTimer; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT SaveRunTime : public QObject +class Q_DECL_EXPORT SaveRunTime : public QObject #else class SaveRunTime : public QObject #endif diff --git a/screenwidget/screenwidget.h b/screenwidget/screenwidget.h index 2f2744e..8dbc0fa 100644 --- a/screenwidget/screenwidget.h +++ b/screenwidget/screenwidget.h @@ -3,9 +3,9 @@ /** * 全局截屏控件 作者:feiyangqingyun(QQ:517216493) 2016-11-11 - * 1:支持鼠标右键选择菜单 - * 2:支持全局截屏和局部截屏 - * 3:支持图片另存为 + * 1. 支持鼠标右键选择菜单 + * 2. 支持全局截屏和局部截屏 + * 3. 支持图片另存为 */ #include @@ -46,13 +46,7 @@ private: }; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT ScreenWidget : public QWidget +class Q_DECL_EXPORT ScreenWidget : public QWidget #else class ScreenWidget : public QWidget #endif diff --git a/videopanel/videopanel.cpp b/videopanel/videopanel.cpp index b1fffae..f07c459 100644 --- a/videopanel/videopanel.cpp +++ b/videopanel/videopanel.cpp @@ -56,7 +56,7 @@ void VideoPanel::initControl() { gridLayout = new QGridLayout; gridLayout->setSpacing(1); - gridLayout->setMargin(0); + gridLayout->setContentsMargins(0, 0, 0, 0); gridLayout->setObjectName("gridLayout"); this->setLayout(gridLayout); } diff --git a/videopanel/videopanel.h b/videopanel/videopanel.h index 80a39c4..5064d90 100644 --- a/videopanel/videopanel.h +++ b/videopanel/videopanel.h @@ -13,13 +13,7 @@ class QLabel; class QGridLayout; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT VideoPanel : public QWidget +class Q_DECL_EXPORT VideoPanel : public QWidget #else class VideoPanel : public QWidget #endif diff --git a/videowidget/videowidget.cpp b/videowidget/videowidget.cpp index 3ae38a8..bbce61f 100644 --- a/videowidget/videowidget.cpp +++ b/videowidget/videowidget.cpp @@ -81,7 +81,7 @@ void VideoWidget::initFlowPanel() //用布局顶住,左侧弹簧 QHBoxLayout *layout = new QHBoxLayout; layout->setSpacing(2); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->addStretch(); flowPanel->setLayout(layout); @@ -100,7 +100,7 @@ void VideoWidget::initFlowPanel() icons << QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton); #else QList chars; - chars << 0xe68d << 0xe672 << 0xe674 << 0xea36 << 0xe74c; + chars << QChar(0xe68d) << QChar(0xe672) << QChar(0xe674) << QChar(0xea36) << QChar(0xe74c); //判断图形字体是否存在,不存在则加入 QFont iconFont; @@ -277,7 +277,7 @@ void VideoWidget::drawBg(QPainter *painter) //背景图片为空则绘制文字,否则绘制背景图片 if (bgImage.isNull()) { painter->setFont(this->font()); - painter->setPen(palette().foreground().color()); + painter->setPen(palette().windowText().color()); painter->drawText(rect(), Qt::AlignCenter, bgText); } else { //居中绘制 diff --git a/videowidget/videowidget.h b/videowidget/videowidget.h index bf2d164..d42832a 100644 --- a/videowidget/videowidget.h +++ b/videowidget/videowidget.h @@ -23,13 +23,7 @@ class QTimer; #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT VideoWidget : public QWidget +class Q_DECL_EXPORT VideoWidget : public QWidget #else class VideoWidget : public QWidget #endif @@ -223,6 +217,11 @@ signals: //播放结束 void receivePlayFinsh(); + //总时长 + void fileLengthReceive(qint64 length); + //当前播放时长 + void filePositionReceive(qint64 position); + //收到图片信号 void receiveImage(const QImage &image); diff --git a/zhtopy/zhtopy.h b/zhtopy/zhtopy.h index 0625a79..45a138a 100644 --- a/zhtopy/zhtopy.h +++ b/zhtopy/zhtopy.h @@ -3,22 +3,16 @@ /** * 汉字转拼音类 作者:feiyangqingyun(QQ:517216493) 2019-2-16 - * 1:汉字转拼音 - * 2:汉字转拼音简拼 - * 3:汉字转拼音首字母 + * 1. 汉字转拼音 + * 2. 汉字转拼音简拼 + * 3. 汉字转拼音首字母 */ #include #include #ifdef quc -#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) -#include -#else -#include -#endif - -class QDESIGNER_WIDGET_EXPORT ZhToPY : public QObject +class Q_DECL_EXPORT ZhToPY : public QObject #else class ZhToPY : public QObject #endif