diff --git a/control/devicesizetable/devicesizetable.cpp b/control/devicesizetable/devicesizetable.cpp index 416b8d2..8df3868 100644 --- a/control/devicesizetable/devicesizetable.cpp +++ b/control/devicesizetable/devicesizetable.cpp @@ -96,7 +96,7 @@ void DeviceSizeTable::load() { //清空原有数据 int row = this->rowCount(); - for (int i = 0; i < row; i++) { + for (int i = 0; i < row; ++i) { this->removeRow(0); } @@ -215,7 +215,7 @@ void DeviceSizeTable::checkSize(const QString &result, const QString &name) QStringList list = result.split(" "); int index = 0; - for (int i = 0; i < list.count(); i++) { + for (int i = 0; i < list.count(); ++i) { QString s = list.at(i).trimmed(); if (s == "") { continue; diff --git a/control/navbutton/iconhelper.cpp b/control/navbutton/iconhelper.cpp index d12c99b..fe18f77 100644 --- a/control/navbutton/iconhelper.cpp +++ b/control/navbutton/iconhelper.cpp @@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList widget->setStyleSheet(qss.join("")); //可能会重复调用设置所以先要移除上一次的 - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { for (int j = 0; j < this->btns.count(); j++) { if (this->btns.at(j) == btns.at(i)) { disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); @@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList //存储对应按钮对象,方便鼠标移上去的时候切换图片 int checkedIndex = -1; - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { int icon = icons.at(i); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); diff --git a/control/navbutton/navbutton.cpp b/control/navbutton/navbutton.cpp index 67c7e4e..d1000fb 100644 --- a/control/navbutton/navbutton.cpp +++ b/control/navbutton/navbutton.cpp @@ -46,11 +46,7 @@ NavButton::NavButton(QWidget *parent) : QPushButton(parent) setText("导航按钮"); } -#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) -void NavButton::enterEvent(QEnterEvent *) -#else void NavButton::enterEvent(QEvent *) -#endif { hover = true; this->update(); diff --git a/control/navbutton/navbutton.h b/control/navbutton/navbutton.h index b9a43b4..37a221d 100644 --- a/control/navbutton/navbutton.h +++ b/control/navbutton/navbutton.h @@ -92,11 +92,7 @@ public: explicit NavButton(QWidget *parent = 0); protected: -#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) - void enterEvent(QEnterEvent *); -#else void enterEvent(QEvent *); -#endif void leaveEvent(QEvent *); void paintEvent(QPaintEvent *); void drawBg(QPainter *painter); diff --git a/control/smoothcurve/smoothcurve.cpp b/control/smoothcurve/smoothcurve.cpp index 8753cd2..0977868 100644 --- a/control/smoothcurve/smoothcurve.cpp +++ b/control/smoothcurve/smoothcurve.cpp @@ -51,13 +51,13 @@ void SmoothCurve::calculateFirstControlPoints(double *&result, const double *rhs double b = 2.0; result[0] = rhs[0] / b; - for (int i = 1; i < n; i++) { + for (int i = 1; i < n; ++i) { tmp[i] = 1 / b; b = (i < n - 1 ? 4.0 : 3.5) - tmp[i]; result[i] = (rhs[i] - result[i - 1]) / b; } - for (int i = 1; i < n; i++) { + for (int i = 1; i < n; ++i) { result[n - i - 1] -= tmp[n - i] * result[n - i]; } diff --git a/control/zhtopy/zhtopy.cpp b/control/zhtopy/zhtopy.cpp index f5631b6..d09a52f 100644 --- a/control/zhtopy/zhtopy.cpp +++ b/control/zhtopy/zhtopy.cpp @@ -277,7 +277,7 @@ QString ZhToPY::zhToJP(const QString &chinese) QString str; int index = 0; - for (int i = 0; i < chinese.length(); i++) { + for (int i = 0; i < chinese.length(); ++i) { //若是字母或数字则直接输出 ushort vChar = chinese.at(i).unicode() ; if ((vChar >= 'a' && vChar <= 'z') || (vChar >= 'A' && vChar <= 'Z')) { diff --git a/other/ntpclient/ntpclient.cpp b/other/ntpclient/ntpclient.cpp index f9b5288..65f1aac 100644 --- a/other/ntpclient/ntpclient.cpp +++ b/other/ntpclient/ntpclient.cpp @@ -77,7 +77,7 @@ void NtpClient::readData() quint32 seconds = transmitTimeStamp.at(0); quint8 temp = 0; - for (int i = 1; i <= 3; i++) { + for (int i = 1; i <= 3; ++i) { seconds = (seconds << 8); temp = transmitTimeStamp.at(i); seconds = seconds + temp; diff --git a/third/3rd_qcustomplot/3rd_qcustomplot.pri b/third/3rd_qcustomplot/3rd_qcustomplot.pri index 9eaba9e..dbeebc1 100644 --- a/third/3rd_qcustomplot/3rd_qcustomplot.pri +++ b/third/3rd_qcustomplot/3rd_qcustomplot.pri @@ -5,11 +5,15 @@ greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11 !contains(DEFINES, qcustomplot_v1_3) { !contains(DEFINES, qcustomplot_v2_0) { !contains(DEFINES, qcustomplot_v2_1) { -greaterThan(QT_MAJOR_VERSION, 4) { -DEFINES += qcustomplot_v2_1 -} else { DEFINES += qcustomplot_v2_0 -}}}} +}}} + +!contains(DEFINES, qcustomplot_v2_1) { +greaterThan(QT_MAJOR_VERSION, 4) { +DEFINES -= qcustomplot_v1_3 +DEFINES -= qcustomplot_v2_0 +DEFINES += qcustomplot_v2_1 +}} contains(DEFINES, qcustomplot_v1_3) { INCLUDEPATH += $$PWD/v1_3 diff --git a/third/3rd_qcustomplot/v1_3/qcustomplot.cpp b/third/3rd_qcustomplot/v1_3/qcustomplot.cpp index 3086082..6c79f15 100644 --- a/third/3rd_qcustomplot/v1_3/qcustomplot.cpp +++ b/third/3rd_qcustomplot/v1_3/qcustomplot.cpp @@ -1,4 +1,4 @@ -/*************************************************************************** +/*************************************************************************** ** ** ** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** Copyright (C) 2011-2015 Emanuel Eichhammer ** @@ -22848,7 +22848,7 @@ QPointF QCPItemPixmap::anchorPixelPoint(int anchorId) const case aiRight: return (rect.topRight()+rect.bottomRight())*0.5; case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottomLeft: return rect.bottomLeft(); - case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5;; + case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; diff --git a/third/3rd_qcustomplot/v2_0/qcustomplot.cpp b/third/3rd_qcustomplot/v2_0/qcustomplot.cpp index 51722e2..2966b6f 100644 --- a/third/3rd_qcustomplot/v2_0/qcustomplot.cpp +++ b/third/3rd_qcustomplot/v2_0/qcustomplot.cpp @@ -1,4 +1,4 @@ -/*************************************************************************** +/*************************************************************************** ** ** ** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** Copyright (C) 2011-2018 Emanuel Eichhammer ** @@ -4002,7 +4002,7 @@ QSize QCPLayout::getFinalMinimumOuterSize(const QCPLayoutElement *el) minOuter.rheight() += el->margins().top() + el->margins().bottom(); return QSize(minOuter.width() > 0 ? minOuter.width() : minOuterHint.width(), - minOuter.height() > 0 ? minOuter.height() : minOuterHint.height());; + minOuter.height() > 0 ? minOuter.height() : minOuterHint.height()); } /*! \internal @@ -29480,7 +29480,7 @@ QPointF QCPItemPixmap::anchorPixelPosition(int anchorId) const case aiRight: return (rect.topRight()+rect.bottomRight())*0.5; case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottomLeft: return rect.bottomLeft(); - case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5;; + case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; diff --git a/third/qcustomplotdemo/frmcustom/iconhelper.cpp b/third/qcustomplotdemo/frmcustom/iconhelper.cpp index d12c99b..fe18f77 100644 --- a/third/qcustomplotdemo/frmcustom/iconhelper.cpp +++ b/third/qcustomplotdemo/frmcustom/iconhelper.cpp @@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList widget->setStyleSheet(qss.join("")); //可能会重复调用设置所以先要移除上一次的 - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { for (int j = 0; j < this->btns.count(); j++) { if (this->btns.at(j) == btns.at(i)) { disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); @@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList //存储对应按钮对象,方便鼠标移上去的时候切换图片 int checkedIndex = -1; - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { int icon = icons.at(i); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); diff --git a/tool/3rd_smtpclient/emailaddress.h b/tool/3rd_smtpclient/emailaddress.h index 0ea0e05..8e56938 100644 --- a/tool/3rd_smtpclient/emailaddress.h +++ b/tool/3rd_smtpclient/emailaddress.h @@ -7,10 +7,7 @@ class EmailAddress : public QObject { Q_OBJECT public: - - EmailAddress(); EmailAddress(const QString &address, const QString &name = ""); - ~EmailAddress(); void setName(const QString &name); diff --git a/tool/tool.pro b/tool/tool.pro index 785a4ea..c690d8a 100644 --- a/tool/tool.pro +++ b/tool/tool.pro @@ -13,8 +13,3 @@ SUBDIRS += keytool SUBDIRS += keydemo SUBDIRS += livetool SUBDIRS += livedemo - -#Qt6有些代码没适配 -greaterThan(QT_MAJOR_VERSION, 5) { -SUBDIRS -= emailtool -} diff --git a/ui/core_common/iconhelper.cpp b/ui/core_common/iconhelper.cpp index d12c99b..fe18f77 100644 --- a/ui/core_common/iconhelper.cpp +++ b/ui/core_common/iconhelper.cpp @@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList widget->setStyleSheet(qss.join("")); //可能会重复调用设置所以先要移除上一次的 - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { for (int j = 0; j < this->btns.count(); j++) { if (this->btns.at(j) == btns.at(i)) { disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); @@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList //存储对应按钮对象,方便鼠标移上去的时候切换图片 int checkedIndex = -1; - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { int icon = icons.at(i); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); diff --git a/ui/core_qss/qss/blacksoft.css b/ui/core_qss/qss/blacksoft.css index 26ab7b7..09a607a 100644 --- a/ui/core_qss/qss/blacksoft.css +++ b/ui/core_qss/qss/blacksoft.css @@ -495,7 +495,7 @@ margin:0px; background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252); } -QTabBar::tab:selected,QTabBar::tab:hover{ +QTabBar::tab:selected{ border-style:solid; border-color:#AAAAAA; background:#444444; @@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{ padding:8px 3px 8px 3px; } -QTabBar::tab:top:selected,QTabBar::tab:top:hover{ +QTabBar::tab:top:selected{ border-width:2px 0px 0px 0px; } -QTabBar::tab:right:selected,QTabBar::tab:right:hover{ +QTabBar::tab:right:selected{ border-width:0px 0px 0px 2px; } -QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ +QTabBar::tab:bottom:selected{ border-width:0px 0px 2px 0px; } -QTabBar::tab:left:selected,QTabBar::tab:left:hover{ +QTabBar::tab:left:selected{ border-width:0px 2px 0px 0px; } -QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{ +QTabBar::tab:first:top:selected,QTabBar::tab:first:bottom:selected{ border-left-width:1px; border-left-color:#242424; } -QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{ +QTabBar::tab:first:left:selected,QTabBar::tab:first:right:selected{ border-top-width:1px; border-top-color:#242424; } -QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{ +QTabBar::tab:last:top:selected,QTabBar::tab:last:bottom:selected{ border-right-width:1px; border-right-color:#242424; } -QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{ +QTabBar::tab:last:left:selected,QTabBar::tab:last:right:selected{ border-bottom-width:1px; border-bottom-color:#242424; } diff --git a/ui/iconhelper/iconhelper.cpp b/ui/iconhelper/iconhelper.cpp index d12c99b..fe18f77 100644 --- a/ui/iconhelper/iconhelper.cpp +++ b/ui/iconhelper/iconhelper.cpp @@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList widget->setStyleSheet(qss.join("")); //可能会重复调用设置所以先要移除上一次的 - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { for (int j = 0; j < this->btns.count(); j++) { if (this->btns.at(j) == btns.at(i)) { disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); @@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList btns, QList //存储对应按钮对象,方便鼠标移上去的时候切换图片 int checkedIndex = -1; - for (int i = 0; i < btnCount; i++) { + for (int i = 0; i < btnCount; ++i) { int icon = icons.at(i); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); diff --git a/ui/styledemo/frmmain.cpp b/ui/styledemo/frmmain.cpp index 71e1fbb..493307f 100644 --- a/ui/styledemo/frmmain.cpp +++ b/ui/styledemo/frmmain.cpp @@ -28,7 +28,7 @@ void frmMain::initForm() //加载鼠标右键菜单翻译文件 QTranslator *translator1 = new QTranslator(qApp); - if (translator1->load(":/qm/qt_zh_CN.qm")){ + if (translator1->load(":/qm/qt_zh_CN.qm")) { qApp->installTranslator(translator1); } @@ -44,7 +44,7 @@ void frmMain::initForm() void frmMain::loadStyle(const QString &qssFile) { //加载样式表 - QString qss; + QString qss; QFile file(qssFile); if (file.open(QFile::ReadOnly)) { //用QTextStream读取样式文件不用区分文件编码 带bom也行 @@ -79,3 +79,10 @@ void frmMain::on_btnStyle3_clicked() { loadStyle(":/qss/blacksoft.css"); } + +void frmMain::on_btnInfo_clicked() +{ + //QFileDialog::getOpenFileName(this, "", "", "", 0, QFileDialog::DontUseNativeDialog); + //QFileDialog::getExistingDirectory(0, "", "", QFileDialog::DontUseNativeDialog); +} + diff --git a/ui/styledemo/frmmain.h b/ui/styledemo/frmmain.h index 342bca2..f860c3d 100644 --- a/ui/styledemo/frmmain.h +++ b/ui/styledemo/frmmain.h @@ -26,6 +26,7 @@ private slots: void on_btnStyle1_clicked(); void on_btnStyle2_clicked(); void on_btnStyle3_clicked(); + void on_btnInfo_clicked(); }; #endif // FRMMAIN_H diff --git a/ui/styledemo/qrc/qss/blacksoft.css b/ui/styledemo/qrc/qss/blacksoft.css index 26ab7b7..09a607a 100644 --- a/ui/styledemo/qrc/qss/blacksoft.css +++ b/ui/styledemo/qrc/qss/blacksoft.css @@ -495,7 +495,7 @@ margin:0px; background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252); } -QTabBar::tab:selected,QTabBar::tab:hover{ +QTabBar::tab:selected{ border-style:solid; border-color:#AAAAAA; background:#444444; @@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{ padding:8px 3px 8px 3px; } -QTabBar::tab:top:selected,QTabBar::tab:top:hover{ +QTabBar::tab:top:selected{ border-width:2px 0px 0px 0px; } -QTabBar::tab:right:selected,QTabBar::tab:right:hover{ +QTabBar::tab:right:selected{ border-width:0px 0px 0px 2px; } -QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ +QTabBar::tab:bottom:selected{ border-width:0px 0px 2px 0px; } -QTabBar::tab:left:selected,QTabBar::tab:left:hover{ +QTabBar::tab:left:selected{ border-width:0px 2px 0px 0px; } -QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{ +QTabBar::tab:first:top:selected,QTabBar::tab:first:bottom:selected{ border-left-width:1px; border-left-color:#242424; } -QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{ +QTabBar::tab:first:left:selected,QTabBar::tab:first:right:selected{ border-top-width:1px; border-top-color:#242424; } -QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{ +QTabBar::tab:last:top:selected,QTabBar::tab:last:bottom:selected{ border-right-width:1px; border-right-color:#242424; } -QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{ +QTabBar::tab:last:left:selected,QTabBar::tab:last:right:selected{ border-bottom-width:1px; border-bottom-color:#242424; } diff --git a/ui/styledemo/qrc/qss/flatgray.css b/ui/styledemo/qrc/qss/flatgray.css index 6f5aa0a..883e90f 100644 --- a/ui/styledemo/qrc/qss/flatgray.css +++ b/ui/styledemo/qrc/qss/flatgray.css @@ -495,7 +495,7 @@ margin:0px; background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1 #F6F6F6); } -QTabBar::tab:selected,QTabBar::tab:hover{ +QTabBar::tab:selected{ border-style:solid; border-color:#575959; background:#FFFFFF; @@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{ padding:8px 3px 8px 3px; } -QTabBar::tab:top:selected,QTabBar::tab:top:hover{ +QTabBar::tab:top:selected{ border-width:2px 0px 0px 0px; } -QTabBar::tab:right:selected,QTabBar::tab:right:hover{ +QTabBar::tab:right:selected{ border-width:0px 0px 0px 2px; } -QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ +QTabBar::tab:bottom:selected{ border-width:0px 0px 2px 0px; } -QTabBar::tab:left:selected,QTabBar::tab:left:hover{ +QTabBar::tab:left:selected{ border-width:0px 2px 0px 0px; } -QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{ +QTabBar::tab:first:top:selected,QTabBar::tab:first:bottom:selected{ border-left-width:1px; border-left-color:#B6B6B6; } -QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{ +QTabBar::tab:first:left:selected,QTabBar::tab:first:right:selected{ border-top-width:1px; border-top-color:#B6B6B6; } -QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{ +QTabBar::tab:last:top:selected,QTabBar::tab:last:bottom:selected{ border-right-width:1px; border-right-color:#B6B6B6; } -QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{ +QTabBar::tab:last:left:selected,QTabBar::tab:last:right:selected{ border-bottom-width:1px; border-bottom-color:#B6B6B6; } diff --git a/ui/styledemo/qrc/qss/lightblue.css b/ui/styledemo/qrc/qss/lightblue.css index 55e9ccd..590189b 100644 --- a/ui/styledemo/qrc/qss/lightblue.css +++ b/ui/styledemo/qrc/qss/lightblue.css @@ -495,7 +495,7 @@ margin:0px; background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); } -QTabBar::tab:selected,QTabBar::tab:hover{ +QTabBar::tab:selected{ border-style:solid; border-color:#386488; background:#EAF7FF; @@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{ padding:8px 3px 8px 3px; } -QTabBar::tab:top:selected,QTabBar::tab:top:hover{ +QTabBar::tab:top:selected{ border-width:2px 0px 0px 0px; } -QTabBar::tab:right:selected,QTabBar::tab:right:hover{ +QTabBar::tab:right:selected{ border-width:0px 0px 0px 2px; } -QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ +QTabBar::tab:bottom:selected{ border-width:0px 0px 2px 0px; } -QTabBar::tab:left:selected,QTabBar::tab:left:hover{ +QTabBar::tab:left:selected{ border-width:0px 2px 0px 0px; } -QTabBar::tab:first:top:selected,QTabBar::tab:first:top:hover,QTabBar::tab:first:bottom:selected,QTabBar::tab:first:bottom:hover{ +QTabBar::tab:first:top:selected,QTabBar::tab:first:bottom:selected{ border-left-width:1px; border-left-color:#C0DCF2; } -QTabBar::tab:first:left:selected,QTabBar::tab:first:left:hover,QTabBar::tab:first:right:selected,QTabBar::tab:first:right:hover{ +QTabBar::tab:first:left:selected,QTabBar::tab:first:right:selected{ border-top-width:1px; border-top-color:#C0DCF2; } -QTabBar::tab:last:top:selected,QTabBar::tab:last:top:hover,QTabBar::tab:last:bottom:selected,QTabBar::tab:last:bottom:hover{ +QTabBar::tab:last:top:selected,QTabBar::tab:last:bottom:selected{ border-right-width:1px; border-right-color:#C0DCF2; } -QTabBar::tab:last:left:selected,QTabBar::tab:last:left:hover,QTabBar::tab:last:right:selected,QTabBar::tab:last:right:hover{ +QTabBar::tab:last:left:selected,QTabBar::tab:last:right:selected{ border-bottom-width:1px; border-bottom-color:#C0DCF2; } diff --git a/video/videobox/videobox.cpp b/video/videobox/videobox.cpp index 5ed0654..7f71563 100644 --- a/video/videobox/videobox.cpp +++ b/video/videobox/videobox.cpp @@ -215,7 +215,7 @@ void VideoBox::change_video_normal(int index, int flag) //行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式 //按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面 - for (int i = 0; i < videoCount; i++) { + for (int i = 0; i < videoCount; ++i) { if (i >= index) { //添加到对应布局并设置可见 gridLayout->addWidget(widgets.at(i), row, column); @@ -269,7 +269,7 @@ void VideoBox::change_video_6(const QList &indexs) gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 1, 1); //设置通道控件可见 - for (int i = indexs.first(); i <= indexs.last(); i++) { + for (int i = indexs.first(); i <= indexs.last(); ++i) { widgets.at(i)->setVisible(true); } } @@ -293,7 +293,7 @@ void VideoBox::change_video_8(const QList &indexs) gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 1, 1); //设置通道控件可见 - for (int i = indexs.first(); i <= indexs.last(); i++) { + for (int i = indexs.first(); i <= indexs.last(); ++i) { widgets.at(i)->setVisible(true); } } @@ -322,7 +322,7 @@ void VideoBox::change_video_13(const QList &indexs) gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 1, 1); //设置通道控件可见 - for (int i = indexs.first(); i <= indexs.last(); i++) { + for (int i = indexs.first(); i <= indexs.last(); ++i) { widgets.at(i)->setVisible(true); } } diff --git a/video/videopanel/videobox.cpp b/video/videopanel/videobox.cpp index 5ed0654..7f71563 100644 --- a/video/videopanel/videobox.cpp +++ b/video/videopanel/videobox.cpp @@ -215,7 +215,7 @@ void VideoBox::change_video_normal(int index, int flag) //行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式 //按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面 - for (int i = 0; i < videoCount; i++) { + for (int i = 0; i < videoCount; ++i) { if (i >= index) { //添加到对应布局并设置可见 gridLayout->addWidget(widgets.at(i), row, column); @@ -269,7 +269,7 @@ void VideoBox::change_video_6(const QList &indexs) gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 1, 1); //设置通道控件可见 - for (int i = indexs.first(); i <= indexs.last(); i++) { + for (int i = indexs.first(); i <= indexs.last(); ++i) { widgets.at(i)->setVisible(true); } } @@ -293,7 +293,7 @@ void VideoBox::change_video_8(const QList &indexs) gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 1, 1); //设置通道控件可见 - for (int i = indexs.first(); i <= indexs.last(); i++) { + for (int i = indexs.first(); i <= indexs.last(); ++i) { widgets.at(i)->setVisible(true); } } @@ -322,7 +322,7 @@ void VideoBox::change_video_13(const QList &indexs) gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 1, 1); //设置通道控件可见 - for (int i = indexs.first(); i <= indexs.last(); i++) { + for (int i = indexs.first(); i <= indexs.last(); ++i) { widgets.at(i)->setVisible(true); } } diff --git a/video/videopanel/videopanel.cpp b/video/videopanel/videopanel.cpp index 8a089fb..d28fab2 100644 --- a/video/videopanel/videopanel.cpp +++ b/video/videopanel/videopanel.cpp @@ -75,7 +75,7 @@ void VideoPanel::initForm() videoCount = 64; videoType = "1_16"; - for (int i = 0; i < videoCount; i++) { + for (int i = 0; i < videoCount; ++i) { QLabel *widget = new QLabel; widget->setObjectName(QString("video%1").arg(i + 1)); widget->installEventFilter(this); diff --git a/video/videowidget/videowidget.cpp b/video/videowidget/videowidget.cpp index 14bb56c..414b649 100644 --- a/video/videowidget/videowidget.cpp +++ b/video/videowidget/videowidget.cpp @@ -124,7 +124,7 @@ void VideoWidget::initFlowPanel() #endif //循环添加顶部按钮 - for (int i = 0; i < btns.count(); i++) { + for (int i = 0; i < btns.count(); ++i) { QPushButton *btn = new QPushButton; //绑定按钮单击事件,用来发出信号通知 connect(btn, SIGNAL(clicked(bool)), this, SLOT(btnClicked())); @@ -260,25 +260,25 @@ void VideoWidget::paintEvent(QPaintEvent *) void VideoWidget::drawBorder(QPainter *painter) { - if (borderWidth == 0) { - return; - } - painter->save(); + QPen pen; pen.setWidth(borderWidth); pen.setColor(hasFocus() ? focusColor : borderColor); - painter->setPen(pen); + //边框宽度=0则不绘制边框 + painter->setPen(borderWidth == 0 ? Qt::NoPen : pen); + //顺带把背景颜色这里也一并处理 + if (bgColor != Qt::transparent) { + painter->setBrush(bgColor); + } painter->drawRect(rect()); + painter->restore(); } void VideoWidget::drawBg(QPainter *painter) { painter->save(); - if (bgColor != Qt::transparent) { - painter->fillRect(rect(), bgColor); - } //背景图片为空则绘制文字,否则绘制背景图片 if (bgImage.isNull()) { diff --git a/widget/lunarcalendarwidget/lunarcalendaritem.cpp b/widget/lunarcalendarwidget/lunarcalendaritem.cpp index e49e40e..a003656 100644 --- a/widget/lunarcalendarwidget/lunarcalendaritem.cpp +++ b/widget/lunarcalendarwidget/lunarcalendaritem.cpp @@ -44,11 +44,7 @@ LunarCalendarItem::LunarCalendarItem(QWidget *parent) : QWidget(parent) hoverBgColor = QColor(204, 183, 180); } -#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) -void LunarCalendarItem::enterEvent(QEnterEvent *) -#else void LunarCalendarItem::enterEvent(QEvent *) -#endif { hover = true; this->update(); diff --git a/widget/lunarcalendarwidget/lunarcalendaritem.h b/widget/lunarcalendarwidget/lunarcalendaritem.h index 4a18ea9..de3e56e 100644 --- a/widget/lunarcalendarwidget/lunarcalendaritem.h +++ b/widget/lunarcalendarwidget/lunarcalendaritem.h @@ -62,11 +62,7 @@ public: explicit LunarCalendarItem(QWidget *parent = 0); protected: -#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) - void enterEvent(QEnterEvent *); -#else void enterEvent(QEvent *); -#endif void leaveEvent(QEvent *); void mousePressEvent(QMouseEvent *); void mouseReleaseEvent(QMouseEvent *); diff --git a/widget/lunarcalendarwidget/lunarcalendarwidget.cpp b/widget/lunarcalendarwidget/lunarcalendarwidget.cpp index 51c0110..2a102cf 100644 --- a/widget/lunarcalendarwidget/lunarcalendarwidget.cpp +++ b/widget/lunarcalendarwidget/lunarcalendarwidget.cpp @@ -121,14 +121,14 @@ void LunarCalendarWidget::initWidget() //年份下拉框 cboxYear = new QComboBox; cboxYear->setObjectName("cboxYear"); - for (int i = 1901; i <= 2099; i++) { + for (int i = 1901; i <= 2099; ++i) { cboxYear->addItem(QString("%1年").arg(i)); } //月份下拉框 cboxMonth = new QComboBox; cboxMonth->setObjectName("cboxMonth"); - for (int i = 1; i <= 12; i++) { + for (int i = 1; i <= 12; ++i) { cboxMonth->addItem(QString("%1月").arg(i)); } @@ -162,7 +162,7 @@ void LunarCalendarWidget::initWidget() layoutWeek->setContentsMargins(0, 0, 0, 0); layoutWeek->setSpacing(0); - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 7; ++i) { QLabel *lab = new QLabel; lab->setAlignment(Qt::AlignCenter); layoutWeek->addWidget(lab); @@ -182,7 +182,7 @@ void LunarCalendarWidget::initWidget() layoutBody->setVerticalSpacing(0); //逐个添加日标签 - for (int i = 0; i < 42; i++) { + for (int i = 0; i < 42; ++i) { LunarCalendarItem *lab = new LunarCalendarItem; connect(lab, SIGNAL(clicked(QDate, LunarCalendarItem::DayType)), this, SLOT(clicked(QDate, LunarCalendarItem::DayType))); layoutBody->addWidget(lab, i / 7, i % 7); @@ -303,7 +303,7 @@ void LunarCalendarWidget::initDate() } //显示上月天数 - for (int i = startPre; i < endPre; i++) { + for (int i = startPre; i < endPre; ++i) { index = i; tempDay = countDayPre - endPre + i + 1; @@ -321,7 +321,7 @@ void LunarCalendarWidget::initDate() } //显示下月天数 - for (int i = startNext; i < endNext; i++) { + for (int i = startNext; i < endNext; ++i) { index = 42 - endNext + i; tempDay = i - startNext + 1; @@ -335,7 +335,7 @@ void LunarCalendarWidget::initDate() tempMonth = month; //显示当前月 - for (int i = week; i < (countDay + week); i++) { + for (int i = week; i < (countDay + week); ++i) { index = (0 == week ? (i + 7) : i); tempDay = i - week + 1; @@ -401,7 +401,7 @@ void LunarCalendarWidget::dayChanged(const QDate &date) //qDebug() << QString("%1-%2-%3").arg(year).arg(month).arg(day); //选中当前日期,其他日期恢复,这里还有优化空间,比方说类似单选框机制 - for (int i = 0; i < 42; i++) { + for (int i = 0; i < 42; ++i) { //当月第一天是星期天要另外计算 int index = day + week - 1; if (week == 0) { @@ -652,7 +652,7 @@ void LunarCalendarWidget::setWeekNameFormat(const LunarCalendarWidget::WeekNameF } //逐个添加日期文字 - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 7; ++i) { labWeeks.at(i)->setText(listWeek.at(i)); } }