diff --git a/0snap/savelog.jpg b/0snap/savelog.jpg new file mode 100644 index 0000000..8dadec0 Binary files /dev/null and b/0snap/savelog.jpg differ diff --git a/0snap/savelog.png b/0snap/savelog.png deleted file mode 100644 index 907fac4..0000000 Binary files a/0snap/savelog.png and /dev/null differ diff --git a/0snap/saveruntime.jpg b/0snap/saveruntime.jpg index 4bb29f1..4b5dae4 100644 Binary files a/0snap/saveruntime.jpg and b/0snap/saveruntime.jpg differ diff --git a/README.md b/README.md index 8f5516f..ac416cf 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -#### 一、目录说明 +#### 一、目录说明 1. **可以选择打开QWidgetDemo.pro一次性编译所有的,也可以进入到目录下打开pro进行编译。** 2. **如果发现有些子项目没有加载请打开QWidgetDemo.pro仔细看里面的注释。** 3. **编译好的可执行文件在源码同级目录下的bin目录。** 4. **亲测Qt4.6到Qt6.2所有版本,亲测win、linux、mac、uos等系统。** 5. **本项目开源的是下面表格中描述的内容,并未开源左侧的树状导航菜单控件,只是方便演示效果图直接用的自定义控件大全的效果图,懒得重新截图。** +6. **建议用git命令行下载,压缩包下载后重新解压文件可能会有问题,不知为何。** | 编号 | 文件夹 | 描述 | | :------ | :------ | :------ | @@ -77,7 +78,7 @@ ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/bgdemo.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/dbpage.png) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/pngtool.gif) -![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/savelog.png) +![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/savelog.jpg) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/saveruntime.jpg) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/colorwidget.gif) ![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/maskwidget.gif) diff --git a/core_qui/base64helper.cpp b/core_qui/base64helper.cpp deleted file mode 100644 index 6093970..0000000 --- a/core_qui/base64helper.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "base64helper.h" -#include "qbuffer.h" -#include "qdebug.h" - -QString Base64Helper::imageToBase64(const QImage &image) -{ - return QString(imageToBase64x(image)); -} - -QByteArray Base64Helper::imageToBase64x(const QImage &image) -{ - //这个转换可能比较耗时建议在线程中执行 - QByteArray data; - QBuffer buffer(&data); - image.save(&buffer, "JPG"); - data = data.toBase64(); - return data; -} - -QImage Base64Helper::base64ToImage(const QString &data) -{ - return base64ToImagex(data.toUtf8()); -} - -QImage Base64Helper::base64ToImagex(const QByteArray &data) -{ - //这个转换可能比较耗时建议在线程中执行 - QImage image; - image.loadFromData(QByteArray::fromBase64(data)); - return image; -} - -QString Base64Helper::textToBase64(const QString &text) -{ - return QString(text.toLocal8Bit().toBase64()); -} - -QString Base64Helper::base64ToText(const QString &text) -{ - return QString(QByteArray::fromBase64(text.toLocal8Bit())); -} diff --git a/core_qui/base64helper.h b/core_qui/base64helper.h deleted file mode 100644 index e17cae6..0000000 --- a/core_qui/base64helper.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef BASE64HELPER_H -#define BASE64HELPER_H - -/** - * base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16 - * 1. 图片转base64字符串。 - * 2. base64字符串转图片。 - * 3. 字符转base64字符串。 - * 4. base64字符串转字符。 - * 5. 后期增加数据压缩。 - * 6. Qt6对base64编码转换进行了重写效率提升至少200%。 - */ - -#include - -#ifdef quc -class Q_DECL_EXPORT Base64Helper -#else -class Base64Helper -#endif - -{ -public: - //图片转base64字符串 - static QString imageToBase64(const QImage &image); - static QByteArray imageToBase64x(const QImage &image); - - //base64字符串转图片 - static QImage base64ToImage(const QString &data); - static QImage base64ToImagex(const QByteArray &data); - - //字符串与base64互转 - static QString textToBase64(const QString &text); - static QString base64ToText(const QString &text); -}; - -#endif // BASE64HELPER_H diff --git a/core_qui/core_qui.pri b/core_qui/core_qui.pri index bcae2ad..e8980ee 100644 --- a/core_qui/core_qui.pri +++ b/core_qui/core_qui.pri @@ -21,7 +21,6 @@ CONFIG += resources_big include ($$PWD/h3.pri) HEADERS += \ - $$PWD/base64helper.h \ $$PWD/iconhelper.h \ $$PWD/quiconfig.h \ $$PWD/quidateselect.h \ @@ -34,7 +33,6 @@ HEADERS += \ $$PWD/quiwidget.h SOURCES += \ - $$PWD/base64helper.cpp \ $$PWD/iconhelper.cpp \ $$PWD/quiconfig.cpp \ $$PWD/quidateselect.cpp \ diff --git a/core_qui/quihead.h b/core_qui/quihead.h index 3252eee..87dc700 100644 --- a/core_qui/quihead.h +++ b/core_qui/quihead.h @@ -59,5 +59,6 @@ #include "quitipbox.h" #include "quidateselect.h" #include "quiinputbox.h" +#include "quiwidget.h" #endif // QUIHEAD_H diff --git a/core_qui/quihelper.cpp b/core_qui/quihelper.cpp index aad78be..0323784 100644 --- a/core_qui/quihelper.cpp +++ b/core_qui/quihelper.cpp @@ -1372,3 +1372,87 @@ bool QUIHelper::checkRowCount(int rowCount, int maxCount, int warnCount) return true; } + +QPixmap QUIHelper::getPixmap(QWidget *widget, const QPixmap &pixmap, bool scale) +{ + if (pixmap.isNull()) { + return pixmap; + } + + //scale=false 超过尺寸才需要等比例缩放 + QPixmap pix = pixmap; + if (scale) { + pix = pix.scaled(widget->size() - QSize(2, 2), Qt::KeepAspectRatio, Qt::SmoothTransformation); + } else if (pix.width() > widget->width() || pix.height() > widget->height()) { + pix = pix.scaled(widget->size() - QSize(2, 2), Qt::KeepAspectRatio, Qt::SmoothTransformation); + } + + return pix; +} + +void QUIHelper::setPixmap(QLabel *label, const QString &file, bool scale) +{ + //文件不存在则不用处理 + if (!QFile(file).exists()) { + label->clear(); + return; + } + + QPixmap pixmap(file); + pixmap = getPixmap(label, pixmap); + label->setPixmap(pixmap); +} + +void QUIHelper::setLogo(QLabel *label, const QString &file, + int width, int height, int offset, + const QString &oldColor, const QString &newColor) +{ + //如果是icon开头则表示图形字体否则取logo图片 + if (file.startsWith("icon")) { + //设置图形字体作为logo + height = 55, width = 80; + QString text = file.split("_").last(); + int icon = text.toInt(NULL, 16); + IconHelper::setIcon(label, icon, height); + } else { + //区分资源文件和本地文件 + QString fileName = file; + if (!file.startsWith(":/")) { + height = 50; + fileName = QString("%1/logo/%2.png").arg(QUIHelper::appPath()).arg(file); + } + + //svg图片自动换颜色 + if (file.endsWith(".svg")) { + //打开文件对指定颜色进行替换 + QFile f(file); + if (f.open(QFile::ReadOnly)) { + QString text = f.readAll(); + text.replace(oldColor, newColor); + f.close(); + + //打开新的文件输出 + fileName = QString("%1/logo/temp.svg").arg(QUIHelper::appPath()); + QFile f2(fileName); + if (f2.open(QFile::WriteOnly)) { + f2.write(text.toUtf8()); + f2.close(); + } + } + } + + //自动计算宽度比例 + QPixmap pixmap(fileName); + width = pixmap.width() / (pixmap.height() / height); + pixmap = pixmap.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); + label->setPixmap(pixmap); + } + + //设置logo标签最小宽度 + if (width - height < offset) { + width += offset; + } + + label->setFixedWidth(width); + label->setAlignment(Qt::AlignCenter); +} diff --git a/core_qui/quihelper.h b/core_qui/quihelper.h index 5e24f88..cf8365f 100644 --- a/core_qui/quihelper.h +++ b/core_qui/quihelper.h @@ -223,6 +223,14 @@ public: static void openFile(const QString &fileName, const QString &msg); //导出和打印数据提示框 static bool checkRowCount(int rowCount, int maxCount, int warnCount); + + //获取等比例缩放过的图片 + static QPixmap getPixmap(QWidget *widget, const QPixmap &pixmap, bool scale = false); + static void setPixmap(QLabel *label, const QString &file, bool scale = false); + //设置logo图片支持 资源文件+本地图片+图形字体+svg自动变色 等多种形式 + static void setLogo(QLabel *label, const QString &file, + int width, int height, int offset = 20, + const QString &oldColor = QString(), const QString &newColor = QString()); }; #endif // QUIHELPER_H diff --git a/core_qui/quistyle.cpp b/core_qui/quistyle.cpp index d52dce6..5acddba 100644 --- a/core_qui/quistyle.cpp +++ b/core_qui/quistyle.cpp @@ -25,11 +25,25 @@ void QUIStyle::getStyle(QStringList &styleNames, QStringList &styleFiles) styleFiles = files; } -void QUIStyle::setStyle(const QString &qss, const QString &paletteColor) +void QUIStyle::setStyle(const QString &qss) { + QStringList list; + list << qss; + + //5.12开始tabbar左右反过来的 +#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) + //左右两侧的边框偏移一个像素 + list << "QTabWidget::pane:left{left:-1px;right:0px;}"; + list << "QTabWidget::pane:right{right:-1px;left:0px;}"; + //选中和悬停的时候边缘加深2个像素 + list << "QTabBar::tab:left:selected,QTabBar::tab:left:hover{border-width:0px 0px 0px 2px;}"; + list << "QTabBar::tab:right:selected,QTabBar::tab:right:hover{border-width:0px 2px 0px 0px;}"; +#endif + QUIHelper::isCustomUI = true; + QString paletteColor = qss.mid(20, 7); qApp->setPalette(QPalette(paletteColor)); - qApp->setStyleSheet(qss); + qApp->setStyleSheet(list.join("")); } void QUIStyle::setStyle(const QUIStyle::Style &style) @@ -48,18 +62,18 @@ void QUIStyle::setStyle(const QUIStyle::Style &style) QString paletteColor = qss.mid(20, 7); getQssColor(qss, QUIConfig::TextColor, QUIConfig::PanelColor, QUIConfig::BorderColor, QUIConfig::NormalColorStart, QUIConfig::NormalColorEnd, QUIConfig::DarkColorStart, QUIConfig::DarkColorEnd, QUIConfig::HighColor); - setStyle(qss, paletteColor); + setStyle(qss); file.close(); } } -void QUIStyle::setStyle(const QString &qssFile) +void QUIStyle::setStyleFile(const QString &qssFile) { QString paletteColor, textColor; - setStyle(qssFile, paletteColor, textColor); + setStyleFile(qssFile, paletteColor, textColor); } -void QUIStyle::setStyle(const QString &qssFile, QString &paletteColor, QString &textColor) +void QUIStyle::setStyleFile(const QString &qssFile, QString &paletteColor, QString &textColor) { QFile file(qssFile); if (file.open(QFile::ReadOnly)) { @@ -68,78 +82,49 @@ void QUIStyle::setStyle(const QString &qssFile, QString &paletteColor, QString & textColor = qss.mid(49, 7); getQssColor(qss, QUIConfig::TextColor, QUIConfig::PanelColor, QUIConfig::BorderColor, QUIConfig::NormalColorStart, QUIConfig::NormalColorEnd, QUIConfig::DarkColorStart, QUIConfig::DarkColorEnd, QUIConfig::HighColor); - setStyle(qss, paletteColor); + setStyle(qss); file.close(); } } -void QUIStyle::setStyle(const QString &qssFile, QString &textColor, QString &panelColor, QString &borderColor, - QString &normalColorStart, QString &normalColorEnd, - QString &darkColorStart, QString &darkColorEnd, QString &highColor) +void QUIStyle::setStyleFile(const QString &qssFile, QString &textColor, QString &panelColor, QString &borderColor, + QString &normalColorStart, QString &normalColorEnd, + QString &darkColorStart, QString &darkColorEnd, QString &highColor) { QFile file(qssFile); if (file.open(QFile::ReadOnly)) { QString qss = QLatin1String(file.readAll()); getQssColor(qss, textColor, panelColor, borderColor, normalColorStart, normalColorEnd, darkColorStart, darkColorEnd, highColor); - setStyle(qss, panelColor); + setStyle(qss); file.close(); } } -void QUIStyle::getQssColor(const QString &qss, QString &textColor, QString &panelColor, QString &borderColor, +void QUIStyle::getQssColor(const QString &qss, const QString &flag, QString &color) +{ + int index = qss.indexOf(flag); + if (index >= 0) { + color = qss.mid(index + flag.length(), 7); + } + //qDebug() << TIMEMS << flag << color; +} + +void QUIStyle::getQssColor(const QString &qss, QString &textColor, + QString &panelColor, QString &borderColor, QString &normalColorStart, QString &normalColorEnd, QString &darkColorStart, QString &darkColorEnd, QString &highColor) { + getQssColor(qss, "TextColor:", textColor); + getQssColor(qss, "PanelColor:", panelColor); + getQssColor(qss, "BorderColor:", borderColor); + getQssColor(qss, "NormalColorStart:", normalColorStart); + getQssColor(qss, "NormalColorEnd:", normalColorEnd); + getQssColor(qss, "DarkColorStart:", darkColorStart); + getQssColor(qss, "DarkColorEnd:", darkColorEnd); + getQssColor(qss, "HighColor:", highColor); + QUIHelper::isCustomUI = true; - - QString str = qss; - QString flagTextColor = "TextColor:"; - int indexTextColor = str.indexOf(flagTextColor); - if (indexTextColor >= 0) { - textColor = str.mid(indexTextColor + flagTextColor.length(), 7); - } - - QString flagPanelColor = "PanelColor:"; - int indexPanelColor = str.indexOf(flagPanelColor); - if (indexPanelColor >= 0) { - panelColor = str.mid(indexPanelColor + flagPanelColor.length(), 7); - } - - QString flagBorderColor = "BorderColor:"; - int indexBorderColor = str.indexOf(flagBorderColor); - if (indexBorderColor >= 0) { - borderColor = str.mid(indexBorderColor + flagBorderColor.length(), 7); - } - - QString flagNormalColorStart = "NormalColorStart:"; - int indexNormalColorStart = str.indexOf(flagNormalColorStart); - if (indexNormalColorStart >= 0) { - normalColorStart = str.mid(indexNormalColorStart + flagNormalColorStart.length(), 7); - } - - QString flagNormalColorEnd = "NormalColorEnd:"; - int indexNormalColorEnd = str.indexOf(flagNormalColorEnd); - if (indexNormalColorEnd >= 0) { - normalColorEnd = str.mid(indexNormalColorEnd + flagNormalColorEnd.length(), 7); - } - - QString flagDarkColorStart = "DarkColorStart:"; - int indexDarkColorStart = str.indexOf(flagDarkColorStart); - if (indexDarkColorStart >= 0) { - darkColorStart = str.mid(indexDarkColorStart + flagDarkColorStart.length(), 7); - } - - QString flagDarkColorEnd = "DarkColorEnd:"; - int indexDarkColorEnd = str.indexOf(flagDarkColorEnd); - if (indexDarkColorEnd >= 0) { - darkColorEnd = str.mid(indexDarkColorEnd + flagDarkColorEnd.length(), 7); - } - - QString flagHighColor = "HighColor:"; - int indexHighColor = str.indexOf(flagHighColor); - if (indexHighColor >= 0) { - highColor = str.mid(indexHighColor + flagHighColor.length(), 7); - } + QUIConfig::TextColor = textColor; } void QUIStyle::setLabStyle(QLabel *lab, quint8 type, const QString &bgColor, const QString &textColor) diff --git a/core_qui/quistyle.h b/core_qui/quistyle.h index 18915e2..5ca5180 100644 --- a/core_qui/quistyle.h +++ b/core_qui/quistyle.h @@ -30,17 +30,18 @@ public: //获取皮肤样式中文名称和对应的样式表文件 static void getStyle(QStringList &styleNames, QStringList &styleFiles); //设置全局样式 - static void setStyle(const QString &qss, const QString &paletteColor); + static void setStyle(const QString &qss); static void setStyle(const QUIStyle::Style &style); - static void setStyle(const QString &qssFile); - static void setStyle(const QString &qssFile, QString &paletteColor, QString &textColor); - static void setStyle(const QString &qssFile, QString &textColor, - QString &panelColor, QString &borderColor, - QString &normalColorStart, QString &normalColorEnd, - QString &darkColorStart, QString &darkColorEnd, - QString &highColor); + static void setStyleFile(const QString &qssFile); + static void setStyleFile(const QString &qssFile, QString &paletteColor, QString &textColor); + static void setStyleFile(const QString &qssFile, QString &textColor, + QString &panelColor, QString &borderColor, + QString &normalColorStart, QString &normalColorEnd, + QString &darkColorStart, QString &darkColorEnd, + QString &highColor); //根据QSS样式获取对应颜色值 + static void getQssColor(const QString &qss, const QString &flag, QString &color); static void getQssColor(const QString &qss, QString &textColor, QString &panelColor, QString &borderColor, QString &normalColorStart, QString &normalColorEnd, diff --git a/core_qui/quiwidget.cpp b/core_qui/quiwidget.cpp index 023f2e4..928667d 100644 --- a/core_qui/quiwidget.cpp +++ b/core_qui/quiwidget.cpp @@ -3,7 +3,7 @@ QUIWidget::QUIWidget(QWidget *parent) : QDialog(parent) { this->initControl(); - this->initForm(); + this->initForm(); } QUIWidget::~QUIWidget() @@ -234,7 +234,7 @@ void QUIWidget::initForm() setIcon(QUIWidget::BtnMenu_Close, QUIConfig::IconClose); this->widgetTitle->setProperty("form", "title"); - QUIHelper::setFramelessForm(this); + QUIHelper::setFramelessForm(this, false, false, false); //设置标题及对齐方式 title = "QUI Demo"; @@ -249,24 +249,41 @@ void QUIWidget::initForm() this->installEventFilter(this); this->widgetTitle->installEventFilter(this); + //默认切换换肤立即换肤 + changedStyle = true; + //添加换肤菜单 QStringList styleNames, styleFiles; QUIStyle::getStyle(styleNames, styleFiles); + + //添加到动作分组中形成互斥效果 + actionGroup = new QActionGroup(this); int count = styleNames.count(); for (int i = 0; i < count; i++) { QAction *action = new QAction(this); + //设置可选中前面有个勾勾 + action->setCheckable(true); action->setText(styleNames.at(i)); action->setData(styleFiles.at(i)); connect(action, SIGNAL(triggered(bool)), this, SLOT(changeStyle())); this->btnMenu->addAction(action); + actionGroup->addAction(action); } + + //默认选择一种样式 + setQssChecked(":/qss/lightblue.css"); } void QUIWidget::changeStyle() { QAction *action = (QAction *)sender(); QString qssFile = action->data().toString(); - QUIStyle::setStyle(qssFile); + + //有些应用可能只需要发送个换肤的信号给他就行 + if (changedStyle) { + QUIStyle::setStyleFile(qssFile); + } + emit changeStyle(qssFile); } @@ -399,6 +416,22 @@ void QUIWidget::setMainWidget(QWidget *mainWidget) } } +void QUIWidget::setQssChecked(const QString &qssFile) +{ + QList actions = actionGroup->actions(); + foreach (QAction *action, actions) { + if (action->data().toString() == qssFile) { + action->setChecked(true); + break; + } + } +} + +void QUIWidget::setChangedStyle(bool changedStyle) +{ + this->changedStyle = changedStyle; +} + void QUIWidget::on_btnMenu_Min_clicked() { if (minHide) { diff --git a/core_qui/quiwidget.h b/core_qui/quiwidget.h index ce47fe8..d13d00f 100644 --- a/core_qui/quiwidget.h +++ b/core_qui/quiwidget.h @@ -42,11 +42,14 @@ private: QVBoxLayout *verticalLayout3; private: - QString title; //标题 - Qt::Alignment alignment;//标题文本对齐 - bool minHide; //最小化隐藏 - bool exitAll; //退出整个程序 - QWidget *mainWidget; //主窗体对象 + QString title; //标题 + Qt::Alignment alignment; //标题文本对齐 + bool minHide; //最小化隐藏 + bool exitAll; //退出整个程序 + QWidget *mainWidget; //主窗体对象 + + bool changedStyle; //切换换肤是否立即换肤 + QActionGroup *actionGroup; //换肤菜单动作组 public: QLabel *getLabIco() const; @@ -55,7 +58,7 @@ public: QToolButton *getBtnMenu() const; QPushButton *getBtnMenuMin() const; QPushButton *getBtnMenuMax() const; - QPushButton *getBtnMenuClose() const; + QPushButton *getBtnMenuClose() const; QString getTitle() const; Qt::Alignment getAlignment() const; @@ -66,9 +69,9 @@ public: QSize minimumSizeHint() const; private slots: - void initControl(); //初始化控件 - void initForm(); //初始化窗体 - void changeStyle(); //更换样式 + void initControl(); //初始化控件 + void initForm(); //初始化窗体 + void changeStyle(); //更换样式 private slots: void on_btnMenu_Min_clicked(); @@ -104,6 +107,11 @@ public Q_SLOTS: //设置主窗体 void setMainWidget(QWidget *mainWidget); + //设置默认选中的换肤菜单 + void setQssChecked(const QString &qssFile); + //设置切换换肤是否立即换肤 + void setChangedStyle(bool changedStyle); + Q_SIGNALS: void changeStyle(const QString &qssFile); void closing(); diff --git a/core_qui/resource/image/pe-icon-set-weather.ttf b/core_qui/resource/image/pe-icon-set-weather.ttf new file mode 100644 index 0000000..eb6f8e5 Binary files /dev/null and b/core_qui/resource/image/pe-icon-set-weather.ttf differ diff --git a/core_qui/resource/ttf.qrc b/core_qui/resource/ttf.qrc index 2ee28b1..2598e38 100644 --- a/core_qui/resource/ttf.qrc +++ b/core_qui/resource/ttf.qrc @@ -2,5 +2,6 @@ image/fontawesome-webfont.ttf image/iconfont.ttf + image/pe-icon-set-weather.ttf diff --git a/devicesizetable/devicesizetable.cpp b/devicesizetable/devicesizetable.cpp index 84ceaf6..925a513 100644 --- a/devicesizetable/devicesizetable.cpp +++ b/devicesizetable/devicesizetable.cpp @@ -7,7 +7,6 @@ #include "qfileinfo.h" #include "qdir.h" #include "qprogressbar.h" -#include "qtimer.h" #include "qdebug.h" #ifdef Q_OS_WIN @@ -53,8 +52,7 @@ DeviceSizeTable::DeviceSizeTable(QWidget *parent) : QTableWidget(parent) this->setSelectionMode(QAbstractItemView::SingleSelection); this->verticalHeader()->setVisible(true); this->horizontalHeader()->setStretchLastSection(true); - - QTimer::singleShot(0, this, SLOT(load())); + QMetaObject::invokeMethod(this, "load"); } QColor DeviceSizeTable::getBgColor() const diff --git a/savelog/frmsavelog.cpp b/savelog/frmsavelog.cpp index 7cfd2db..1467ff3 100644 --- a/savelog/frmsavelog.cpp +++ b/savelog/frmsavelog.cpp @@ -20,25 +20,107 @@ frmSaveLog::~frmSaveLog() void frmSaveLog::initForm() { + //启动定时器追加数据 + count = 0; timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(append())); - timer->setInterval(1000); + timer->setInterval(100); - SaveLog::Instance()->setPath(qApp->applicationDirPath()); + //添加消息类型 + QStringList types, datas; + types << "Debug" << "Info" << "Warning" << "Critical" << "Fatal"; + datas << "1" << "2" << "4" << "8" << "16"; + ui->cboxType->addItems(types); + + //添加消息类型到列表用于勾选设置哪些类型需要重定向 + int count = types.count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem *item = new QListWidgetItem; + item->setText(types.at(i)); + item->setData(Qt::UserRole, datas.at(i)); + item->setCheckState(Qt::Checked); + ui->listType->addItem(item); + } + + //添加日志文件大小下拉框 + ui->cboxSize->addItem("不启用", 0); + ui->cboxSize->addItem("5kb", 5); + ui->cboxSize->addItem("10kb", 10); + ui->cboxSize->addItem("30kb", 30); + ui->cboxSize->addItem("1mb", 1024); + + ui->cboxRow->addItem("不启用", 0); + ui->cboxRow->addItem("100条", 100); + ui->cboxRow->addItem("500条", 500); + ui->cboxRow->addItem("2000条", 2000); + ui->cboxRow->addItem("10000条", 10000); + + //设置是否开启日志上下文打印比如行号、函数等 + SaveLog::Instance()->setUseContext(false); + //设置文件存储目录 + SaveLog::Instance()->setPath(qApp->applicationDirPath() + "/log"); } -void frmSaveLog::append() +void frmSaveLog::append(const QString &flag) { - QString msg = QString("当前时间: %1 测试打印输出消息").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")); + if (count >= 100) { + count = 0; + ui->txtMain->clear(); + } + + QString str1; + int type = ui->cboxType->currentIndex(); + if (!ui->ckSave->isChecked()) { + if (type == 0) { + str1 = "Debug "; + } else if (type == 1) { + str1 = "Infox "; + } else if (type == 2) { + str1 = "Warnx "; + } else if (type == 3) { + str1 = "Error "; + } else if (type == 4) { + str1 = "Fatal "; + } + } + + QString str2 = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss"); + QString str3 = flag.isEmpty() ? "自动插入消息" : flag; + QString msg = QString("%1当前时间: %2 %3").arg(str1).arg(str2).arg(str3); + + //开启网络重定向换成英文方便接收解析不乱码 + //对方接收解析的工具未必是utf8 + if (ui->ckNet->isChecked()) { + msg = QString("%1time: %2 %3").arg(str1).arg(str2).arg("(QQ: 517216493 WX: feiyangqingyun)"); + } + + count++; ui->txtMain->append(msg); - qDebug() << msg; + + //根据不同的类型打印 + //TMD转换要分两部走不然msvc的debug版本会乱码(英文也一样) + //char *data = msg.toUtf8().data(); + QByteArray buffer = msg.toUtf8(); + const char *data = buffer.constData(); + if (type == 0) { + qDebug(data); + } else if (type == 1) { +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + qInfo(data); +#endif + } else if (type == 2) { + qWarning(data); + } else if (type == 3) { + qCritical(data); + } else if (type == 4) { + //调用下面这个打印完会直接退出程序 + qFatal(data); + } } -void frmSaveLog::on_btnDebug_clicked() +void frmSaveLog::on_btnLog_clicked() { - QString msg = QString("当前时间: %1 手动插入消息").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")); - ui->txtMain->append(msg); - qDebug() << msg; + append("手动插入消息"); } void frmSaveLog::on_ckTimer_stateChanged(int arg1) @@ -47,12 +129,15 @@ void frmSaveLog::on_ckTimer_stateChanged(int arg1) timer->stop(); } else { timer->start(); + on_btnLog_clicked(); } } void frmSaveLog::on_ckNet_stateChanged(int arg1) { - SaveLog::Instance()->setToNet(arg1 != 0); + SaveLog::Instance()->setListenPort(ui->txtPort->text().toInt()); + SaveLog::Instance()->setToNet(ui->ckNet->isChecked()); + on_btnLog_clicked(); } void frmSaveLog::on_ckSave_stateChanged(int arg1) @@ -61,5 +146,42 @@ void frmSaveLog::on_ckSave_stateChanged(int arg1) SaveLog::Instance()->stop(); } else { SaveLog::Instance()->start(); + on_btnLog_clicked(); } } + +void frmSaveLog::on_cboxSize_currentIndexChanged(int index) +{ + int size = ui->cboxSize->itemData(index).toInt(); + SaveLog::Instance()->setMaxSize(size); + on_btnLog_clicked(); +} + +void frmSaveLog::on_cboxRow_currentIndexChanged(int index) +{ + int row = ui->cboxRow->itemData(index).toInt(); + SaveLog::Instance()->setMaxRow(row); + on_btnLog_clicked(); +} + +void frmSaveLog::on_listType_itemPressed(QListWidgetItem *item) +{ + if (item <= 0) { + return; + } + + //切换选中行状态 + item->setCheckState(item->checkState() == Qt::Checked ? Qt::Unchecked : Qt::Checked); + + //找到所有勾选的类型进行设置 + quint8 types = 0; + int count = ui->listType->count(); + for (int i = 0; i < count; ++i) { + QListWidgetItem *item = ui->listType->item(i); + if (item->checkState() == Qt::Checked) { + types += item->data(Qt::UserRole).toInt(); + } + } + + SaveLog::Instance()->setMsgType((MsgType)types); +} diff --git a/savelog/frmsavelog.h b/savelog/frmsavelog.h index 6c5d21b..2c54e94 100644 --- a/savelog/frmsavelog.h +++ b/savelog/frmsavelog.h @@ -2,6 +2,7 @@ #define FRMSAVELOG_H #include +#include namespace Ui { class frmSaveLog; @@ -17,15 +18,22 @@ public: private: Ui::frmSaveLog *ui; + int count; QTimer *timer; private slots: void initForm(); - void append(); - void on_btnDebug_clicked(); + void append(const QString &flag = QString()); + +private slots: + void on_btnLog_clicked(); void on_ckTimer_stateChanged(int arg1); void on_ckNet_stateChanged(int arg1); - void on_ckSave_stateChanged(int arg1); + void on_ckSave_stateChanged(int arg1); + + void on_cboxSize_currentIndexChanged(int index); + void on_cboxRow_currentIndexChanged(int index); + void on_listType_itemPressed(QListWidgetItem *item); }; #endif // FRMSAVELOG_H diff --git a/savelog/frmsavelog.ui b/savelog/frmsavelog.ui index 318d243..0241ecc 100644 --- a/savelog/frmsavelog.ui +++ b/savelog/frmsavelog.ui @@ -13,60 +13,119 @@ Form - + - - - - - - 130 - 0 - - - - 手动插入消息 - - - - - - - 定时器打印消息 - - - - - - - 重定向到网络 - - - - - - - 保存日志 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 200 + 0 + + + + + 200 + 16777215 + + + + QFrame::Box + + + QFrame::Sunken + + + + + + + + + + + + + + + 0 + 0 + + + + + + + + 文件大小 + + + + + + + 文件行数 + + + + + + + 消息类型 + + + + + + + 监听端口 + + + + + + + 6000 + + + + + + + + + + + + 开启日志重定向 + + + + + + + 日志输出到网络 + + + + + + + 定时器打印消息 + + + + + + + 手动插入消息 + + + + + diff --git a/savelog/main.cpp b/savelog/main.cpp index 07c9a92..a790c02 100644 --- a/savelog/main.cpp +++ b/savelog/main.cpp @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) #endif frmSaveLog w; - w.setWindowTitle("输出日志文件"); + w.setWindowTitle("日志重定向示例 V2022 (QQ: 517216493 WX: feiyangqingyun)"); w.show(); return a.exec(); diff --git a/savelog/readme.txt b/savelog/readme.txt new file mode 100644 index 0000000..37aeeab --- /dev/null +++ b/savelog/readme.txt @@ -0,0 +1 @@ +目前发现msvc的qt debug模式的可能数据不正确,不知道debug编码做了什么处理 \ No newline at end of file diff --git a/savelog/savelog.cpp b/savelog/savelog.cpp index 3ad401a..1059074 100644 --- a/savelog/savelog.cpp +++ b/savelog/savelog.cpp @@ -1,4 +1,6 @@ -#include "savelog.h" +#pragma execution_character_set("utf-8") + +#include "savelog.h" #include "qmutex.h" #include "qdir.h" #include "qfile.h" @@ -10,6 +12,7 @@ #include "qstringlist.h" #define QDATE qPrintable(QDate::currentDate().toString("yyyy-MM-dd")) +#define QDATETIMS qPrintable(QDateTime::currentDateTime().toString("yyyy-MM-dd-HH-mm-ss")) //日志重定向 #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) @@ -24,24 +27,42 @@ void Log(QtMsgType type, const char *msg) QString content; //这里可以根据不同的类型加上不同的头部用于区分 + int msgType = SaveLog::Instance()->getMsgType(); switch (type) { case QtDebugMsg: - content = QString("%1").arg(msg); + if ((msgType & MsgType_Debug) == MsgType_Debug) { + content = QString("Debug %1").arg(msg); + } break; - +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + case QtInfoMsg: + if ((msgType & MsgType_Info) == MsgType_Info) { + content = QString("Infox %1").arg(msg); + } + break; +#endif case QtWarningMsg: - content = QString("%1").arg(msg); + if ((msgType & MsgType_Warning) == MsgType_Warning) { + content = QString("Warnx %1").arg(msg); + } break; - case QtCriticalMsg: - content = QString("%1").arg(msg); + if ((msgType & MsgType_Critical) == MsgType_Critical) { + content = QString("Error %1").arg(msg); + } break; - case QtFatalMsg: - content = QString("%1").arg(msg); + if ((msgType & MsgType_Fatal) == MsgType_Fatal) { + content = QString("Fatal %1").arg(msg); + } break; } + //没有内容则返回 + if (content.isEmpty()) { + return; + } + //加上打印代码所在代码文件、行号、函数名 #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) if (SaveLog::Instance()->getUseContext()) { @@ -54,6 +75,7 @@ void Log(QtMsgType type, const char *msg) } #endif + //还可以将数据转成html内容分颜色区分 //将内容传给函数进行处理 SaveLog::Instance()->save(content); } @@ -78,10 +100,14 @@ SaveLog::SaveLog(QObject *parent) : QObject(parent) //估计日志钩子可能单独开了线程 connect(this, SIGNAL(send(QString)), SendLog::Instance(), SLOT(send(QString))); - file = new QFile(this); + isRun = false; + maxRow = currentRow = 0; + maxSize = 128; toNet = false; useContext = true; + //全局的文件对象,在需要的时候打开而不是每次添加日志都打开 + file = new QFile(this); //默认取应用程序根目录 path = qApp->applicationDirPath(); //默认取应用程序可执行文件名称 @@ -89,6 +115,9 @@ SaveLog::SaveLog(QObject *parent) : QObject(parent) QStringList list = str.split("/"); name = list.at(list.count() - 1).split(".").at(0); fileName = ""; + + //默认所有类型都输出 + msgType = MsgType(MsgType_Debug | MsgType_Info | MsgType_Warning | MsgType_Critical | MsgType_Fatal); } SaveLog::~SaveLog() @@ -96,14 +125,40 @@ SaveLog::~SaveLog() file->close(); } +void SaveLog::openFile(const QString &fileName) +{ + //当文件名改变时才新建和打开文件而不是每次都打开文件(效率极低)或者一开始打开文件 + if (this->fileName != fileName) { + this->fileName = fileName; + //先关闭之前的 + if (file->isOpen()) { + file->close(); + } + //重新设置新的日志文件 + file->setFileName(fileName); + //以 Append 追加的形式打开 + file->open(QIODevice::WriteOnly | QIODevice::Append | QFile::Text); + } +} + bool SaveLog::getUseContext() { return this->useContext; } +MsgType SaveLog::getMsgType() +{ + return this->msgType; +} + //安装日志钩子,输出调试信息到文件,便于调试 void SaveLog::start() { + if (isRun) { + return; + } + + isRun = true; #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) qInstallMessageHandler(Log); #else @@ -114,6 +169,12 @@ void SaveLog::start() //卸载日志钩子 void SaveLog::stop() { + if (!isRun) { + return; + } + + isRun = false; + this->clear(); #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) qInstallMessageHandler(0); #else @@ -121,38 +182,97 @@ void SaveLog::stop() #endif } +void SaveLog::clear() +{ + currentRow = 0; + fileName.clear(); + if (file->isOpen()) { + file->close(); + } +} + void SaveLog::save(const QString &content) { //如果重定向输出到网络则通过网络发出去,否则输出到日志文件 if (toNet) { emit send(content); } else { - //检查目录是否存在,不存在则先新建 + //目录不存在则先新建目录 QDir dir(path); if (!dir.exists()) { dir.mkdir(path); } - //方法改进:之前每次输出日志都打开文件,改成只有当日期改变时才新建和打开文件 - QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATE); - if (this->fileName != fileName) { - this->fileName = fileName; - if (file->isOpen()) { - file->close(); + //日志存储规则有多种策略 优先级 行数>大小>日期 + //1: 设置了最大行数限制则按照行数限制来 + //2: 设置了大小则按照大小来控制日志文件 + //3: 都没有设置都存储到日期命名的文件,只有当日期变化了才会切换到新的日志文件 + bool needOpen = false; + if (maxRow > 0) { + currentRow++; + if (fileName.isEmpty()) { + needOpen = true; + } else if (currentRow >= maxRow) { + needOpen = true; } - - file->setFileName(fileName); - file->open(QIODevice::WriteOnly | QIODevice::Append | QFile::Text); + } else if (maxSize > 0) { + //1MB=1024*1024 经过大量测试 QFile().size() 方法速度非常快 + //首次需要重新打开文件以及超过大小需要重新打开文件 + if (fileName.isEmpty()) { + needOpen = true; + } else if (file->size() > (maxSize * 1024)) { + needOpen = true; + } + } else { + //日期改变了才会触发 + QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATE); + openFile(fileName); } - QTextStream logStream(file); - logStream << content << "\n"; + if ((maxRow > 0 || maxSize > 0) && needOpen) { + currentRow = 0; + QString fileName = QString("%1/%2_log_%3.txt").arg(path).arg(name).arg(QDATETIMS); + openFile(fileName); + } + + //用文本流的输出速度更快 + QTextStream stream(file); + stream.setCodec("utf-8"); + stream << content << "\n"; } } +void SaveLog::setMaxRow(int maxRow) +{ + //这里可以限定最大最小值 + if (maxRow >= 0) { + this->maxRow = maxRow; + this->clear(); + } +} + +void SaveLog::setMaxSize(int maxSize) +{ + //这里可以限定最大最小值 + if (maxSize >= 0) { + this->maxSize = maxSize; + this->clear(); + } +} + +void SaveLog::setListenPort(int listenPort) +{ + SendLog::Instance()->setListenPort(listenPort); +} + void SaveLog::setToNet(bool toNet) { this->toNet = toNet; + if (toNet) { + SendLog::Instance()->start(); + } else { + SendLog::Instance()->stop(); + } } void SaveLog::setUseContext(bool useContext) @@ -170,6 +290,11 @@ void SaveLog::setName(const QString &name) this->name = name; } +void SaveLog::setMsgType(const MsgType &msgType) +{ + this->msgType = msgType; +} + //网络发送日志数据类 QScopedPointer SendLog::self; @@ -186,18 +311,14 @@ SendLog *SendLog::Instance() return self.data(); } -SendLog::SendLog(QObject *parent) +SendLog::SendLog(QObject *parent) : QObject(parent) { + listenPort = 6000; socket = NULL; + + //实例化网络通信服务器对象 server = new QTcpServer(this); connect(server, SIGNAL(newConnection()), this, SLOT(newConnection())); - - int listenPort = 6000; -#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) - server->listen(QHostAddress::AnyIPv4, listenPort); -#else - server->listen(QHostAddress::Any, listenPort); -#endif } SendLog::~SendLog() @@ -211,15 +332,41 @@ SendLog::~SendLog() void SendLog::newConnection() { + //限定就一个连接 while (server->hasPendingConnections()) { socket = server->nextPendingConnection(); } } +void SendLog::setListenPort(int listenPort) +{ + this->listenPort = listenPort; +} + +void SendLog::start() +{ + //启动端口监听 +#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) + server->listen(QHostAddress::AnyIPv4, listenPort); +#else + server->listen(QHostAddress::Any, listenPort); +#endif +} + +void SendLog::stop() +{ + if (socket != NULL) { + socket->disconnectFromHost(); + socket = NULL; + } + + server->close(); +} + void SendLog::send(const QString &content) { if (socket != NULL && socket->isOpen()) { socket->write(content.toUtf8()); - socket->flush(); + //socket->flush(); } } diff --git a/savelog/savelog.h b/savelog/savelog.h index 4783a45..d2e8098 100644 --- a/savelog/savelog.h +++ b/savelog/savelog.h @@ -7,9 +7,14 @@ * 2. 支持日志存储的目录。 * 3. 支持网络发出打印日志。 * 4. 支持输出日志上下文信息比如所在代码文件、行号、函数名等。 - * 5. 支持Qt4+Qt5+Qt6,开箱即用。 - * 6. 自动加锁支持多线程。 - * 7. 使用做到最简单,start即可。 + * 5. 支持设置日志文件大小限制,超过则自动分文件,默认128kb。 + * 6. 支持按照日志行数自动分文件,和日志大小条件互斥。 + * 7. 可选按照日期时间区分文件名存储日志。 + * 8. 日志文件命名规则优先级:行数》大小》日期。 + * 9. 自动加锁支持多线程。 + * 10. 可以分别控制哪些类型的日志需要重定向输出。 + * 11. 支持Qt4+Qt5+Qt6,开箱即用。 + * 12. 使用方式最简单,调用函数start()启动服务,stop()停止服务。 */ #include @@ -18,6 +23,15 @@ class QFile; class QTcpSocket; class QTcpServer; +//消息类型 +enum MsgType { + MsgType_Debug = 0x0001, + MsgType_Info = 0x0002, + MsgType_Warning = 0x0004, + MsgType_Critical = 0x0008, + MsgType_Fatal = 0x0010, +}; + #ifdef quc class Q_DECL_EXPORT SaveLog : public QObject #else @@ -34,21 +48,34 @@ public: private: static QScopedPointer self; - //文件对象 - QFile *file; + //是否在运行 + bool isRun; + //文件最大行数 0表示不启用 + int maxRow, currentRow; + //文件最大大小 0表示不启用 单位kb + int maxSize; //是否重定向到网络 bool toNet; //是否输出日志上下文 bool useContext; + + //文件对象 + QFile *file; //日志文件路径 QString path; //日志文件名称 QString name; //日志文件完整名称 QString fileName; + //消息类型 + MsgType msgType; + +private: + void openFile(const QString &fileName); public: bool getUseContext(); + MsgType getMsgType(); Q_SIGNALS: //发送内容信号 @@ -59,20 +86,38 @@ public Q_SLOTS: void start(); //暂停日志服务 void stop(); + + //清空状态 + void clear(); //保存日志 void save(const QString &content); + //设置日志文件最大行数 + void setMaxRow(int maxRow); + //设置日志文件最大大小 单位kb + void setMaxSize(int maxSize); + + //设置监听端口 + void setListenPort(int listenPort); //设置是否重定向到网络 void setToNet(bool toNet); //设置是否输出日志上下文 void setUseContext(bool useContext); + //设置日志文件存放路径 void setPath(const QString &path); //设置日志文件名称 void setName(const QString &name); + //设置消息类型 + void setMsgType(const MsgType &msgType); }; +#ifdef quc +class Q_DECL_EXPORT SendLog : public QObject +#else class SendLog : public QObject +#endif + { Q_OBJECT public: @@ -83,6 +128,8 @@ public: private: static QScopedPointer self; + //监听端口 + int listenPort; //网络通信对象 QTcpSocket *socket; //网络监听服务器 @@ -93,6 +140,13 @@ private slots: void newConnection(); public Q_SLOTS: + //设置监听端口 + void setListenPort(int listenPort); + + //启动和停止服务 + void start(); + void stop(); + //发送日志 void send(const QString &content); }; diff --git a/saveruntime/frmsaveruntime.cpp b/saveruntime/frmsaveruntime.cpp index 0102adb..ce5994c 100644 --- a/saveruntime/frmsaveruntime.cpp +++ b/saveruntime/frmsaveruntime.cpp @@ -4,10 +4,13 @@ #include "ui_frmsaveruntime.h" #include "qfile.h" #include "saveruntime.h" +#include "qdebug.h" frmSaveRunTime::frmSaveRunTime(QWidget *parent) : QWidget(parent), ui(new Ui::frmSaveRunTime) { - ui->setupUi(this); + ui->setupUi(this); + //设置文件存储目录 + SaveRunTime::Instance()->setPath(qApp->applicationDirPath() + "/log"); } frmSaveRunTime::~frmSaveRunTime() @@ -40,7 +43,12 @@ void frmSaveRunTime::on_btnUpdate_clicked() void frmSaveRunTime::on_btnOpen_clicked() { - QString fileName = QString("%1/examples_runtime_%2.txt").arg(qApp->applicationDirPath()).arg(QDate::currentDate().year()); + QString path = qApp->applicationDirPath(); + QString name = qApp->applicationFilePath(); + QStringList list = name.split("/"); + name = list.at(list.count() - 1).split(".").at(0); + + QString fileName = QString("%1/log/%2_runtime_%3.txt").arg(path).arg(name).arg(QDate::currentDate().year()); QFile file(fileName); if (file.open(QFile::ReadOnly | QFile::Text)) { ui->txtMain->setText(file.readAll()); diff --git a/saveruntime/frmsaveruntime.ui b/saveruntime/frmsaveruntime.ui index 50d8173..72d3903 100644 --- a/saveruntime/frmsaveruntime.ui +++ b/saveruntime/frmsaveruntime.ui @@ -13,72 +13,92 @@ Form - + - - - - - 启动服务 - - - - - - - - 130 - 0 - - - - 插入一条记录 - - - - - - - - 130 - 0 - - - - 更新一条记录 - - - - - - - - 130 - 0 - - - - 打开记录文件 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 200 + 0 + + + + + 200 + 16777215 + + + + QFrame::Box + + + QFrame::Sunken + + + + + + 启动运行时间记录 + + + + + + + + 130 + 0 + + + + 插入一条记录 + + + + + + + + 130 + 0 + + + + 更新一条记录 + + + + + + + + 130 + 0 + + + + 打开记录文件 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + diff --git a/saveruntime/main.cpp b/saveruntime/main.cpp index b8cee62..f18e4b4 100644 --- a/saveruntime/main.cpp +++ b/saveruntime/main.cpp @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) #endif frmSaveRunTime w; - w.setWindowTitle("保存运行时间"); + w.setWindowTitle("运行时间记录示例 V2022 (QQ: 517216493 WX: feiyangqingyun)"); w.show(); return a.exec(); diff --git a/saveruntime/saveruntime.cpp b/saveruntime/saveruntime.cpp index 742d1cb..0411fe5 100644 --- a/saveruntime/saveruntime.cpp +++ b/saveruntime/saveruntime.cpp @@ -1,4 +1,6 @@ -#include "saveruntime.h" +#pragma execution_character_set("utf-8") + +#include "saveruntime.h" #include "qmutex.h" #include "qdir.h" #include "qfile.h" @@ -7,12 +9,6 @@ #include "qtextstream.h" #include "qstringlist.h" -#ifdef Q_OS_WIN -#define NEWLINE "\r\n" -#else -#define NEWLINE "\n" -#endif - QScopedPointer SaveRunTime::self; SaveRunTime *SaveRunTime::Instance() { @@ -72,6 +68,10 @@ void SaveRunTime::getDiffValue(const QDateTime &startTime, const QDateTime &endT void SaveRunTime::start() { + if (timerSave->isActive()) { + return; + } + //开始时间变量必须在这,在部分嵌入式系统上开机后的时间不准确比如是1970,而后会变成1999或者其他时间 //会在getDiffValue函数执行很久很久 startTime = QDateTime::currentDateTime(); @@ -84,6 +84,10 @@ void SaveRunTime::start() void SaveRunTime::stop() { + if (!timerSave->isActive()) { + return; + } + timerSave->stop(); } @@ -116,7 +120,7 @@ void SaveRunTime::initLog() QString line = strID + strStartTime + strEndTime + strRunTime; QTextStream stream(&file); - stream << line << NEWLINE; + stream << line << "\n"; file.close(); lastID = 0; } @@ -154,7 +158,7 @@ void SaveRunTime::appendLog() QString line = strID + strStartTime + strEndTime + strRunTime; QTextStream stream(&file); - stream << line << NEWLINE; + stream << line << "\n"; file.close(); } } @@ -205,7 +209,7 @@ void SaveRunTime::saveLog() content[content.count() - 1] = lastLine; QTextStream stream(&file); - stream << content.join("") << NEWLINE; + stream << content.join("") << "\n"; file.close(); } } diff --git a/styledemo/frmmain.cpp b/styledemo/frmmain.cpp index 6994e95..b6511b1 100644 --- a/styledemo/frmmain.cpp +++ b/styledemo/frmmain.cpp @@ -152,9 +152,9 @@ void frmMain::initStyle() { //加载样式表 QString qss; - QFile file(":/qss/psblack.css"); + //QFile file(":/qss/psblack.css"); //QFile file(":/qss/flatwhite.css"); - //QFile file(":/qss/lightblue.css"); + QFile file(":/qss/lightblue.css"); if (file.open(QFile::ReadOnly)) { #if 1 //用QTextStream读取样式文件不用区分文件编码 带bom也行 diff --git a/styledemo/frmmain.ui b/styledemo/frmmain.ui index b9aaf4c..efa1696 100644 --- a/styledemo/frmmain.ui +++ b/styledemo/frmmain.ui @@ -396,6 +396,9 @@ + + QFrame::NoFrame + 5 diff --git a/styledemo/main.cpp b/styledemo/main.cpp index 95d5c7f..2d612dd 100644 --- a/styledemo/main.cpp +++ b/styledemo/main.cpp @@ -3,6 +3,8 @@ int main(int argc, char *argv[]) { + //设置不应用操作系统设置比如字体 + QApplication::setDesktopSettingsAware(false); #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0)) QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor); #endif diff --git a/styledemo/other/qss/flatwhite.css b/styledemo/other/qss/flatwhite.css index de1dbb2..77e0bb7 100644 --- a/styledemo/other/qss/flatwhite.css +++ b/styledemo/other/qss/flatwhite.css @@ -643,15 +643,23 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -QDialog { +QDialog,QDial{ background-color:#FFFFFF; color:#57595B; } -QDialogButtonBox > QPushButton { +QDialogButtonBox>QPushButton{ min-width:50px; } +QListView[noboder="true"],QTreeView[noboder="true"],QTabWidget[noboder="true"]::pane{ +border-width:0px; +} + +QToolBar>*,QStatusBar>*{ +margin:2px; +} + *:disabled,QMenu::item:disabled{ background:#FFFFFF; border-color:#E4E4E4; diff --git a/styledemo/other/qss/flatwhite/add_bottom.png b/styledemo/other/qss/flatwhite/add_bottom.png index ebcfa15..868e687 100644 Binary files a/styledemo/other/qss/flatwhite/add_bottom.png and b/styledemo/other/qss/flatwhite/add_bottom.png differ diff --git a/styledemo/other/qss/flatwhite/add_left.png b/styledemo/other/qss/flatwhite/add_left.png index 9f519b3..d9d5127 100644 Binary files a/styledemo/other/qss/flatwhite/add_left.png and b/styledemo/other/qss/flatwhite/add_left.png differ diff --git a/styledemo/other/qss/flatwhite/add_right.png b/styledemo/other/qss/flatwhite/add_right.png index 645c18f..be8dd1a 100644 Binary files a/styledemo/other/qss/flatwhite/add_right.png and b/styledemo/other/qss/flatwhite/add_right.png differ diff --git a/styledemo/other/qss/flatwhite/add_top.png b/styledemo/other/qss/flatwhite/add_top.png index 4bd3d27..ef55ce1 100644 Binary files a/styledemo/other/qss/flatwhite/add_top.png and b/styledemo/other/qss/flatwhite/add_top.png differ diff --git a/styledemo/other/qss/flatwhite/arrow_bottom.png b/styledemo/other/qss/flatwhite/arrow_bottom.png index 63e5880..37307b7 100644 Binary files a/styledemo/other/qss/flatwhite/arrow_bottom.png and b/styledemo/other/qss/flatwhite/arrow_bottom.png differ diff --git a/styledemo/other/qss/flatwhite/arrow_left.png b/styledemo/other/qss/flatwhite/arrow_left.png index 73f0428..aa4312b 100644 Binary files a/styledemo/other/qss/flatwhite/arrow_left.png and b/styledemo/other/qss/flatwhite/arrow_left.png differ diff --git a/styledemo/other/qss/flatwhite/arrow_right.png b/styledemo/other/qss/flatwhite/arrow_right.png index 2a67efa..4db5efa 100644 Binary files a/styledemo/other/qss/flatwhite/arrow_right.png and b/styledemo/other/qss/flatwhite/arrow_right.png differ diff --git a/styledemo/other/qss/flatwhite/arrow_top.png b/styledemo/other/qss/flatwhite/arrow_top.png index 4ab5718..0da1cad 100644 Binary files a/styledemo/other/qss/flatwhite/arrow_top.png and b/styledemo/other/qss/flatwhite/arrow_top.png differ diff --git a/styledemo/other/qss/flatwhite/branch_close.png b/styledemo/other/qss/flatwhite/branch_close.png index 400e90c..f5b6d34 100644 Binary files a/styledemo/other/qss/flatwhite/branch_close.png and b/styledemo/other/qss/flatwhite/branch_close.png differ diff --git a/styledemo/other/qss/flatwhite/branch_open.png b/styledemo/other/qss/flatwhite/branch_open.png index cba5dba..6392c13 100644 Binary files a/styledemo/other/qss/flatwhite/branch_open.png and b/styledemo/other/qss/flatwhite/branch_open.png differ diff --git a/styledemo/other/qss/flatwhite/calendar_nextmonth.png b/styledemo/other/qss/flatwhite/calendar_nextmonth.png index 32f5f25..6cb40d7 100644 Binary files a/styledemo/other/qss/flatwhite/calendar_nextmonth.png and b/styledemo/other/qss/flatwhite/calendar_nextmonth.png differ diff --git a/styledemo/other/qss/flatwhite/calendar_prevmonth.png b/styledemo/other/qss/flatwhite/calendar_prevmonth.png index 5296f24..8a17d0f 100644 Binary files a/styledemo/other/qss/flatwhite/calendar_prevmonth.png and b/styledemo/other/qss/flatwhite/calendar_prevmonth.png differ diff --git a/styledemo/other/qss/flatwhite/checkbox_checked.png b/styledemo/other/qss/flatwhite/checkbox_checked.png index f1d2d62..8808382 100644 Binary files a/styledemo/other/qss/flatwhite/checkbox_checked.png and b/styledemo/other/qss/flatwhite/checkbox_checked.png differ diff --git a/styledemo/other/qss/flatwhite/checkbox_checked_disable.png b/styledemo/other/qss/flatwhite/checkbox_checked_disable.png index a917ca8..9aa0a10 100644 Binary files a/styledemo/other/qss/flatwhite/checkbox_checked_disable.png and b/styledemo/other/qss/flatwhite/checkbox_checked_disable.png differ diff --git a/styledemo/other/qss/flatwhite/checkbox_parcial.png b/styledemo/other/qss/flatwhite/checkbox_parcial.png index 3c8aeb9..97376f3 100644 Binary files a/styledemo/other/qss/flatwhite/checkbox_parcial.png and b/styledemo/other/qss/flatwhite/checkbox_parcial.png differ diff --git a/styledemo/other/qss/flatwhite/checkbox_parcial_disable.png b/styledemo/other/qss/flatwhite/checkbox_parcial_disable.png index 3902dd3..b9b286f 100644 Binary files a/styledemo/other/qss/flatwhite/checkbox_parcial_disable.png and b/styledemo/other/qss/flatwhite/checkbox_parcial_disable.png differ diff --git a/styledemo/other/qss/flatwhite/checkbox_unchecked.png b/styledemo/other/qss/flatwhite/checkbox_unchecked.png index af96d6d..50c25e2 100644 Binary files a/styledemo/other/qss/flatwhite/checkbox_unchecked.png and b/styledemo/other/qss/flatwhite/checkbox_unchecked.png differ diff --git a/styledemo/other/qss/flatwhite/checkbox_unchecked_disable.png b/styledemo/other/qss/flatwhite/checkbox_unchecked_disable.png index f4b2a4e..7c4c7db 100644 Binary files a/styledemo/other/qss/flatwhite/checkbox_unchecked_disable.png and b/styledemo/other/qss/flatwhite/checkbox_unchecked_disable.png differ diff --git a/styledemo/other/qss/flatwhite/menu_checked.png b/styledemo/other/qss/flatwhite/menu_checked.png index 1f13ca3..6a1c729 100644 Binary files a/styledemo/other/qss/flatwhite/menu_checked.png and b/styledemo/other/qss/flatwhite/menu_checked.png differ diff --git a/styledemo/other/qss/flatwhite/radiobutton_checked.png b/styledemo/other/qss/flatwhite/radiobutton_checked.png index 8a8b310..513a41e 100644 Binary files a/styledemo/other/qss/flatwhite/radiobutton_checked.png and b/styledemo/other/qss/flatwhite/radiobutton_checked.png differ diff --git a/styledemo/other/qss/flatwhite/radiobutton_checked_disable.png b/styledemo/other/qss/flatwhite/radiobutton_checked_disable.png index bc50241..8d16af5 100644 Binary files a/styledemo/other/qss/flatwhite/radiobutton_checked_disable.png and b/styledemo/other/qss/flatwhite/radiobutton_checked_disable.png differ diff --git a/styledemo/other/qss/flatwhite/radiobutton_unchecked.png b/styledemo/other/qss/flatwhite/radiobutton_unchecked.png index 03704f7..8ef34fb 100644 Binary files a/styledemo/other/qss/flatwhite/radiobutton_unchecked.png and b/styledemo/other/qss/flatwhite/radiobutton_unchecked.png differ diff --git a/styledemo/other/qss/flatwhite/radiobutton_unchecked_disable.png b/styledemo/other/qss/flatwhite/radiobutton_unchecked_disable.png index 1e3171d..f70c364 100644 Binary files a/styledemo/other/qss/flatwhite/radiobutton_unchecked_disable.png and b/styledemo/other/qss/flatwhite/radiobutton_unchecked_disable.png differ diff --git a/styledemo/other/qss/lightblue.css b/styledemo/other/qss/lightblue.css index c587e83..277a1b9 100644 --- a/styledemo/other/qss/lightblue.css +++ b/styledemo/other/qss/lightblue.css @@ -643,15 +643,23 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -QDialog { +QDialog,QDial{ background-color:#EAF7FF; color:#386487; } -QDialogButtonBox > QPushButton { +QDialogButtonBox>QPushButton{ min-width:50px; } +QListView[noboder="true"],QTreeView[noboder="true"],QTabWidget[noboder="true"]::pane{ +border-width:0px; +} + +QToolBar>*,QStatusBar>*{ +margin:2px; +} + *:disabled,QMenu::item:disabled{ background:#EAF7FF; border-color:#DEF0FE; diff --git a/styledemo/other/qss/lightblue/add_bottom.png b/styledemo/other/qss/lightblue/add_bottom.png index 7541eee..99eadb9 100644 Binary files a/styledemo/other/qss/lightblue/add_bottom.png and b/styledemo/other/qss/lightblue/add_bottom.png differ diff --git a/styledemo/other/qss/lightblue/add_left.png b/styledemo/other/qss/lightblue/add_left.png index 3bbc9d0..a7329d3 100644 Binary files a/styledemo/other/qss/lightblue/add_left.png and b/styledemo/other/qss/lightblue/add_left.png differ diff --git a/styledemo/other/qss/lightblue/add_right.png b/styledemo/other/qss/lightblue/add_right.png index 7a080f7..0c0ef6f 100644 Binary files a/styledemo/other/qss/lightblue/add_right.png and b/styledemo/other/qss/lightblue/add_right.png differ diff --git a/styledemo/other/qss/lightblue/add_top.png b/styledemo/other/qss/lightblue/add_top.png index 8efd30b..911f5b4 100644 Binary files a/styledemo/other/qss/lightblue/add_top.png and b/styledemo/other/qss/lightblue/add_top.png differ diff --git a/styledemo/other/qss/lightblue/arrow_bottom.png b/styledemo/other/qss/lightblue/arrow_bottom.png index 605d87e..6dc9f23 100644 Binary files a/styledemo/other/qss/lightblue/arrow_bottom.png and b/styledemo/other/qss/lightblue/arrow_bottom.png differ diff --git a/styledemo/other/qss/lightblue/arrow_left.png b/styledemo/other/qss/lightblue/arrow_left.png index f3a067a..87171e9 100644 Binary files a/styledemo/other/qss/lightblue/arrow_left.png and b/styledemo/other/qss/lightblue/arrow_left.png differ diff --git a/styledemo/other/qss/lightblue/arrow_right.png b/styledemo/other/qss/lightblue/arrow_right.png index dee3128..604def6 100644 Binary files a/styledemo/other/qss/lightblue/arrow_right.png and b/styledemo/other/qss/lightblue/arrow_right.png differ diff --git a/styledemo/other/qss/lightblue/arrow_top.png b/styledemo/other/qss/lightblue/arrow_top.png index b9180e0..3c02231 100644 Binary files a/styledemo/other/qss/lightblue/arrow_top.png and b/styledemo/other/qss/lightblue/arrow_top.png differ diff --git a/styledemo/other/qss/lightblue/branch_close.png b/styledemo/other/qss/lightblue/branch_close.png index 0e9309f..73492b3 100644 Binary files a/styledemo/other/qss/lightblue/branch_close.png and b/styledemo/other/qss/lightblue/branch_close.png differ diff --git a/styledemo/other/qss/lightblue/branch_open.png b/styledemo/other/qss/lightblue/branch_open.png index 6d45cce..9abd65c 100644 Binary files a/styledemo/other/qss/lightblue/branch_open.png and b/styledemo/other/qss/lightblue/branch_open.png differ diff --git a/styledemo/other/qss/lightblue/calendar_nextmonth.png b/styledemo/other/qss/lightblue/calendar_nextmonth.png index bbcffd9..36a453b 100644 Binary files a/styledemo/other/qss/lightblue/calendar_nextmonth.png and b/styledemo/other/qss/lightblue/calendar_nextmonth.png differ diff --git a/styledemo/other/qss/lightblue/calendar_prevmonth.png b/styledemo/other/qss/lightblue/calendar_prevmonth.png index bd4b078..cce673f 100644 Binary files a/styledemo/other/qss/lightblue/calendar_prevmonth.png and b/styledemo/other/qss/lightblue/calendar_prevmonth.png differ diff --git a/styledemo/other/qss/lightblue/checkbox_checked.png b/styledemo/other/qss/lightblue/checkbox_checked.png index 75e6cd5..524d243 100644 Binary files a/styledemo/other/qss/lightblue/checkbox_checked.png and b/styledemo/other/qss/lightblue/checkbox_checked.png differ diff --git a/styledemo/other/qss/lightblue/checkbox_checked_disable.png b/styledemo/other/qss/lightblue/checkbox_checked_disable.png index 9fe98b7..de9ece8 100644 Binary files a/styledemo/other/qss/lightblue/checkbox_checked_disable.png and b/styledemo/other/qss/lightblue/checkbox_checked_disable.png differ diff --git a/styledemo/other/qss/lightblue/checkbox_parcial.png b/styledemo/other/qss/lightblue/checkbox_parcial.png index 1acab4d..1990ead 100644 Binary files a/styledemo/other/qss/lightblue/checkbox_parcial.png and b/styledemo/other/qss/lightblue/checkbox_parcial.png differ diff --git a/styledemo/other/qss/lightblue/checkbox_parcial_disable.png b/styledemo/other/qss/lightblue/checkbox_parcial_disable.png index 226c915..cdd3779 100644 Binary files a/styledemo/other/qss/lightblue/checkbox_parcial_disable.png and b/styledemo/other/qss/lightblue/checkbox_parcial_disable.png differ diff --git a/styledemo/other/qss/lightblue/checkbox_unchecked.png b/styledemo/other/qss/lightblue/checkbox_unchecked.png index 71a0063..0f766a4 100644 Binary files a/styledemo/other/qss/lightblue/checkbox_unchecked.png and b/styledemo/other/qss/lightblue/checkbox_unchecked.png differ diff --git a/styledemo/other/qss/lightblue/checkbox_unchecked_disable.png b/styledemo/other/qss/lightblue/checkbox_unchecked_disable.png index 07c314a..25c0cdf 100644 Binary files a/styledemo/other/qss/lightblue/checkbox_unchecked_disable.png and b/styledemo/other/qss/lightblue/checkbox_unchecked_disable.png differ diff --git a/styledemo/other/qss/lightblue/menu_checked.png b/styledemo/other/qss/lightblue/menu_checked.png index 7933a0a..bb52701 100644 Binary files a/styledemo/other/qss/lightblue/menu_checked.png and b/styledemo/other/qss/lightblue/menu_checked.png differ diff --git a/styledemo/other/qss/lightblue/radiobutton_checked.png b/styledemo/other/qss/lightblue/radiobutton_checked.png index 9fb8b10..cd6561d 100644 Binary files a/styledemo/other/qss/lightblue/radiobutton_checked.png and b/styledemo/other/qss/lightblue/radiobutton_checked.png differ diff --git a/styledemo/other/qss/lightblue/radiobutton_checked_disable.png b/styledemo/other/qss/lightblue/radiobutton_checked_disable.png index b5b34bb..27a6896 100644 Binary files a/styledemo/other/qss/lightblue/radiobutton_checked_disable.png and b/styledemo/other/qss/lightblue/radiobutton_checked_disable.png differ diff --git a/styledemo/other/qss/lightblue/radiobutton_unchecked.png b/styledemo/other/qss/lightblue/radiobutton_unchecked.png index 39e918f..8f0b4fc 100644 Binary files a/styledemo/other/qss/lightblue/radiobutton_unchecked.png and b/styledemo/other/qss/lightblue/radiobutton_unchecked.png differ diff --git a/styledemo/other/qss/lightblue/radiobutton_unchecked_disable.png b/styledemo/other/qss/lightblue/radiobutton_unchecked_disable.png index 0b186d4..57c0eb3 100644 Binary files a/styledemo/other/qss/lightblue/radiobutton_unchecked_disable.png and b/styledemo/other/qss/lightblue/radiobutton_unchecked_disable.png differ diff --git a/styledemo/other/qss/psblack.css b/styledemo/other/qss/psblack.css index ed38d66..ab00050 100644 --- a/styledemo/other/qss/psblack.css +++ b/styledemo/other/qss/psblack.css @@ -643,15 +643,23 @@ QTabWidget::pane:bottom{bottom:-1px;} QTabWidget::pane:left{right:-1px;} QTabWidget::pane:right{left:-1px;} -QDialog { +QDialog,QDial{ background-color:#444444; color:#DCDCDC; } -QDialogButtonBox > QPushButton { +QDialogButtonBox>QPushButton{ min-width:50px; } +QListView[noboder="true"],QTreeView[noboder="true"],QTabWidget[noboder="true"]::pane{ +border-width:0px; +} + +QToolBar>*,QStatusBar>*{ +margin:2px; +} + *:disabled,QMenu::item:disabled{ background:#444444; border-color:#484848; diff --git a/styledemo/other/qss/psblack/add_bottom.png b/styledemo/other/qss/psblack/add_bottom.png index b383f0b..b4a5f14 100644 Binary files a/styledemo/other/qss/psblack/add_bottom.png and b/styledemo/other/qss/psblack/add_bottom.png differ diff --git a/styledemo/other/qss/psblack/add_left.png b/styledemo/other/qss/psblack/add_left.png index 8aa7c81..165ebd0 100644 Binary files a/styledemo/other/qss/psblack/add_left.png and b/styledemo/other/qss/psblack/add_left.png differ diff --git a/styledemo/other/qss/psblack/add_right.png b/styledemo/other/qss/psblack/add_right.png index fb8f3e1..4c79925 100644 Binary files a/styledemo/other/qss/psblack/add_right.png and b/styledemo/other/qss/psblack/add_right.png differ diff --git a/styledemo/other/qss/psblack/add_top.png b/styledemo/other/qss/psblack/add_top.png index 5bfc8af..f76300f 100644 Binary files a/styledemo/other/qss/psblack/add_top.png and b/styledemo/other/qss/psblack/add_top.png differ diff --git a/styledemo/other/qss/psblack/arrow_bottom.png b/styledemo/other/qss/psblack/arrow_bottom.png index 23e869f..39d7cbc 100644 Binary files a/styledemo/other/qss/psblack/arrow_bottom.png and b/styledemo/other/qss/psblack/arrow_bottom.png differ diff --git a/styledemo/other/qss/psblack/arrow_left.png b/styledemo/other/qss/psblack/arrow_left.png index cf29485..1353cb8 100644 Binary files a/styledemo/other/qss/psblack/arrow_left.png and b/styledemo/other/qss/psblack/arrow_left.png differ diff --git a/styledemo/other/qss/psblack/arrow_right.png b/styledemo/other/qss/psblack/arrow_right.png index 085a699..0e50d47 100644 Binary files a/styledemo/other/qss/psblack/arrow_right.png and b/styledemo/other/qss/psblack/arrow_right.png differ diff --git a/styledemo/other/qss/psblack/arrow_top.png b/styledemo/other/qss/psblack/arrow_top.png index b1cb37c..d2c71e8 100644 Binary files a/styledemo/other/qss/psblack/arrow_top.png and b/styledemo/other/qss/psblack/arrow_top.png differ diff --git a/styledemo/other/qss/psblack/branch_close.png b/styledemo/other/qss/psblack/branch_close.png index ae702db..58a7d13 100644 Binary files a/styledemo/other/qss/psblack/branch_close.png and b/styledemo/other/qss/psblack/branch_close.png differ diff --git a/styledemo/other/qss/psblack/branch_open.png b/styledemo/other/qss/psblack/branch_open.png index 6803a8c..a072d68 100644 Binary files a/styledemo/other/qss/psblack/branch_open.png and b/styledemo/other/qss/psblack/branch_open.png differ diff --git a/styledemo/other/qss/psblack/calendar_nextmonth.png b/styledemo/other/qss/psblack/calendar_nextmonth.png index b0f1919..b06ae31 100644 Binary files a/styledemo/other/qss/psblack/calendar_nextmonth.png and b/styledemo/other/qss/psblack/calendar_nextmonth.png differ diff --git a/styledemo/other/qss/psblack/calendar_prevmonth.png b/styledemo/other/qss/psblack/calendar_prevmonth.png index 8fa0445..46d4d62 100644 Binary files a/styledemo/other/qss/psblack/calendar_prevmonth.png and b/styledemo/other/qss/psblack/calendar_prevmonth.png differ diff --git a/styledemo/other/qss/psblack/checkbox_checked.png b/styledemo/other/qss/psblack/checkbox_checked.png index ef99835..b5ba6ef 100644 Binary files a/styledemo/other/qss/psblack/checkbox_checked.png and b/styledemo/other/qss/psblack/checkbox_checked.png differ diff --git a/styledemo/other/qss/psblack/checkbox_checked_disable.png b/styledemo/other/qss/psblack/checkbox_checked_disable.png index a6d713d..f6aab40 100644 Binary files a/styledemo/other/qss/psblack/checkbox_checked_disable.png and b/styledemo/other/qss/psblack/checkbox_checked_disable.png differ diff --git a/styledemo/other/qss/psblack/checkbox_parcial.png b/styledemo/other/qss/psblack/checkbox_parcial.png index 1f1c028..cd1645f 100644 Binary files a/styledemo/other/qss/psblack/checkbox_parcial.png and b/styledemo/other/qss/psblack/checkbox_parcial.png differ diff --git a/styledemo/other/qss/psblack/checkbox_parcial_disable.png b/styledemo/other/qss/psblack/checkbox_parcial_disable.png index 70e4889..dd0918f 100644 Binary files a/styledemo/other/qss/psblack/checkbox_parcial_disable.png and b/styledemo/other/qss/psblack/checkbox_parcial_disable.png differ diff --git a/styledemo/other/qss/psblack/checkbox_unchecked.png b/styledemo/other/qss/psblack/checkbox_unchecked.png index 7013aa3..8a23968 100644 Binary files a/styledemo/other/qss/psblack/checkbox_unchecked.png and b/styledemo/other/qss/psblack/checkbox_unchecked.png differ diff --git a/styledemo/other/qss/psblack/checkbox_unchecked_disable.png b/styledemo/other/qss/psblack/checkbox_unchecked_disable.png index 14b4634..e2a2262 100644 Binary files a/styledemo/other/qss/psblack/checkbox_unchecked_disable.png and b/styledemo/other/qss/psblack/checkbox_unchecked_disable.png differ diff --git a/styledemo/other/qss/psblack/menu_checked.png b/styledemo/other/qss/psblack/menu_checked.png index 9d9c5c2..4fca11f 100644 Binary files a/styledemo/other/qss/psblack/menu_checked.png and b/styledemo/other/qss/psblack/menu_checked.png differ diff --git a/styledemo/other/qss/psblack/radiobutton_checked.png b/styledemo/other/qss/psblack/radiobutton_checked.png index 90a9d54..69e499f 100644 Binary files a/styledemo/other/qss/psblack/radiobutton_checked.png and b/styledemo/other/qss/psblack/radiobutton_checked.png differ diff --git a/styledemo/other/qss/psblack/radiobutton_checked_disable.png b/styledemo/other/qss/psblack/radiobutton_checked_disable.png index df3bc38..f098cc5 100644 Binary files a/styledemo/other/qss/psblack/radiobutton_checked_disable.png and b/styledemo/other/qss/psblack/radiobutton_checked_disable.png differ diff --git a/styledemo/other/qss/psblack/radiobutton_unchecked.png b/styledemo/other/qss/psblack/radiobutton_unchecked.png index 8ed26fd..3f36472 100644 Binary files a/styledemo/other/qss/psblack/radiobutton_unchecked.png and b/styledemo/other/qss/psblack/radiobutton_unchecked.png differ diff --git a/styledemo/other/qss/psblack/radiobutton_unchecked_disable.png b/styledemo/other/qss/psblack/radiobutton_unchecked_disable.png index abc6176..f729f17 100644 Binary files a/styledemo/other/qss/psblack/radiobutton_unchecked_disable.png and b/styledemo/other/qss/psblack/radiobutton_unchecked_disable.png differ