更新代码

master
feiyangqingyun 2020-12-24 18:00:09 +08:00
parent 13cdeacd63
commit 39dab8c3c0
40 changed files with 243 additions and 402 deletions

View File

@ -13,6 +13,7 @@ Battery::Battery(QWidget *parent) : QWidget(parent)
alarmValue = 30; alarmValue = 30;
step = 0.5; step = 0.5;
borderWidth = 5;
borderRadius = 8; borderRadius = 8;
bgRadius = 5; bgRadius = 5;
headRadius = 3; headRadius = 3;
@ -57,15 +58,15 @@ void Battery::drawBorder(QPainter *painter)
{ {
painter->save(); painter->save();
qreal headWidth = width() / 10; double headWidth = width() / 15;
qreal batteryWidth = width() - headWidth; double batteryWidth = width() - headWidth;
//绘制电池边框 //绘制电池边框
QPointF topLeft(5, 5); QPointF topLeft(borderWidth, borderWidth);
QPointF bottomRight(batteryWidth, height() - 5); QPointF bottomRight(batteryWidth, height() - borderWidth);
batteryRect = QRectF(topLeft, bottomRight); batteryRect = QRectF(topLeft, bottomRight);
painter->setPen(QPen(borderColorStart, 5)); painter->setPen(QPen(borderColorStart, borderWidth));
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
painter->drawRoundedRect(batteryRect, borderRadius, borderRadius); painter->drawRoundedRect(batteryRect, borderRadius, borderRadius);
@ -74,6 +75,10 @@ void Battery::drawBorder(QPainter *painter)
void Battery::drawBg(QPainter *painter) void Battery::drawBg(QPainter *painter)
{ {
if (value == minValue) {
return;
}
painter->save(); painter->save();
QLinearGradient batteryGradient(QPointF(0, 0), QPointF(0, height())); QLinearGradient batteryGradient(QPointF(0, 0), QPointF(0, height()));
@ -86,10 +91,10 @@ void Battery::drawBg(QPainter *painter)
} }
int margin = qMin(width(), height()) / 20; int margin = qMin(width(), height()) / 20;
qreal unit = (batteryRect.width() - (margin * 2)) / 100; double unit = (batteryRect.width() - (margin * 2)) / 100;
qreal width = currentValue * unit; double width = currentValue * unit;
QPointF topLeft(batteryRect.topLeft().x() + margin, batteryRect.topLeft().y() + margin); 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); QRectF rect(topLeft, bottomRight);
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
@ -122,13 +127,11 @@ void Battery::updateValue()
{ {
if (isForward) { if (isForward) {
currentValue -= step; currentValue -= step;
if (currentValue <= value) { if (currentValue <= value) {
timer->stop(); timer->stop();
} }
} else { } else {
currentValue += step; currentValue += step;
if (currentValue >= value) { if (currentValue >= value) {
timer->stop(); timer->stop();
} }
@ -137,31 +140,36 @@ void Battery::updateValue()
this->update(); this->update();
} }
qreal Battery::getMinValue() const double Battery::getMinValue() const
{ {
return this->minValue; return this->minValue;
} }
qreal Battery::getMaxValue() const double Battery::getMaxValue() const
{ {
return this->maxValue; return this->maxValue;
} }
qreal Battery::getValue() const double Battery::getValue() const
{ {
return this->value; return this->value;
} }
qreal Battery::getAlarmValue() const double Battery::getAlarmValue() const
{ {
return this->alarmValue; return this->alarmValue;
} }
qreal Battery::getStep() const double Battery::getStep() const
{ {
return this->step; return this->step;
} }
int Battery::getBorderWidth() const
{
return this->borderWidth;
}
int Battery::getBorderRadius() const int Battery::getBorderRadius() const
{ {
return this->borderRadius; return this->borderRadius;
@ -217,7 +225,7 @@ QSize Battery::minimumSizeHint() const
return QSize(30, 10); return QSize(30, 10);
} }
void Battery::setRange(qreal minValue, qreal maxValue) void Battery::setRange(double minValue, double maxValue)
{ {
//如果最小值大于或者等于最大值则不设置 //如果最小值大于或者等于最大值则不设置
if (minValue >= maxValue) { if (minValue >= maxValue) {
@ -240,20 +248,20 @@ void Battery::setRange(qreal minValue, qreal maxValue)
void Battery::setRange(int minValue, int 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); setRange(minValue, maxValue);
} }
void Battery::setMaxValue(qreal maxValue) void Battery::setMaxValue(double maxValue)
{ {
setRange(minValue, maxValue); setRange(minValue, maxValue);
} }
void Battery::setValue(qreal value) void Battery::setValue(double value)
{ {
//值和当前值一致则无需处理 //值和当前值一致则无需处理
if (value == this->value) { if (value == this->value) {
@ -272,21 +280,24 @@ void Battery::setValue(qreal value)
} else if (value < currentValue) { } else if (value < currentValue) {
isForward = true; isForward = true;
} else { } else {
this->value = value;
this->update();
return; return;
} }
this->value = value; this->value = value;
this->update(); this->update();
emit valueChanged(value); emit valueChanged(value);
timer->stop();
timer->start(); timer->start();
} }
void Battery::setValue(int value) 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) { if (this->alarmValue != alarmValue) {
this->alarmValue = alarmValue; this->alarmValue = alarmValue;
@ -296,10 +307,10 @@ void Battery::setAlarmValue(qreal alarmValue)
void Battery::setAlarmValue(int 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) { if (this->step != step) {
this->step = step; this->step = step;
@ -309,7 +320,15 @@ void Battery::setStep(qreal step)
void Battery::setStep(int 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) void Battery::setBorderRadius(int borderRadius)

View File

@ -14,25 +14,20 @@
#include <QWidget> #include <QWidget>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT Battery : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT Battery : public QWidget
#else #else
class Battery : public QWidget class Battery : public QWidget
#endif #endif
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(qreal minValue READ getMinValue WRITE setMinValue) Q_PROPERTY(double minValue READ getMinValue WRITE setMinValue)
Q_PROPERTY(qreal maxValue READ getMaxValue WRITE setMaxValue) Q_PROPERTY(double maxValue READ getMaxValue WRITE setMaxValue)
Q_PROPERTY(qreal value READ getValue WRITE setValue) Q_PROPERTY(double value READ getValue WRITE setValue)
Q_PROPERTY(qreal alarmValue READ getAlarmValue WRITE setAlarmValue) 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 borderRadius READ getBorderRadius WRITE setBorderRadius)
Q_PROPERTY(int bgRadius READ getBgRadius WRITE setBgRadius) Q_PROPERTY(int bgRadius READ getBgRadius WRITE setBgRadius)
Q_PROPERTY(int headRadius READ getHeadRadius WRITE setHeadRadius) Q_PROPERTY(int headRadius READ getHeadRadius WRITE setHeadRadius)
@ -60,74 +55,78 @@ private slots:
void updateValue(); void updateValue();
private: private:
qreal minValue; //最小值 double minValue; //最小值
qreal maxValue; //最大值 double maxValue; //最大值
qreal value; //目标电量 double value; //目标电量
qreal alarmValue; //电池电量警戒值 double alarmValue; //电池电量警戒值
qreal step; //每次移动的步长 double step; //每次移动的步长
int borderRadius; //边框圆角角度 int borderWidth; //边框粗细
int bgRadius; //背景进度圆角角度 int borderRadius; //边框圆角角度
int headRadius; //头部圆角角度 int bgRadius; //背景进度圆角角度
int headRadius; //头部圆角角度
QColor borderColorStart; //边框渐变开始颜色 QColor borderColorStart; //边框渐变开始颜色
QColor borderColorEnd; //边框渐变结束颜色 QColor borderColorEnd; //边框渐变结束颜色
QColor alarmColorStart; //电池低电量时的渐变开始颜色 QColor alarmColorStart; //电池低电量时的渐变开始颜色
QColor alarmColorEnd; //电池低电量时的渐变结束颜色 QColor alarmColorEnd; //电池低电量时的渐变结束颜色
QColor normalColorStart; //电池正常电量时的渐变开始颜色 QColor normalColorStart; //电池正常电量时的渐变开始颜色
QColor normalColorEnd; //电池正常电量时的渐变结束颜色 QColor normalColorEnd; //电池正常电量时的渐变结束颜色
bool isForward; //是否往前移 bool isForward; //是否往前移
qreal currentValue; //当前电量 double currentValue; //当前电量
QRectF batteryRect; //电池主体区域 QRectF batteryRect; //电池主体区域
QTimer *timer; //绘制定时器 QTimer *timer; //绘制定时器
public: public:
qreal getMinValue() const; double getMinValue() const;
qreal getMaxValue() const; double getMaxValue() const;
qreal getValue() const; double getValue() const;
qreal getAlarmValue() const; double getAlarmValue() const;
qreal getStep() const; double getStep() const;
int getBorderRadius() const; int getBorderWidth() const;
int getBgRadius() const; int getBorderRadius() const;
int getHeadRadius() const; int getBgRadius() const;
int getHeadRadius() const;
QColor getBorderColorStart()const; QColor getBorderColorStart() const;
QColor getBorderColorEnd() const; QColor getBorderColorEnd() const;
QColor getAlarmColorStart() const; QColor getAlarmColorStart() const;
QColor getAlarmColorEnd() const; QColor getAlarmColorEnd() const;
QColor getNormalColorStart()const; QColor getNormalColorStart() const;
QColor getNormalColorEnd() const; QColor getNormalColorEnd() const;
QSize sizeHint() const; QSize sizeHint() const;
QSize minimumSizeHint() const; QSize minimumSizeHint() const;
public Q_SLOTS: public Q_SLOTS:
//设置范围值 //设置范围值
void setRange(qreal minValue, qreal maxValue); void setRange(double minValue, double maxValue);
void setRange(int minValue, int maxValue); void setRange(int minValue, int maxValue);
//设置最大最小值 //设置最大最小值
void setMinValue(qreal minValue); void setMinValue(double minValue);
void setMaxValue(qreal maxValue); void setMaxValue(double maxValue);
//设置电池电量值 //设置电池电量值
void setValue(qreal value); void setValue(double value);
void setValue(int value); void setValue(int value);
//设置电池电量警戒值 //设置电池电量警戒值
void setAlarmValue(qreal alarmValue); void setAlarmValue(double alarmValue);
void setAlarmValue(int alarmValue); void setAlarmValue(int alarmValue);
//设置步长 //设置步长
void setStep(qreal step); void setStep(double step);
void setStep(int step); void setStep(int step);
//设置边框粗细
void setBorderWidth(int borderWidth);
//设置边框圆角角度 //设置边框圆角角度
void setBorderRadius(int borderRadius); void setBorderRadius(int borderRadius);
//设置背景圆角角度 //设置背景圆角角度
@ -148,7 +147,7 @@ public Q_SLOTS:
void setNormalColorEnd(const QColor &normalColorEnd); void setNormalColorEnd(const QColor &normalColorEnd);
Q_SIGNALS: Q_SIGNALS:
void valueChanged(qreal value); void valueChanged(double value);
}; };
#endif // BATTERY_H #endif // BATTERY_H

View File

@ -180,7 +180,7 @@ void ButtonDefence::setButtonStyle(const ButtonDefence::ButtonStyle &buttonStyle
} else if (buttonStyle == ButtonStyle_Msg2) { } else if (buttonStyle == ButtonStyle_Msg2) {
type = "msg2"; type = "msg2";
} else { } else {
type = "custom"; type = "circle";
} }
setButtonStatus(buttonStatus); setButtonStatus(buttonStatus);

View File

@ -14,13 +14,7 @@
#include <QWidget> #include <QWidget>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT ButtonDefence : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT ButtonDefence : public QWidget
#else #else
class ButtonDefence : public QWidget class ButtonDefence : public QWidget
#endif #endif
@ -37,16 +31,14 @@ class ButtonDefence : public QWidget
Q_PROPERTY(ButtonStatus buttonStatus READ getButtonStatus WRITE setButtonStatus) Q_PROPERTY(ButtonStatus buttonStatus READ getButtonStatus WRITE setButtonStatus)
public: public:
//防区样式 圆形、警察、气泡、气泡2、消息、消息2、自定义 //防区样式 圆形、警察、气泡、气泡2、消息、消息2
//如果设置的自定义的,则图片拓展名 btn_defence_alarm_custom
enum ButtonStyle { enum ButtonStyle {
ButtonStyle_Circle = 0, ButtonStyle_Circle = 0,
ButtonStyle_Police = 1, ButtonStyle_Police = 1,
ButtonStyle_Bubble = 2, ButtonStyle_Bubble = 2,
ButtonStyle_Bubble2 = 3, ButtonStyle_Bubble2 = 3,
ButtonStyle_Msg = 4, ButtonStyle_Msg = 4,
ButtonStyle_Msg2 = 5, ButtonStyle_Msg2 = 5
ButtonStyle_Custom = 6
}; };
//防区状态 布防、撤防、报警、旁路、故障 //防区状态 布防、撤防、报警、旁路、故障

View File

@ -31,7 +31,7 @@ void frmButtonDefence::initForm()
btn3->setText("#3"); btn3->setText("#3");
btn3->setGeometry(85, 5, 35, 35); 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) { foreach (QPushButton *btn, btnStyle) {
connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle())); connect(btn, SIGNAL(clicked(bool)), this, SLOT(changeStyle()));
} }
@ -50,16 +50,6 @@ void frmButtonDefence::changeStyle()
btn1->setButtonStyle(style); btn1->setButtonStyle(style);
btn2->setButtonStyle(style); btn2->setButtonStyle(style);
btn3->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() void frmButtonDefence::changeStatus()
@ -79,10 +69,3 @@ void frmButtonDefence::on_ckCanMove_stateChanged(int arg1)
btn2->setCanMove(canMove); btn2->setCanMove(canMove);
btn3->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();
}

View File

@ -25,8 +25,6 @@ private slots:
void changeStatus(); void changeStatus();
void on_ckCanMove_stateChanged(int arg1); void on_ckCanMove_stateChanged(int arg1);
void on_btnPoint_clicked();
private: private:
Ui::frmButtonDefence *ui; Ui::frmButtonDefence *ui;
ButtonDefence *btn1; ButtonDefence *btn1;

View File

@ -87,13 +87,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="btnCustom">
<property name="text">
<string>自定义</string>
</property>
</widget>
</item>
<item> <item>
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
@ -136,13 +129,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="ckCanMove"> <widget class="QCheckBox" name="ckCanMove">
<property name="text"> <property name="text">
@ -150,13 +136,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="btnPoint">
<property name="text">
<string>坐标</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -176,21 +155,6 @@
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <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/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -31,10 +31,5 @@
<file>image/btn_defence_error_msg2.png</file> <file>image/btn_defence_error_msg2.png</file>
<file>image/btn_defence_error_police.png</file> <file>image/btn_defence_error_police.png</file>
<file>image/bg_call.jpg</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> </qresource>
</RCC> </RCC>

View File

@ -105,7 +105,7 @@ ColorWidget::ColorWidget(QWidget *parent) : QWidget(parent)
} }
ColorWidget::~ColorWidget() ColorWidget::~ColorWidget()
{ {
} }
void ColorWidget::mousePressEvent(QMouseEvent *e) void ColorWidget::mousePressEvent(QMouseEvent *e)
@ -128,10 +128,7 @@ void ColorWidget::showColorValue()
int x = QCursor::pos().x(); int x = QCursor::pos().x();
int y = QCursor::pos().y(); int y = QCursor::pos().y();
txtPoint->setText(tr("x:%1 y:%2").arg(x).arg(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)) #if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
QPixmap pixmap = QPixmap::grabWindow(QApplication::desktop()->winId(), x, y, 2, 2); 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); QPixmap pixmap = screen->grabWindow(QApplication::desktop()->winId(), x, y, 2, 2);
#endif #endif
int red, green, blue;
QString strDecimalValue, strHex;
if (!pixmap.isNull()) { if (!pixmap.isNull()) {
QImage image = pixmap.toImage(); QImage image = pixmap.toImage();
if (!image.isNull()) { if (!image.isNull()) {
if (image.valid(0, 0)) { if (image.valid(0, 0)) {
QColor color = image.pixel(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"; QColor color(red, green, blue);
} else { double gray = (0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255;
strTextColor = "255, 255, 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); labColor->setStyleSheet(str);
txtRgb->setText(strDecimalValue); txtRgb->setText(strDecimalValue);
txtWeb->setText(strHex); txtWeb->setText(strHex);

View File

@ -9,13 +9,7 @@ class QLabel;
class QLineEdit; class QLineEdit;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT ColorWidget : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT ColorWidget : public QWidget
#else #else
class ColorWidget : public QWidget class ColorWidget : public QWidget
#endif #endif

View File

@ -88,14 +88,15 @@ bool frmCountCode::checkFile(const QString &fileName)
void frmCountCode::countCode(const QString &filePath) void frmCountCode::countCode(const QString &filePath)
{ {
QDir dir(filePath); QDir dir(filePath);
foreach (QFileInfo fileInfo , dir.entryInfoList()) { QFileInfoList fileInfos = dir.entryInfoList();
foreach (QFileInfo fileInfo, fileInfos) {
QString fileName = fileInfo.fileName();
if (fileInfo.isFile()) { if (fileInfo.isFile()) {
QString strFileName = fileInfo.fileName(); if (checkFile(fileName)) {
if (checkFile(strFileName)) {
listFile << fileInfo.filePath(); listFile << fileInfo.filePath();
} }
} else { } else {
if(fileInfo.fileName() == "." || fileInfo.fileName() == "..") { if (fileName == "." || fileName == "..") {
continue; continue;
} }

BIN
countcode/snap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

View File

@ -3,10 +3,10 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2016-11-30 * :feiyangqingyun(QQ:517216493) 2016-11-30
* 1:/ * 1. /
* 2: * 2.
* 3: * 3.
* 4:USD * 4. USD
*/ */
#include <QTableWidget> #include <QTableWidget>
@ -14,13 +14,7 @@
class QProcess; class QProcess;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT DeviceSizeTable : public QTableWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT DeviceSizeTable : public QTableWidget
#else #else
class DeviceSizeTable : public QTableWidget class DeviceSizeTable : public QTableWidget
#endif #endif

View File

@ -3,14 +3,14 @@
/** /**
* FlatUI :feiyangqingyun(QQ:517216493) 2016-12-16 * FlatUI :feiyangqingyun(QQ:517216493) 2016-12-16
* 1: * 1.
* 2: * 2.
* 3: * 3.
* 4: * 4.
* 5: * 5.
* 6: * 6.
* 7: * 7.
* 8: * 8.
*/ */
#include <QObject> #include <QObject>
@ -24,13 +24,7 @@ class QCheckBox;
class QScrollBar; class QScrollBar;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT FlatUI : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT FlatUI : public QObject
#else #else
class FlatUI : public QObject class FlatUI : public QObject
#endif #endif

View File

@ -3,23 +3,17 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2019-10-03 * :feiyangqingyun(QQ:517216493) 2019-10-03
* 1:widget * 1. widget
* 2: * 2.
* 3:,便 * 3. ,便
* 4: * 4.
* 5: * 5.
*/ */
#include <QWidget> #include <QWidget>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT FramelessWidget : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT FramelessWidget : public QObject
#else #else
class FramelessWidget : public QObject class FramelessWidget : public QObject
#endif #endif

View File

@ -3,11 +3,11 @@
/** /**
* GIF :feiyangqingyun(QQ:517216493) 2019-4-3 * GIF :feiyangqingyun(QQ:517216493) 2019-4-3
* 1:,. * 1. ,.
* 2: * 2.
* 3: * 3.
* 4: * 4.
* 5: * 5.
*/ */
#include <QDialog> #include <QDialog>
@ -17,13 +17,7 @@ class QLineEdit;
class QLabel; class QLabel;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT GifWidget : public QDialog
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT GifWidget : public QDialog
#else #else
class GifWidget : public QDialog class GifWidget : public QDialog
#endif #endif

View File

@ -3,20 +3,14 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2016-11-25 * :feiyangqingyun(QQ:517216493) 2016-11-25
* 1: * 1.
* 2: * 2.
*/ */
#include <QWidget> #include <QWidget>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT ImageSwitch : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT ImageSwitch : public QWidget
#else #else
class ImageSwitch : public QWidget class ImageSwitch : public QWidget
#endif #endif

View File

@ -4,10 +4,12 @@
#include "qlabel.h" #include "qlabel.h"
#include "qlineedit.h" #include "qlineedit.h"
#include "qboxlayout.h" #include "qboxlayout.h"
#include "qregexp.h"
#include "qvalidator.h" #include "qvalidator.h"
#include "qevent.h" #include "qevent.h"
#include "qdebug.h" #include "qdebug.h"
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
#include "qregexp.h"
#endif
IPAddress::IPAddress(QWidget *parent) : QWidget(parent) IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
{ {
@ -53,6 +55,7 @@ IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
txtIP4->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); txtIP4->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
connect(txtIP4, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); connect(txtIP4, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
//设置IP地址校验过滤 //设置IP地址校验过滤
QRegExp regExp("(2[0-5]{2}|2[0-4][0-9]|1?[0-9]{1,2})"); QRegExp regExp("(2[0-5]{2}|2[0-4][0-9]|1?[0-9]{1,2})");
QRegExpValidator *validator = new QRegExpValidator(regExp, this); QRegExpValidator *validator = new QRegExpValidator(regExp, this);
@ -60,6 +63,7 @@ IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
txtIP2->setValidator(validator); txtIP2->setValidator(validator);
txtIP3->setValidator(validator); txtIP3->setValidator(validator);
txtIP4->setValidator(validator); txtIP4->setValidator(validator);
#endif
//绑定事件过滤器,识别键盘按下 //绑定事件过滤器,识别键盘按下
txtIP1->installEventFilter(this); txtIP1->installEventFilter(this);
@ -79,13 +83,13 @@ IPAddress::IPAddress(QWidget *parent) : QWidget(parent)
frame->setStyleSheet(qss.join("")); frame->setStyleSheet(qss.join(""));
QVBoxLayout *verticalLayout = new QVBoxLayout(this); QVBoxLayout *verticalLayout = new QVBoxLayout(this);
verticalLayout->setMargin(0); verticalLayout->setContentsMargins(0, 0, 0, 0);
verticalLayout->setSpacing(0); verticalLayout->setSpacing(0);
verticalLayout->addWidget(frame); verticalLayout->addWidget(frame);
//将控件按照横向布局排列 //将控件按照横向布局排列
QHBoxLayout *layout = new QHBoxLayout(frame); QHBoxLayout *layout = new QHBoxLayout(frame);
layout->setMargin(0); layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0); layout->setSpacing(0);
layout->addWidget(txtIP1); layout->addWidget(txtIP1);
layout->addWidget(labDot1); layout->addWidget(labDot1);
@ -153,11 +157,13 @@ QSize IPAddress::minimumSizeHint() const
void IPAddress::setIP(const QString &ip) void IPAddress::setIP(const QString &ip)
{ {
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
//先检测IP地址是否合法 //先检测IP地址是否合法
QRegExp regExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)"); 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)) { if (!regExp.exactMatch(ip)) {
return; return;
} }
#endif
if (this->ip != ip) { if (this->ip != ip) {
this->ip = ip; this->ip = ip;

View File

@ -3,12 +3,12 @@
/** /**
* IP :feiyangqingyun(QQ:517216493) 2017-8-11 * IP :feiyangqingyun(QQ:517216493) 2017-8-11
* 1:IP, * 1. IP,
* 2:IP * 2. IP
* 3: * 3.
* 4:退 * 4. 退
* 5:IP * 5. IP
* 6:// * 6. //
*/ */
#include <QWidget> #include <QWidget>
@ -17,13 +17,7 @@ class QLabel;
class QLineEdit; class QLineEdit;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT IPAddress : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT IPAddress : public QWidget
#else #else
class IPAddress : public QWidget class IPAddress : public QWidget
#endif #endif

View File

@ -3,28 +3,22 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2016-10-16 * :feiyangqingyun(QQ:517216493) 2016-10-16
* 1:, * 1. ,
* 2: * 2.
* 3: * 3.
* 4: * 4.
* 5: * 5.
* 6: 绿//// * 6. 绿////
* 7:,使 * 7. ,使
* 8: * 8.
* 9:+ * 9. +
* 10:, * 10. ,
*/ */
#include <QWidget> #include <QWidget>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT LightButton : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT LightButton : public QWidget
#else #else
class LightButton : public QWidget class LightButton : public QWidget
#endif #endif

View File

@ -3,23 +3,17 @@
/** /**
* : :feiyangqingyun(QQ:517216493) 2016-12-10 * : :feiyangqingyun(QQ:517216493) 2016-12-10
* 1: * 1.
* 2: * 2.
* 3: * 3.
* 4: ++ * 4. ++
* 5:, * 5. ,
*/ */
#include <QObject> #include <QObject>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT LunarCalendarInfo : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT LunarCalendarInfo : public QObject
#else #else
class LunarCalendarInfo : public QObject class LunarCalendarInfo : public QObject
#endif #endif

View File

@ -5,13 +5,7 @@
#include <QDate> #include <QDate>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT LunarCalendarItem : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT LunarCalendarItem : public QWidget
#else #else
class LunarCalendarItem : public QWidget class LunarCalendarItem : public QWidget
#endif #endif

View File

@ -159,7 +159,7 @@ void LunarCalendarWidget::initWidget()
//星期布局 //星期布局
QHBoxLayout *layoutWeek = new QHBoxLayout(widgetWeek); QHBoxLayout *layoutWeek = new QHBoxLayout(widgetWeek);
layoutWeek->setMargin(0); layoutWeek->setContentsMargins(0, 0, 0, 0);
layoutWeek->setSpacing(0); layoutWeek->setSpacing(0);
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
@ -177,7 +177,7 @@ void LunarCalendarWidget::initWidget()
//日期标签布局 //日期标签布局
QGridLayout *layoutBody = new QGridLayout(widgetBody); QGridLayout *layoutBody = new QGridLayout(widgetBody);
layoutBody->setMargin(1); layoutBody->setContentsMargins(1, 1, 1, 1);
layoutBody->setHorizontalSpacing(0); layoutBody->setHorizontalSpacing(0);
layoutBody->setVerticalSpacing(0); layoutBody->setVerticalSpacing(0);
@ -191,7 +191,7 @@ void LunarCalendarWidget::initWidget()
//主布局 //主布局
QVBoxLayout *verLayoutCalendar = new QVBoxLayout(this); QVBoxLayout *verLayoutCalendar = new QVBoxLayout(this);
verLayoutCalendar->setMargin(0); verLayoutCalendar->setContentsMargins(0, 0, 0, 0);
verLayoutCalendar->setSpacing(0); verLayoutCalendar->setSpacing(0);
verLayoutCalendar->addWidget(widgetTop); verLayoutCalendar->addWidget(widgetTop);
verLayoutCalendar->addWidget(widgetWeek); verLayoutCalendar->addWidget(widgetWeek);

View File

@ -3,15 +3,15 @@
/** /**
* : :feiyangqingyun(QQ:517216493) 2017-11-17 * : :feiyangqingyun(QQ:517216493) 2017-11-17
* 1:/// * 1. ///
* 2:/// * 2. ///
* 3:/// * 3. ///
* 4:/// * 4. ///
* 5:,++ * 5. ,++
* 6://// * 6. ////
* 7:,使 * 7. ,使
* 8:1901-2099 * 8. 1901-2099
* 9:便 * 9. 便
*/ */
#include <QWidget> #include <QWidget>
@ -25,13 +25,7 @@ class QComboBox;
class LunarCalendarItem; class LunarCalendarItem;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT LunarCalendarWidget : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT LunarCalendarWidget : public QWidget
#else #else
class LunarCalendarWidget : public QWidget class LunarCalendarWidget : public QWidget
#endif #endif

View File

@ -2,8 +2,8 @@
#include "maskwidget.h" #include "maskwidget.h"
#include "qmutex.h" #include "qmutex.h"
#include "qapplication.h"
#include "qdesktopwidget.h" #include "qdesktopwidget.h"
#include "qapplication.h"
#include "qdebug.h" #include "qdebug.h"
QScopedPointer<MaskWidget> MaskWidget::self; QScopedPointer<MaskWidget> MaskWidget::self;
@ -56,7 +56,7 @@ void MaskWidget::setOpacity(double opacity)
void MaskWidget::setBgColor(const QColor &bgColor) void MaskWidget::setBgColor(const QColor &bgColor)
{ {
QPalette palette = this->palette(); QPalette palette = this->palette();
palette.setBrush(QPalette::Background, bgColor); palette.setBrush(QPalette::Window, bgColor);
this->setPalette(palette); this->setPalette(palette);
} }

View File

@ -3,23 +3,17 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2016-12-26 * :feiyangqingyun(QQ:517216493) 2016-12-26
* 1:, * 1. ,
* 2:, * 2. ,
* 3: * 3.
* 4: * 4.
* 5: * 5.
*/ */
#include <QWidget> #include <QWidget>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT MaskWidget : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT MaskWidget : public QWidget
#else #else
class MaskWidget : public QWidget class MaskWidget : public QWidget
#endif #endif

View File

@ -7,8 +7,12 @@
#include <QtWidgets> #include <QtWidgets>
#endif #endif
//图形字体处理类 #ifdef quc
class Q_DECL_EXPORT IconHelper : public QObject
#else
class IconHelper : public QObject class IconHelper : public QObject
#endif
{ {
Q_OBJECT Q_OBJECT

View File

@ -43,6 +43,7 @@ NavButton::NavButton(QWidget *parent) : QPushButton(parent)
hover = false; hover = false;
setCheckable(true); setCheckable(true);
setText("导航按钮");
} }
void NavButton::enterEvent(QEvent *) void NavButton::enterEvent(QEvent *)

View File

@ -3,26 +3,20 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2017-12-19 * :feiyangqingyun(QQ:517216493) 2017-12-19
* 1:+++ * 1. +++
* 2: * 2.
* 3:/// * 3. ///
* 4:///// * 4. /////
* 5:线/线/线/线/线 * 5. 线/线/线/线/线
* 6:// * 6. //
* 7:// * 7. //
* 8: * 8.
*/ */
#include <QPushButton> #include <QPushButton>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT NavButton : public QPushButton
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT NavButton : public QPushButton
#else #else
class NavButton : public QPushButton class NavButton : public QPushButton
#endif #endif

View File

@ -33,7 +33,7 @@
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="txtNtpIP"> <widget class="QLineEdit" name="txtNtpIP">
<property name="text"> <property name="text">
<string>ntp1.aliyun.com</string> <string>133.100.11.8</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -3,8 +3,8 @@
/** /**
* Ntp :feiyangqingyun(QQ:517216493) 2017-2-16 * Ntp :feiyangqingyun(QQ:517216493) 2017-2-16
* 1:NtpIP * 1. NtpIP
* 2: * 2.
*/ */
#include <QObject> #include <QObject>
@ -12,13 +12,7 @@
class QUdpSocket; class QUdpSocket;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT NtpClient : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT NtpClient : public QObject
#else #else
class NtpClient : public QObject class NtpClient : public QObject
#endif #endif
@ -45,10 +39,8 @@ signals:
public slots: public slots:
//设置NTP服务器IP //设置NTP服务器IP
void setNtpIP(const QString &ntpIP); void setNtpIP(const QString &ntpIP);
//获取日期时间 //获取日期时间
void getDateTime(); void getDateTime();
}; };
#endif // NTPCLIENT_H #endif // NTPCLIENT_H

View File

@ -8,13 +8,7 @@ class QTcpSocket;
class QTcpServer; class QTcpServer;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT SaveLog : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT SaveLog : public QObject
#else #else
class SaveLog : public QObject class SaveLog : public QObject
#endif #endif

View File

@ -5,7 +5,6 @@
#include "qfile.h" #include "qfile.h"
#include "qtextstream.h" #include "qtextstream.h"
#include "qstringlist.h" #include "qstringlist.h"
#include "qdebug.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#define NEWLINE "\r\n" #define NEWLINE "\r\n"
@ -37,6 +36,7 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
saveInterval = 1 * 60 * 1000; saveInterval = 1 * 60 * 1000;
startTime = QDateTime::currentDateTime(); startTime = QDateTime::currentDateTime();
//存储运行时间定时器
timerSave = new QTimer(this); timerSave = new QTimer(this);
timerSave->setInterval(saveInterval); timerSave->setInterval(saveInterval);
connect(timerSave, SIGNAL(timeout()), this, SLOT(saveLog())); connect(timerSave, SIGNAL(timeout()), this, SLOT(saveLog()));
@ -44,6 +44,9 @@ SaveRunTime::SaveRunTime(QObject *parent) : QObject(parent)
void SaveRunTime::start() void SaveRunTime::start()
{ {
//开始时间变量必须在这,在部分嵌入式系统上开机后的时间不准确比如是1970,而后会变成1999或者其他时间
//会在getDiffValue函数执行很久很久
startTime = QDateTime::currentDateTime();
timerSave->start(); timerSave->start();
initLog(); initLog();
@ -104,19 +107,16 @@ void SaveRunTime::initLog()
QTextStream stream(&file); QTextStream stream(&file);
stream << line << NEWLINE; stream << line << NEWLINE;
file.close(); file.close();
lastID = 0; lastID = 0;
} }
} else { } else {
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
QString lastLine; QString lastLine;
while (!file.atEnd()) { while (!file.atEnd()) {
lastLine = file.readLine(); lastLine = file.readLine();
} }
file.close(); file.close();
QStringList list = lastLine.split("\t"); QStringList list = lastLine.split("\t");
lastID = list.at(0).toInt(); lastID = list.at(0).toInt();
} }
@ -169,7 +169,6 @@ void SaveRunTime::saveLog()
//重新清空文件 //重新清空文件
file.resize(0); file.resize(0);
//如果行数小于2则返回 //如果行数小于2则返回
if (content.count() < 2) { if (content.count() < 2) {
file.close(); file.close();

View File

@ -6,13 +6,7 @@
class QTimer; class QTimer;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT SaveRunTime : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT SaveRunTime : public QObject
#else #else
class SaveRunTime : public QObject class SaveRunTime : public QObject
#endif #endif

View File

@ -3,9 +3,9 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2016-11-11 * :feiyangqingyun(QQ:517216493) 2016-11-11
* 1: * 1.
* 2: * 2.
* 3: * 3.
*/ */
#include <QWidget> #include <QWidget>
@ -46,13 +46,7 @@ private:
}; };
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT ScreenWidget : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT ScreenWidget : public QWidget
#else #else
class ScreenWidget : public QWidget class ScreenWidget : public QWidget
#endif #endif

View File

@ -56,7 +56,7 @@ void VideoPanel::initControl()
{ {
gridLayout = new QGridLayout; gridLayout = new QGridLayout;
gridLayout->setSpacing(1); gridLayout->setSpacing(1);
gridLayout->setMargin(0); gridLayout->setContentsMargins(0, 0, 0, 0);
gridLayout->setObjectName("gridLayout"); gridLayout->setObjectName("gridLayout");
this->setLayout(gridLayout); this->setLayout(gridLayout);
} }

View File

@ -13,13 +13,7 @@ class QLabel;
class QGridLayout; class QGridLayout;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT VideoPanel : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT VideoPanel : public QWidget
#else #else
class VideoPanel : public QWidget class VideoPanel : public QWidget
#endif #endif

View File

@ -81,7 +81,7 @@ void VideoWidget::initFlowPanel()
//用布局顶住,左侧弹簧 //用布局顶住,左侧弹簧
QHBoxLayout *layout = new QHBoxLayout; QHBoxLayout *layout = new QHBoxLayout;
layout->setSpacing(2); layout->setSpacing(2);
layout->setMargin(0); layout->setContentsMargins(0, 0, 0, 0);
layout->addStretch(); layout->addStretch();
flowPanel->setLayout(layout); flowPanel->setLayout(layout);
@ -100,7 +100,7 @@ void VideoWidget::initFlowPanel()
icons << QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton); icons << QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton);
#else #else
QList<QChar> chars; QList<QChar> chars;
chars << 0xe68d << 0xe672 << 0xe674 << 0xea36 << 0xe74c; chars << QChar(0xe68d) << QChar(0xe672) << QChar(0xe674) << QChar(0xea36) << QChar(0xe74c);
//判断图形字体是否存在,不存在则加入 //判断图形字体是否存在,不存在则加入
QFont iconFont; QFont iconFont;
@ -277,7 +277,7 @@ void VideoWidget::drawBg(QPainter *painter)
//背景图片为空则绘制文字,否则绘制背景图片 //背景图片为空则绘制文字,否则绘制背景图片
if (bgImage.isNull()) { if (bgImage.isNull()) {
painter->setFont(this->font()); painter->setFont(this->font());
painter->setPen(palette().foreground().color()); painter->setPen(palette().windowText().color());
painter->drawText(rect(), Qt::AlignCenter, bgText); painter->drawText(rect(), Qt::AlignCenter, bgText);
} else { } else {
//居中绘制 //居中绘制

View File

@ -23,13 +23,7 @@
class QTimer; class QTimer;
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT VideoWidget : public QWidget
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT VideoWidget : public QWidget
#else #else
class VideoWidget : public QWidget class VideoWidget : public QWidget
#endif #endif
@ -223,6 +217,11 @@ signals:
//播放结束 //播放结束
void receivePlayFinsh(); void receivePlayFinsh();
//总时长
void fileLengthReceive(qint64 length);
//当前播放时长
void filePositionReceive(qint64 position);
//收到图片信号 //收到图片信号
void receiveImage(const QImage &image); void receiveImage(const QImage &image);

View File

@ -3,22 +3,16 @@
/** /**
* :feiyangqingyun(QQ:517216493) 2019-2-16 * :feiyangqingyun(QQ:517216493) 2019-2-16
* 1: * 1.
* 2: * 2.
* 3: * 3.
*/ */
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
#ifdef quc #ifdef quc
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0)) class Q_DECL_EXPORT ZhToPY : public QObject
#include <QtDesigner/QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerExportWidget>
#endif
class QDESIGNER_WIDGET_EXPORT ZhToPY : public QObject
#else #else
class ZhToPY : public QObject class ZhToPY : public QObject
#endif #endif