修复邮件发送模块不支持Qt6的BUG

master
feiyangqingyun 2022-04-26 16:56:33 +08:00
parent 62aa70189a
commit bc5429bebb
28 changed files with 100 additions and 112 deletions

View File

@ -96,7 +96,7 @@ void DeviceSizeTable::load()
{ {
//清空原有数据 //清空原有数据
int row = this->rowCount(); int row = this->rowCount();
for (int i = 0; i < row; i++) { for (int i = 0; i < row; ++i) {
this->removeRow(0); this->removeRow(0);
} }
@ -215,7 +215,7 @@ void DeviceSizeTable::checkSize(const QString &result, const QString &name)
QStringList list = result.split(" "); QStringList list = result.split(" ");
int index = 0; 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(); QString s = list.at(i).trimmed();
if (s == "") { if (s == "") {
continue; continue;

View File

@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
widget->setStyleSheet(qss.join("")); 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++) { for (int j = 0; j < this->btns.count(); j++) {
if (this->btns.at(j) == btns.at(i)) { if (this->btns.at(j) == btns.at(i)) {
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
//存储对应按钮对象,方便鼠标移上去的时候切换图片 //存储对应按钮对象,方便鼠标移上去的时候切换图片
int checkedIndex = -1; int checkedIndex = -1;
for (int i = 0; i < btnCount; i++) { for (int i = 0; i < btnCount; ++i) {
int icon = icons.at(i); int icon = icons.at(i);
QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight);
QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight);

View File

@ -46,11 +46,7 @@ NavButton::NavButton(QWidget *parent) : QPushButton(parent)
setText("导航按钮"); setText("导航按钮");
} }
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
void NavButton::enterEvent(QEnterEvent *)
#else
void NavButton::enterEvent(QEvent *) void NavButton::enterEvent(QEvent *)
#endif
{ {
hover = true; hover = true;
this->update(); this->update();

View File

@ -92,11 +92,7 @@ public:
explicit NavButton(QWidget *parent = 0); explicit NavButton(QWidget *parent = 0);
protected: protected:
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
void enterEvent(QEnterEvent *);
#else
void enterEvent(QEvent *); void enterEvent(QEvent *);
#endif
void leaveEvent(QEvent *); void leaveEvent(QEvent *);
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void drawBg(QPainter *painter); void drawBg(QPainter *painter);

View File

@ -51,13 +51,13 @@ void SmoothCurve::calculateFirstControlPoints(double *&result, const double *rhs
double b = 2.0; double b = 2.0;
result[0] = rhs[0] / b; result[0] = rhs[0] / b;
for (int i = 1; i < n; i++) { for (int i = 1; i < n; ++i) {
tmp[i] = 1 / b; tmp[i] = 1 / b;
b = (i < n - 1 ? 4.0 : 3.5) - tmp[i]; b = (i < n - 1 ? 4.0 : 3.5) - tmp[i];
result[i] = (rhs[i] - result[i - 1]) / b; 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]; result[n - i - 1] -= tmp[n - i] * result[n - i];
} }

View File

@ -277,7 +277,7 @@ QString ZhToPY::zhToJP(const QString &chinese)
QString str; QString str;
int index = 0; 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() ; ushort vChar = chinese.at(i).unicode() ;
if ((vChar >= 'a' && vChar <= 'z') || (vChar >= 'A' && vChar <= 'Z')) { if ((vChar >= 'a' && vChar <= 'z') || (vChar >= 'A' && vChar <= 'Z')) {

View File

@ -77,7 +77,7 @@ void NtpClient::readData()
quint32 seconds = transmitTimeStamp.at(0); quint32 seconds = transmitTimeStamp.at(0);
quint8 temp = 0; quint8 temp = 0;
for (int i = 1; i <= 3; i++) { for (int i = 1; i <= 3; ++i) {
seconds = (seconds << 8); seconds = (seconds << 8);
temp = transmitTimeStamp.at(i); temp = transmitTimeStamp.at(i);
seconds = seconds + temp; seconds = seconds + temp;

View File

@ -5,11 +5,15 @@ greaterThan(QT_MAJOR_VERSION, 4): CONFIG += c++11
!contains(DEFINES, qcustomplot_v1_3) { !contains(DEFINES, qcustomplot_v1_3) {
!contains(DEFINES, qcustomplot_v2_0) { !contains(DEFINES, qcustomplot_v2_0) {
!contains(DEFINES, qcustomplot_v2_1) { !contains(DEFINES, qcustomplot_v2_1) {
greaterThan(QT_MAJOR_VERSION, 4) {
DEFINES += qcustomplot_v2_1
} else {
DEFINES += qcustomplot_v2_0 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) { contains(DEFINES, qcustomplot_v1_3) {
INCLUDEPATH += $$PWD/v1_3 INCLUDEPATH += $$PWD/v1_3

View File

@ -1,4 +1,4 @@
/*************************************************************************** /***************************************************************************
** ** ** **
** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** QCustomPlot, an easy to use, modern plotting widget for Qt **
** Copyright (C) 2011-2015 Emanuel Eichhammer ** ** 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 aiRight: return (rect.topRight()+rect.bottomRight())*0.5;
case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5;
case aiBottomLeft: return rect.bottomLeft(); 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; qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId;

View File

@ -1,4 +1,4 @@
/*************************************************************************** /***************************************************************************
** ** ** **
** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** QCustomPlot, an easy to use, modern plotting widget for Qt **
** Copyright (C) 2011-2018 Emanuel Eichhammer ** ** Copyright (C) 2011-2018 Emanuel Eichhammer **
@ -4002,7 +4002,7 @@ QSize QCPLayout::getFinalMinimumOuterSize(const QCPLayoutElement *el)
minOuter.rheight() += el->margins().top() + el->margins().bottom(); minOuter.rheight() += el->margins().top() + el->margins().bottom();
return QSize(minOuter.width() > 0 ? minOuter.width() : minOuterHint.width(), return QSize(minOuter.width() > 0 ? minOuter.width() : minOuterHint.width(),
minOuter.height() > 0 ? minOuter.height() : minOuterHint.height());; minOuter.height() > 0 ? minOuter.height() : minOuterHint.height());
} }
/*! \internal /*! \internal
@ -29480,7 +29480,7 @@ QPointF QCPItemPixmap::anchorPixelPosition(int anchorId) const
case aiRight: return (rect.topRight()+rect.bottomRight())*0.5; case aiRight: return (rect.topRight()+rect.bottomRight())*0.5;
case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5;
case aiBottomLeft: return rect.bottomLeft(); 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; qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId;

View File

@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
widget->setStyleSheet(qss.join("")); 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++) { for (int j = 0; j < this->btns.count(); j++) {
if (this->btns.at(j) == btns.at(i)) { if (this->btns.at(j) == btns.at(i)) {
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
//存储对应按钮对象,方便鼠标移上去的时候切换图片 //存储对应按钮对象,方便鼠标移上去的时候切换图片
int checkedIndex = -1; int checkedIndex = -1;
for (int i = 0; i < btnCount; i++) { for (int i = 0; i < btnCount; ++i) {
int icon = icons.at(i); int icon = icons.at(i);
QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight);
QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight);

View File

@ -7,10 +7,7 @@ class EmailAddress : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
EmailAddress();
EmailAddress(const QString &address, const QString &name = ""); EmailAddress(const QString &address, const QString &name = "");
~EmailAddress(); ~EmailAddress();
void setName(const QString &name); void setName(const QString &name);

View File

@ -13,8 +13,3 @@ SUBDIRS += keytool
SUBDIRS += keydemo SUBDIRS += keydemo
SUBDIRS += livetool SUBDIRS += livetool
SUBDIRS += livedemo SUBDIRS += livedemo
#Qt6有些代码没适配
greaterThan(QT_MAJOR_VERSION, 5) {
SUBDIRS -= emailtool
}

View File

@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
widget->setStyleSheet(qss.join("")); 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++) { for (int j = 0; j < this->btns.count(); j++) {
if (this->btns.at(j) == btns.at(i)) { if (this->btns.at(j) == btns.at(i)) {
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
//存储对应按钮对象,方便鼠标移上去的时候切换图片 //存储对应按钮对象,方便鼠标移上去的时候切换图片
int checkedIndex = -1; int checkedIndex = -1;
for (int i = 0; i < btnCount; i++) { for (int i = 0; i < btnCount; ++i) {
int icon = icons.at(i); int icon = icons.at(i);
QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight);
QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight);

View File

@ -495,7 +495,7 @@ margin:0px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252); 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-style:solid;
border-color:#AAAAAA; border-color:#AAAAAA;
background:#444444; background:#444444;
@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{
padding:8px 3px 8px 3px; padding:8px 3px 8px 3px;
} }
QTabBar::tab:top:selected,QTabBar::tab:top:hover{ QTabBar::tab:top:selected{
border-width:2px 0px 0px 0px; border-width:2px 0px 0px 0px;
} }
QTabBar::tab:right:selected,QTabBar::tab:right:hover{ QTabBar::tab:right:selected{
border-width:0px 0px 0px 2px; border-width:0px 0px 0px 2px;
} }
QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ QTabBar::tab:bottom:selected{
border-width:0px 0px 2px 0px; border-width:0px 0px 2px 0px;
} }
QTabBar::tab:left:selected,QTabBar::tab:left:hover{ QTabBar::tab:left:selected{
border-width:0px 2px 0px 0px; 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-width:1px;
border-left-color:#242424; 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-width:1px;
border-top-color:#242424; 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-width:1px;
border-right-color:#242424; 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-width:1px;
border-bottom-color:#242424; border-bottom-color:#242424;
} }

View File

@ -328,7 +328,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
widget->setStyleSheet(qss.join("")); 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++) { for (int j = 0; j < this->btns.count(); j++) {
if (this->btns.at(j) == btns.at(i)) { if (this->btns.at(j) == btns.at(i)) {
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool))); disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
@ -345,7 +345,7 @@ void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList
//存储对应按钮对象,方便鼠标移上去的时候切换图片 //存储对应按钮对象,方便鼠标移上去的时候切换图片
int checkedIndex = -1; int checkedIndex = -1;
for (int i = 0; i < btnCount; i++) { for (int i = 0; i < btnCount; ++i) {
int icon = icons.at(i); int icon = icons.at(i);
QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight);
QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight); QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight);

View File

@ -28,7 +28,7 @@ void frmMain::initForm()
//加载鼠标右键菜单翻译文件 //加载鼠标右键菜单翻译文件
QTranslator *translator1 = new QTranslator(qApp); QTranslator *translator1 = new QTranslator(qApp);
if (translator1->load(":/qm/qt_zh_CN.qm")){ if (translator1->load(":/qm/qt_zh_CN.qm")) {
qApp->installTranslator(translator1); qApp->installTranslator(translator1);
} }
@ -44,7 +44,7 @@ void frmMain::initForm()
void frmMain::loadStyle(const QString &qssFile) void frmMain::loadStyle(const QString &qssFile)
{ {
//加载样式表 //加载样式表
QString qss; QString qss;
QFile file(qssFile); QFile file(qssFile);
if (file.open(QFile::ReadOnly)) { if (file.open(QFile::ReadOnly)) {
//用QTextStream读取样式文件不用区分文件编码 带bom也行 //用QTextStream读取样式文件不用区分文件编码 带bom也行
@ -79,3 +79,10 @@ void frmMain::on_btnStyle3_clicked()
{ {
loadStyle(":/qss/blacksoft.css"); loadStyle(":/qss/blacksoft.css");
} }
void frmMain::on_btnInfo_clicked()
{
//QFileDialog::getOpenFileName(this, "", "", "", 0, QFileDialog::DontUseNativeDialog);
//QFileDialog::getExistingDirectory(0, "", "", QFileDialog::DontUseNativeDialog);
}

View File

@ -26,6 +26,7 @@ private slots:
void on_btnStyle1_clicked(); void on_btnStyle1_clicked();
void on_btnStyle2_clicked(); void on_btnStyle2_clicked();
void on_btnStyle3_clicked(); void on_btnStyle3_clicked();
void on_btnInfo_clicked();
}; };
#endif // FRMMAIN_H #endif // FRMMAIN_H

View File

@ -495,7 +495,7 @@ margin:0px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252); 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-style:solid;
border-color:#AAAAAA; border-color:#AAAAAA;
background:#444444; background:#444444;
@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{
padding:8px 3px 8px 3px; padding:8px 3px 8px 3px;
} }
QTabBar::tab:top:selected,QTabBar::tab:top:hover{ QTabBar::tab:top:selected{
border-width:2px 0px 0px 0px; border-width:2px 0px 0px 0px;
} }
QTabBar::tab:right:selected,QTabBar::tab:right:hover{ QTabBar::tab:right:selected{
border-width:0px 0px 0px 2px; border-width:0px 0px 0px 2px;
} }
QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ QTabBar::tab:bottom:selected{
border-width:0px 0px 2px 0px; border-width:0px 0px 2px 0px;
} }
QTabBar::tab:left:selected,QTabBar::tab:left:hover{ QTabBar::tab:left:selected{
border-width:0px 2px 0px 0px; 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-width:1px;
border-left-color:#242424; 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-width:1px;
border-top-color:#242424; 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-width:1px;
border-right-color:#242424; 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-width:1px;
border-bottom-color:#242424; border-bottom-color:#242424;
} }

View File

@ -495,7 +495,7 @@ margin:0px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1 #F6F6F6); 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-style:solid;
border-color:#575959; border-color:#575959;
background:#FFFFFF; background:#FFFFFF;
@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{
padding:8px 3px 8px 3px; padding:8px 3px 8px 3px;
} }
QTabBar::tab:top:selected,QTabBar::tab:top:hover{ QTabBar::tab:top:selected{
border-width:2px 0px 0px 0px; border-width:2px 0px 0px 0px;
} }
QTabBar::tab:right:selected,QTabBar::tab:right:hover{ QTabBar::tab:right:selected{
border-width:0px 0px 0px 2px; border-width:0px 0px 0px 2px;
} }
QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ QTabBar::tab:bottom:selected{
border-width:0px 0px 2px 0px; border-width:0px 0px 2px 0px;
} }
QTabBar::tab:left:selected,QTabBar::tab:left:hover{ QTabBar::tab:left:selected{
border-width:0px 2px 0px 0px; 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-width:1px;
border-left-color:#B6B6B6; 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-width:1px;
border-top-color:#B6B6B6; 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-width:1px;
border-right-color:#B6B6B6; 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-width:1px;
border-bottom-color:#B6B6B6; border-bottom-color:#B6B6B6;
} }

View File

@ -495,7 +495,7 @@ margin:0px;
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F2F9FF,stop:1 #DAEFFF); 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-style:solid;
border-color:#386488; border-color:#386488;
background:#EAF7FF; background:#EAF7FF;
@ -509,38 +509,38 @@ QTabBar::tab:left,QTabBar::tab:right{
padding:8px 3px 8px 3px; padding:8px 3px 8px 3px;
} }
QTabBar::tab:top:selected,QTabBar::tab:top:hover{ QTabBar::tab:top:selected{
border-width:2px 0px 0px 0px; border-width:2px 0px 0px 0px;
} }
QTabBar::tab:right:selected,QTabBar::tab:right:hover{ QTabBar::tab:right:selected{
border-width:0px 0px 0px 2px; border-width:0px 0px 0px 2px;
} }
QTabBar::tab:bottom:selected,QTabBar::tab:bottom:hover{ QTabBar::tab:bottom:selected{
border-width:0px 0px 2px 0px; border-width:0px 0px 2px 0px;
} }
QTabBar::tab:left:selected,QTabBar::tab:left:hover{ QTabBar::tab:left:selected{
border-width:0px 2px 0px 0px; 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-width:1px;
border-left-color:#C0DCF2; 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-width:1px;
border-top-color:#C0DCF2; 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-width:1px;
border-right-color:#C0DCF2; 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-width:1px;
border-bottom-color:#C0DCF2; border-bottom-color:#C0DCF2;
} }

View File

@ -215,7 +215,7 @@ void VideoBox::change_video_normal(int index, int flag)
//行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式 //行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式
//按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面 //按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面
for (int i = 0; i < videoCount; i++) { for (int i = 0; i < videoCount; ++i) {
if (i >= index) { if (i >= index) {
//添加到对应布局并设置可见 //添加到对应布局并设置可见
gridLayout->addWidget(widgets.at(i), row, column); gridLayout->addWidget(widgets.at(i), row, column);
@ -269,7 +269,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 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); widgets.at(i)->setVisible(true);
} }
} }
@ -293,7 +293,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 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); widgets.at(i)->setVisible(true);
} }
} }
@ -322,7 +322,7 @@ void VideoBox::change_video_13(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 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); widgets.at(i)->setVisible(true);
} }
} }

View File

@ -215,7 +215,7 @@ void VideoBox::change_video_normal(int index, int flag)
//行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式 //行列数一致的比如 2*2 3*4 4*4 5*5 等可以直接套用通用的公式
//按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面 //按照这个函数还可以非常容易的拓展出 10*10 16*16=256 通道界面
for (int i = 0; i < videoCount; i++) { for (int i = 0; i < videoCount; ++i) {
if (i >= index) { if (i >= index) {
//添加到对应布局并设置可见 //添加到对应布局并设置可见
gridLayout->addWidget(widgets.at(i), row, column); gridLayout->addWidget(widgets.at(i), row, column);
@ -269,7 +269,7 @@ void VideoBox::change_video_6(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(4)), 2, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(5)), 2, 0, 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); widgets.at(i)->setVisible(true);
} }
} }
@ -293,7 +293,7 @@ void VideoBox::change_video_8(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(6)), 3, 1, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(7)), 3, 0, 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); widgets.at(i)->setVisible(true);
} }
} }
@ -322,7 +322,7 @@ void VideoBox::change_video_13(const QList<int> &indexs)
gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1); gridLayout->addWidget(widgets.at(indexs.at(11)), 3, 2, 1, 1);
gridLayout->addWidget(widgets.at(indexs.at(12)), 3, 3, 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); widgets.at(i)->setVisible(true);
} }
} }

View File

@ -75,7 +75,7 @@ void VideoPanel::initForm()
videoCount = 64; videoCount = 64;
videoType = "1_16"; videoType = "1_16";
for (int i = 0; i < videoCount; i++) { for (int i = 0; i < videoCount; ++i) {
QLabel *widget = new QLabel; QLabel *widget = new QLabel;
widget->setObjectName(QString("video%1").arg(i + 1)); widget->setObjectName(QString("video%1").arg(i + 1));
widget->installEventFilter(this); widget->installEventFilter(this);

View File

@ -124,7 +124,7 @@ void VideoWidget::initFlowPanel()
#endif #endif
//循环添加顶部按钮 //循环添加顶部按钮
for (int i = 0; i < btns.count(); i++) { for (int i = 0; i < btns.count(); ++i) {
QPushButton *btn = new QPushButton; QPushButton *btn = new QPushButton;
//绑定按钮单击事件,用来发出信号通知 //绑定按钮单击事件,用来发出信号通知
connect(btn, SIGNAL(clicked(bool)), this, SLOT(btnClicked())); connect(btn, SIGNAL(clicked(bool)), this, SLOT(btnClicked()));
@ -260,25 +260,25 @@ void VideoWidget::paintEvent(QPaintEvent *)
void VideoWidget::drawBorder(QPainter *painter) void VideoWidget::drawBorder(QPainter *painter)
{ {
if (borderWidth == 0) {
return;
}
painter->save(); painter->save();
QPen pen; QPen pen;
pen.setWidth(borderWidth); pen.setWidth(borderWidth);
pen.setColor(hasFocus() ? focusColor : borderColor); 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->drawRect(rect());
painter->restore(); painter->restore();
} }
void VideoWidget::drawBg(QPainter *painter) void VideoWidget::drawBg(QPainter *painter)
{ {
painter->save(); painter->save();
if (bgColor != Qt::transparent) {
painter->fillRect(rect(), bgColor);
}
//背景图片为空则绘制文字,否则绘制背景图片 //背景图片为空则绘制文字,否则绘制背景图片
if (bgImage.isNull()) { if (bgImage.isNull()) {

View File

@ -44,11 +44,7 @@ LunarCalendarItem::LunarCalendarItem(QWidget *parent) : QWidget(parent)
hoverBgColor = QColor(204, 183, 180); hoverBgColor = QColor(204, 183, 180);
} }
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
void LunarCalendarItem::enterEvent(QEnterEvent *)
#else
void LunarCalendarItem::enterEvent(QEvent *) void LunarCalendarItem::enterEvent(QEvent *)
#endif
{ {
hover = true; hover = true;
this->update(); this->update();

View File

@ -62,11 +62,7 @@ public:
explicit LunarCalendarItem(QWidget *parent = 0); explicit LunarCalendarItem(QWidget *parent = 0);
protected: protected:
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
void enterEvent(QEnterEvent *);
#else
void enterEvent(QEvent *); void enterEvent(QEvent *);
#endif
void leaveEvent(QEvent *); void leaveEvent(QEvent *);
void mousePressEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *); void mouseReleaseEvent(QMouseEvent *);

View File

@ -121,14 +121,14 @@ void LunarCalendarWidget::initWidget()
//年份下拉框 //年份下拉框
cboxYear = new QComboBox; cboxYear = new QComboBox;
cboxYear->setObjectName("cboxYear"); cboxYear->setObjectName("cboxYear");
for (int i = 1901; i <= 2099; i++) { for (int i = 1901; i <= 2099; ++i) {
cboxYear->addItem(QString("%1年").arg(i)); cboxYear->addItem(QString("%1年").arg(i));
} }
//月份下拉框 //月份下拉框
cboxMonth = new QComboBox; cboxMonth = new QComboBox;
cboxMonth->setObjectName("cboxMonth"); cboxMonth->setObjectName("cboxMonth");
for (int i = 1; i <= 12; i++) { for (int i = 1; i <= 12; ++i) {
cboxMonth->addItem(QString("%1月").arg(i)); cboxMonth->addItem(QString("%1月").arg(i));
} }
@ -162,7 +162,7 @@ void LunarCalendarWidget::initWidget()
layoutWeek->setContentsMargins(0, 0, 0, 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) {
QLabel *lab = new QLabel; QLabel *lab = new QLabel;
lab->setAlignment(Qt::AlignCenter); lab->setAlignment(Qt::AlignCenter);
layoutWeek->addWidget(lab); layoutWeek->addWidget(lab);
@ -182,7 +182,7 @@ void LunarCalendarWidget::initWidget()
layoutBody->setVerticalSpacing(0); layoutBody->setVerticalSpacing(0);
//逐个添加日标签 //逐个添加日标签
for (int i = 0; i < 42; i++) { for (int i = 0; i < 42; ++i) {
LunarCalendarItem *lab = new LunarCalendarItem; LunarCalendarItem *lab = new LunarCalendarItem;
connect(lab, SIGNAL(clicked(QDate, LunarCalendarItem::DayType)), this, SLOT(clicked(QDate, LunarCalendarItem::DayType))); connect(lab, SIGNAL(clicked(QDate, LunarCalendarItem::DayType)), this, SLOT(clicked(QDate, LunarCalendarItem::DayType)));
layoutBody->addWidget(lab, i / 7, i % 7); 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; index = i;
tempDay = countDayPre - endPre + i + 1; 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; index = 42 - endNext + i;
tempDay = i - startNext + 1; tempDay = i - startNext + 1;
@ -335,7 +335,7 @@ void LunarCalendarWidget::initDate()
tempMonth = month; tempMonth = month;
//显示当前月 //显示当前月
for (int i = week; i < (countDay + week); i++) { for (int i = week; i < (countDay + week); ++i) {
index = (0 == week ? (i + 7) : i); index = (0 == week ? (i + 7) : i);
tempDay = i - week + 1; 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); //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; int index = day + week - 1;
if (week == 0) { 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)); labWeeks.at(i)->setText(listWeek.at(i));
} }
} }