重新改进支持Qt4.6-Qt6.1
This commit is contained in:
@@ -15,7 +15,7 @@ IconFont *IconFont::Instance()
|
||||
}
|
||||
|
||||
IconFont::IconFont(QObject *parent) : QObject(parent)
|
||||
{
|
||||
{
|
||||
//判断图形字体是否存在,不存在则加入
|
||||
QFontDatabase fontDb;
|
||||
if (!fontDb.families().contains("iconfont")) {
|
||||
@@ -34,21 +34,21 @@ IconFont::IconFont(QObject *parent) : QObject(parent)
|
||||
}
|
||||
}
|
||||
|
||||
void IconFont::setIcon(QLabel *lab, const QChar &icon, quint32 size)
|
||||
void IconFont::setIcon(QLabel *lab, int icon, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
lab->setFont(iconFont);
|
||||
lab->setText(icon);
|
||||
lab->setText((QChar)icon);
|
||||
}
|
||||
|
||||
void IconFont::setIcon(QAbstractButton *btn, const QChar &icon, quint32 size)
|
||||
void IconFont::setIcon(QAbstractButton *btn, int icon, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
btn->setFont(iconFont);
|
||||
btn->setText(icon);
|
||||
btn->setText((QChar)icon);
|
||||
}
|
||||
|
||||
QPixmap IconFont::getPixmap(const QColor &color, const QChar &icon, quint32 size,
|
||||
QPixmap IconFont::getPixmap(const QColor &color, int icon, quint32 size,
|
||||
quint32 pixWidth, quint32 pixHeight, int flags)
|
||||
{
|
||||
QPixmap pix(pixWidth, pixHeight);
|
||||
@@ -61,7 +61,7 @@ QPixmap IconFont::getPixmap(const QColor &color, const QChar &icon, quint32 size
|
||||
|
||||
iconFont.setPixelSize(size);
|
||||
painter.setFont(iconFont);
|
||||
painter.drawText(pix.rect(), flags, icon);
|
||||
painter.drawText(pix.rect(), flags, (QChar)icon);
|
||||
painter.end();
|
||||
|
||||
return pix;
|
||||
@@ -90,16 +90,16 @@ void IconFont::setStyle(QWidget *widget, const QString &type, int borderWidth, c
|
||||
QString strBorder;
|
||||
if (type == "top") {
|
||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding:%1px %2px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "right") {
|
||||
strBorder = QString("border-width:0px %1px 0px 0px;padding:%2px %1px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "bottom") {
|
||||
strBorder = QString("border-width:0px 0px %1px 0px;padding:%2px %2px %1px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "left") {
|
||||
strBorder = QString("border-width:0px 0px 0px %1px;padding:%2px %2px %2px %1px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
}
|
||||
|
||||
QStringList qss;
|
||||
@@ -115,7 +115,7 @@ void IconFont::setStyle(QWidget *widget, const QString &type, int borderWidth, c
|
||||
widget->setStyleSheet(qss.join(""));
|
||||
}
|
||||
|
||||
void IconFont::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void IconFont::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &type, int borderWidth, const QString &borderColor,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
@@ -130,16 +130,16 @@ void IconFont::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar>
|
||||
QString strBorder;
|
||||
if (type == "top") {
|
||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding:%1px %2px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "right") {
|
||||
strBorder = QString("border-width:0px %1px 0px 0px;padding:%2px %1px %2px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "bottom") {
|
||||
strBorder = QString("border-width:0px 0px %1px 0px;padding:%2px %2px %1px %2px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
} else if (type == "left") {
|
||||
strBorder = QString("border-width:0px 0px 0px %1px;padding:%2px %2px %2px %1px;")
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
.arg(borderWidth).arg(borderWidth * 2);
|
||||
}
|
||||
|
||||
//如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色
|
||||
@@ -168,10 +168,11 @@ void IconFont::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar>
|
||||
|
||||
widget->setStyleSheet(qss.join(""));
|
||||
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
int icon = icons.at(i);
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
|
||||
btns.at(i)->setIcon(QIcon(pixNormal));
|
||||
btns.at(i)->setIconSize(QSize(iconWidth, iconHeight));
|
||||
@@ -183,7 +184,7 @@ void IconFont::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar>
|
||||
}
|
||||
}
|
||||
|
||||
void IconFont::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void IconFont::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
@@ -203,10 +204,11 @@ void IconFont::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<QChar> i
|
||||
|
||||
frame->setStyleSheet(qss.join(""));
|
||||
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
int icon = icons.at(i);
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
|
||||
btns.at(i)->setIcon(QIcon(pixNormal));
|
||||
btns.at(i)->setIconSize(QSize(iconWidth, iconHeight));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
static IconFont *Instance();
|
||||
explicit IconFont(QObject *parent = 0);
|
||||
|
||||
void setIcon(QLabel *lab, const QChar &icon, quint32 size = 12);
|
||||
void setIcon(QAbstractButton *btn, const QChar &icon, quint32 size = 12);
|
||||
QPixmap getPixmap(const QColor &color, const QChar &icon, quint32 size = 12,
|
||||
void setIcon(QLabel *lab, int icon, quint32 size = 12);
|
||||
void setIcon(QAbstractButton *btn, int icon, quint32 size = 12);
|
||||
QPixmap getPixmap(const QColor &color, int icon, quint32 size = 12,
|
||||
quint32 pixWidth = 15, quint32 pixHeight = 15,
|
||||
int flags = Qt::AlignCenter);
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
const QString &darkTextColor = "#FDFDFD");
|
||||
|
||||
//指定导航面板样式,带图标和效果切换
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &type = "left", int borderWidth = 3,
|
||||
const QString &borderColor = "#029FEA",
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
const QString &darkTextColor = "#FDFDFD");
|
||||
|
||||
//指定导航按钮样式,带图标和效果切换
|
||||
void setStyle(QFrame *frame, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &normalBgColor = "#2FC5A2",
|
||||
const QString &darkBgColor = "#3EA7E9",
|
||||
|
||||
@@ -39,21 +39,21 @@ QFont IconHelper::getIconFont()
|
||||
return this->iconFont;
|
||||
}
|
||||
|
||||
void IconHelper::setIcon(QLabel *lab, const QChar &icon, quint32 size)
|
||||
void IconHelper::setIcon(QLabel *lab, int icon, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
lab->setFont(iconFont);
|
||||
lab->setText(icon);
|
||||
lab->setText((QChar)icon);
|
||||
}
|
||||
|
||||
void IconHelper::setIcon(QAbstractButton *btn, const QChar &icon, quint32 size)
|
||||
void IconHelper::setIcon(QAbstractButton *btn, int icon, quint32 size)
|
||||
{
|
||||
iconFont.setPixelSize(size);
|
||||
btn->setFont(iconFont);
|
||||
btn->setText(icon);
|
||||
btn->setText((QChar)icon);
|
||||
}
|
||||
|
||||
QPixmap IconHelper::getPixmap(const QColor &color, const QChar &icon, quint32 size,
|
||||
QPixmap IconHelper::getPixmap(const QColor &color, int icon, quint32 size,
|
||||
quint32 pixWidth, quint32 pixHeight, int flags)
|
||||
{
|
||||
QPixmap pix(pixWidth, pixHeight);
|
||||
@@ -66,7 +66,7 @@ QPixmap IconHelper::getPixmap(const QColor &color, const QChar &icon, quint32 si
|
||||
|
||||
iconFont.setPixelSize(size);
|
||||
painter.setFont(iconFont);
|
||||
painter.drawText(pix.rect(), flags, icon);
|
||||
painter.drawText(pix.rect(), flags, (QChar)icon);
|
||||
painter.end();
|
||||
|
||||
return pix;
|
||||
@@ -106,7 +106,7 @@ QPixmap IconHelper::getPixmap(QToolButton *btn, int type)
|
||||
return pix;
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void IconHelper::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
const QString &normalTextColor, const QString &darkTextColor)
|
||||
@@ -127,8 +127,9 @@ void IconHelper::setStyle(QFrame *frame, QList<QToolButton *> btns, QList<QChar>
|
||||
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
int icon = icons.at(i);
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
|
||||
QToolButton *btn = btns.at(i);
|
||||
btn->setIcon(QIcon(pixNormal));
|
||||
@@ -194,7 +195,7 @@ void IconHelper::removeStyle(QList<QToolButton *> btns)
|
||||
}
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize, quint32 iconWidth, quint32 iconHeight,
|
||||
const QString &type, int borderWidth, const QString &borderColor,
|
||||
const QString &normalBgColor, const QString &darkBgColor,
|
||||
@@ -247,8 +248,9 @@ void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QCha
|
||||
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
int icon = icons.at(i);
|
||||
QPixmap pixNormal = getPixmap(normalTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixDark = getPixmap(darkTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
|
||||
QToolButton *btn = btns.at(i);
|
||||
btn->setIcon(QIcon(pixNormal));
|
||||
@@ -264,7 +266,7 @@ void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QCha
|
||||
}
|
||||
}
|
||||
|
||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar> icons, const IconHelper::StyleColor &styleColor)
|
||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
||||
{
|
||||
int btnCount = btns.count();
|
||||
int charCount = icons.count();
|
||||
@@ -320,10 +322,11 @@ void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QCha
|
||||
|
||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
||||
for (int i = 0; i < btnCount; i++) {
|
||||
QPixmap pixNormal = getPixmap(styleColor.normalTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixHover = getPixmap(styleColor.hoverTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixPressed = getPixmap(styleColor.pressedTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixChecked = getPixmap(styleColor.checkedTextColor, icons.at(i), iconSize, iconWidth, iconHeight);
|
||||
int icon = icons.at(i);
|
||||
QPixmap pixNormal = getPixmap(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixHover = getPixmap(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixPressed = getPixmap(styleColor.pressedTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
QPixmap pixChecked = getPixmap(styleColor.checkedTextColor, icon, iconSize, iconWidth, iconHeight);
|
||||
|
||||
QToolButton *btn = btns.at(i);
|
||||
btn->setIcon(QIcon(pixNormal));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
@@ -24,12 +24,12 @@ public:
|
||||
QFont getIconFont();
|
||||
|
||||
//设置图形字体到标签
|
||||
void setIcon(QLabel *lab, const QChar &icon, quint32 size = 12);
|
||||
void setIcon(QLabel *lab, int icon, quint32 size = 12);
|
||||
//设置图形字体到按钮
|
||||
void setIcon(QAbstractButton *btn, const QChar &icon, quint32 size = 12);
|
||||
void setIcon(QAbstractButton *btn, int icon, quint32 size = 12);
|
||||
|
||||
//获取指定图形字体,可以指定文字大小,图片宽高,文字对齐
|
||||
QPixmap getPixmap(const QColor &color, const QChar &icon, quint32 size = 12,
|
||||
QPixmap getPixmap(const QColor &color, int icon, quint32 size = 12,
|
||||
quint32 pixWidth = 15, quint32 pixHeight = 15,
|
||||
int flags = Qt::AlignCenter);
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
QPixmap getPixmap(QToolButton *btn, int type);
|
||||
|
||||
//指定QFrame导航按钮样式,带图标
|
||||
void setStyle(QFrame *frame, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void setStyle(QFrame *frame, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &normalBgColor = "#2FC5A2",
|
||||
const QString &darkBgColor = "#3EA7E9",
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void removeStyle(QList<QToolButton *> btns);
|
||||
|
||||
//指定QWidget导航面板样式,带图标和效果切换
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar> icons,
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons,
|
||||
quint32 iconSize = 12, quint32 iconWidth = 15, quint32 iconHeight = 15,
|
||||
const QString &type = "left", int borderWidth = 3,
|
||||
const QString &borderColor = "#029FEA",
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
};
|
||||
|
||||
//指定QWidget导航面板样式,带图标和效果切换+悬停颜色+按下颜色+选中颜色
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<QChar> icons, const StyleColor &styleColor);
|
||||
void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "quiconfig.h"
|
||||
|
||||
QChar QUIConfig::IconMain = 0xf072;
|
||||
QChar QUIConfig::IconMenu = 0xf0d7;
|
||||
QChar QUIConfig::IconMin = 0xf068;
|
||||
QChar QUIConfig::IconMax = 0xf2d2;
|
||||
QChar QUIConfig::IconNormal = 0xf2d0;
|
||||
QChar QUIConfig::IconClose = 0xf00d;
|
||||
int QUIConfig::IconMain = 0xf072;
|
||||
int QUIConfig::IconMenu = 0xf0d7;
|
||||
int QUIConfig::IconMin = 0xf068;
|
||||
int QUIConfig::IconMax = 0xf2d2;
|
||||
int QUIConfig::IconNormal = 0xf2d0;
|
||||
int QUIConfig::IconClose = 0xf00d;
|
||||
|
||||
#ifdef __arm__
|
||||
QString QUIConfig::FontName = "WenQuanYi Micro Hei";
|
||||
|
||||
@@ -7,12 +7,12 @@ class QUIConfig
|
||||
{
|
||||
public:
|
||||
//全局图标
|
||||
static QChar IconMain; //标题栏左上角图标
|
||||
static QChar IconMenu; //下拉菜单图标
|
||||
static QChar IconMin; //最小化图标
|
||||
static QChar IconMax; //最大化图标
|
||||
static QChar IconNormal; //还原图标
|
||||
static QChar IconClose; //关闭图标
|
||||
static int IconMain; //标题栏左上角图标
|
||||
static int IconMenu; //下拉菜单图标
|
||||
static int IconMin; //最小化图标
|
||||
static int IconMax; //最大化图标
|
||||
static int IconNormal; //还原图标
|
||||
static int IconClose; //关闭图标
|
||||
|
||||
//全局字体
|
||||
static QString FontName; //全局字体名称
|
||||
|
||||
@@ -256,7 +256,7 @@ QString QUIDateSelect::getEndDateTime() const
|
||||
return this->endDateTime;
|
||||
}
|
||||
|
||||
void QUIDateSelect::setIconMain(const QChar &icon, quint32 size)
|
||||
void QUIDateSelect::setIconMain(int icon, quint32 size)
|
||||
{
|
||||
IconHelper::Instance()->setIcon(this->labIco, icon, size);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
QString getEndDateTime() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIconMain(const QChar &icon, quint32 size = 12);
|
||||
void setIconMain(int icon, quint32 size = 12);
|
||||
void setFormat(const QString &format);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
#include "quihelper.h"
|
||||
|
||||
QString QUIHelper::getUuid()
|
||||
{
|
||||
QString uuid = QUuid::createUuid().toString();
|
||||
uuid = uuid.replace("{", "");
|
||||
uuid = uuid.replace("}", "");
|
||||
return uuid;
|
||||
}
|
||||
|
||||
int QUIHelper::getScreenIndex()
|
||||
{
|
||||
//需要对多个屏幕进行处理
|
||||
int screenIndex = -1;
|
||||
int screenIndex = 0;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
int screenCount = qApp->screens().count();
|
||||
#else
|
||||
int screenCount = qApp->desktop()->screenCount();
|
||||
#endif
|
||||
|
||||
if (screenCount > 1) {
|
||||
//找到当前鼠标所在屏幕
|
||||
QPoint pos = QCursor::pos();
|
||||
for (int i = 0; i < screenCount; ++i) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
if (qApp->screens().at(i)->geometry().contains(pos)) {
|
||||
#else
|
||||
if (qApp->desktop()->screenGeometry(i).contains(pos)) {
|
||||
#endif
|
||||
screenIndex = i;
|
||||
break;
|
||||
}
|
||||
@@ -26,18 +27,50 @@ int QUIHelper::getScreenIndex()
|
||||
return screenIndex;
|
||||
}
|
||||
|
||||
QRect QUIHelper::getScreenRect(bool available)
|
||||
{
|
||||
QRect rect;
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
if (available) {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
rect = qApp->screens().at(screenIndex)->availableGeometry();
|
||||
#else
|
||||
rect = qApp->desktop()->availableGeometry(screenIndex);
|
||||
#endif
|
||||
} else {
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
rect = qApp->screens().at(screenIndex)->geometry();
|
||||
#else
|
||||
rect = qApp->desktop()->screenGeometry(screenIndex);
|
||||
#endif
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
int QUIHelper::deskWidth()
|
||||
{
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
int width = qApp->desktop()->availableGeometry(screenIndex).width();
|
||||
return width;
|
||||
return getScreenRect().width();
|
||||
}
|
||||
|
||||
int QUIHelper::deskHeight()
|
||||
{
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
int height = qApp->desktop()->availableGeometry(screenIndex).height();
|
||||
return height;
|
||||
return getScreenRect().height();
|
||||
}
|
||||
|
||||
void QUIHelper::setFormInCenter(QWidget *form)
|
||||
{
|
||||
int formWidth = form->width();
|
||||
int formHeight = form->height();
|
||||
QRect rect = getScreenRect();
|
||||
int deskWidth = rect.width();
|
||||
int deskHeight = rect.height();
|
||||
QPoint movePoint(deskWidth / 2 - formWidth / 2 + rect.x(), deskHeight / 2 - formHeight / 2);
|
||||
form->move(movePoint);
|
||||
|
||||
//其他系统自动最大化
|
||||
#ifndef Q_OS_WIN
|
||||
QTimer::singleShot(100, form, SLOT(showMaximized()));
|
||||
#endif
|
||||
}
|
||||
|
||||
QString QUIHelper::appName()
|
||||
@@ -64,11 +97,98 @@ QString QUIHelper::appPath()
|
||||
#endif
|
||||
}
|
||||
|
||||
QString QUIHelper::getUuid()
|
||||
{
|
||||
QString uuid = QUuid::createUuid().toString();
|
||||
uuid = uuid.replace("{", "");
|
||||
uuid = uuid.replace("}", "");
|
||||
return uuid;
|
||||
}
|
||||
|
||||
void QUIHelper::initRand()
|
||||
{
|
||||
//初始化随机数种子
|
||||
QTime t = QTime::currentTime();
|
||||
qsrand(t.msec() + t.second() * 1000);
|
||||
srand(t.msec() + t.second() * 1000);
|
||||
}
|
||||
|
||||
void QUIHelper::newDir(const QString &dirName)
|
||||
{
|
||||
QString strDir = dirName;
|
||||
|
||||
//如果路径中包含斜杠字符则说明是绝对路径
|
||||
//linux系统路径字符带有 / windows系统 路径字符带有 :/
|
||||
if (!strDir.startsWith("/") && !strDir.contains(":/")) {
|
||||
strDir = QString("%1/%2").arg(QUIHelper::appPath()).arg(strDir);
|
||||
}
|
||||
|
||||
QDir dir(strDir);
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(strDir);
|
||||
}
|
||||
}
|
||||
|
||||
void QUIHelper::sleep(int msec)
|
||||
{
|
||||
if (msec > 0) {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
QTime endTime = QTime::currentTime().addMSecs(msec);
|
||||
while (QTime::currentTime() < endTime) {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
#else
|
||||
QThread::msleep(msec);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QUIHelper::setCode(bool utf8)
|
||||
{
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||
#if _MSC_VER
|
||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
#endif
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
QTextCodec::setCodecForCStrings(codec);
|
||||
QTextCodec::setCodecForTr(codec);
|
||||
#else
|
||||
//如果想要控制台打印信息中文正常就注释掉这个设置
|
||||
if (utf8) {
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void QUIHelper::setFont(const QString &ttfFile, const QString &fontName, int fontSize)
|
||||
{
|
||||
QFont font;
|
||||
font.setFamily(fontName);
|
||||
font.setPixelSize(fontSize);
|
||||
|
||||
//如果存在字体文件则设备字体文件中的字体
|
||||
//安卓版本和网页版本需要字体文件一起打包单独设置字体
|
||||
if (!ttfFile.isEmpty()) {
|
||||
QFontDatabase fontDb;
|
||||
int fontId = fontDb.addApplicationFont(ttfFile);
|
||||
if (fontId != -1) {
|
||||
QStringList androidFont = fontDb.applicationFontFamilies(fontId);
|
||||
if (androidFont.size() != 0) {
|
||||
font.setFamily(androidFont.at(0));
|
||||
font.setPixelSize(fontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
qApp->setFont(font);
|
||||
}
|
||||
|
||||
void QUIHelper::setTranslator(const QString &qmFile)
|
||||
{
|
||||
QTranslator *translator = new QTranslator(qApp);
|
||||
translator->load(qmFile);
|
||||
qApp->installTranslator(translator);
|
||||
}
|
||||
|
||||
void QUIHelper::initDb(const QString &dbName)
|
||||
@@ -122,14 +242,14 @@ bool QUIHelper::checkIniFile(const QString &iniFile)
|
||||
return true;
|
||||
}
|
||||
|
||||
void QUIHelper::setIconBtn(QAbstractButton *btn, const QString &png, const QChar &str)
|
||||
void QUIHelper::setIconBtn(QAbstractButton *btn, const QString &png, int icon)
|
||||
{
|
||||
int size = 16;
|
||||
int width = 18;
|
||||
int height = 18;
|
||||
QPixmap pix;
|
||||
if (QPixmap(png).isNull()) {
|
||||
pix = IconHelper::Instance()->getPixmap(QUIConfig::TextColor, str, size, width, height);
|
||||
pix = IconHelper::Instance()->getPixmap(QUIConfig::TextColor, icon, size, width, height);
|
||||
} else {
|
||||
pix = QPixmap(png);
|
||||
}
|
||||
@@ -138,22 +258,6 @@ void QUIHelper::setIconBtn(QAbstractButton *btn, const QString &png, const QChar
|
||||
btn->setIcon(QIcon(pix));
|
||||
}
|
||||
|
||||
void QUIHelper::newDir(const QString &dirName)
|
||||
{
|
||||
QString strDir = dirName;
|
||||
|
||||
//如果路径中包含斜杠字符则说明是绝对路径
|
||||
//linux系统路径字符带有 / windows系统 路径字符带有 :/
|
||||
if (!strDir.startsWith("/") && !strDir.contains(":/")) {
|
||||
strDir = QString("%1/%2").arg(QUIHelper::appPath()).arg(strDir);
|
||||
}
|
||||
|
||||
QDir dir(strDir);
|
||||
if (!dir.exists()) {
|
||||
dir.mkpath(strDir);
|
||||
}
|
||||
}
|
||||
|
||||
void QUIHelper::writeInfo(const QString &info, bool needWrite, const QString &filePath)
|
||||
{
|
||||
if (!needWrite) {
|
||||
@@ -231,80 +335,6 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, QWidget *widgetTitle,
|
||||
IconHelper::Instance()->setIcon(btnClose, QUIConfig::IconClose, QUIConfig::FontSize);
|
||||
}
|
||||
|
||||
void QUIHelper::setFormInCenter(QWidget *frm)
|
||||
{
|
||||
//增加了多屏幕的判断在哪个屏幕就显示在哪个屏幕
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
int frmX = frm->width();
|
||||
int frmY = frm->height();
|
||||
QDesktopWidget w;
|
||||
QRect rect = w.availableGeometry(screenIndex);
|
||||
int deskWidth = rect.width();
|
||||
int deskHeight = rect.height();
|
||||
QPoint movePoint(deskWidth / 2 - frmX / 2 + rect.x(), deskHeight / 2 - frmY / 2);
|
||||
frm->move(movePoint);
|
||||
}
|
||||
|
||||
void QUIHelper::setTranslator(const QString &qmFile)
|
||||
{
|
||||
QTranslator *translator = new QTranslator(qApp);
|
||||
translator->load(qmFile);
|
||||
qApp->installTranslator(translator);
|
||||
}
|
||||
|
||||
void QUIHelper::setCode()
|
||||
{
|
||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
||||
#if _MSC_VER
|
||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
#endif
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
QTextCodec::setCodecForCStrings(codec);
|
||||
QTextCodec::setCodecForTr(codec);
|
||||
#else
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QUIHelper::setFont(const QString &ttfFile, const QString &fontName, int fontSize)
|
||||
{
|
||||
QFont font;
|
||||
font.setFamily(fontName);
|
||||
font.setPixelSize(fontSize);
|
||||
|
||||
//如果存在字体文件则设备字体文件中的字体
|
||||
//安卓版本和网页版本需要字体文件一起打包单独设置字体
|
||||
if (!ttfFile.isEmpty()) {
|
||||
QFontDatabase fontDb;
|
||||
int fontId = fontDb.addApplicationFont(ttfFile);
|
||||
if (fontId != -1) {
|
||||
QStringList androidFont = fontDb.applicationFontFamilies(fontId);
|
||||
if (androidFont.size() != 0) {
|
||||
font.setFamily(androidFont.at(0));
|
||||
font.setPixelSize(fontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
qApp->setFont(font);
|
||||
}
|
||||
|
||||
void QUIHelper::sleep(int msec)
|
||||
{
|
||||
if (msec > 0) {
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
||||
QTime endTime = QTime::currentTime().addMSecs(msec);
|
||||
while (QTime::currentTime() < endTime) {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
#else
|
||||
QThread::msleep(msec);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QUIHelper::setSystemDateTime(const QString &year, const QString &month, const QString &day, const QString &hour, const QString &min, const QString &sec)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -340,8 +370,10 @@ QString QUIHelper::getIP(const QString &url)
|
||||
{
|
||||
//取出IP地址
|
||||
QRegExp regExp("((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))");
|
||||
regExp.indexIn(url);
|
||||
return url.mid(url.indexOf(regExp), regExp.matchedLength());
|
||||
int start = regExp.indexIn(url);
|
||||
int length = regExp.matchedLength();
|
||||
QString ip = url.mid(start, length);
|
||||
return ip;
|
||||
}
|
||||
|
||||
bool QUIHelper::isIP(const QString &ip)
|
||||
@@ -1180,7 +1212,7 @@ void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVis
|
||||
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
//表头不可单击
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||
tableView->horizontalHeader()->setSectionsClickable(false);
|
||||
#else
|
||||
tableView->horizontalHeader()->setClickable(false);
|
||||
|
||||
@@ -6,21 +6,32 @@
|
||||
class QUIHelper
|
||||
{
|
||||
public:
|
||||
//获取uuid
|
||||
static QString getUuid();
|
||||
//获取当前鼠标所在屏幕
|
||||
//获取当前鼠标所在屏幕索引+尺寸
|
||||
static int getScreenIndex();
|
||||
static QRect getScreenRect(bool available = true);
|
||||
|
||||
//桌面宽度高度
|
||||
//获取桌面宽度高度+居中显示
|
||||
static int deskWidth();
|
||||
static int deskHeight();
|
||||
static void setFormInCenter(QWidget *form);
|
||||
|
||||
//程序文件名称+当前所在路径
|
||||
static QString appName();
|
||||
static QString appPath();
|
||||
|
||||
//初始化随机数种子
|
||||
//获取uuid+初始化随机数种子+新建目录+延时
|
||||
static QString getUuid();
|
||||
static void initRand();
|
||||
static void newDir(const QString &dirName);
|
||||
static void sleep(int msec);
|
||||
|
||||
//设置编码
|
||||
static void setCode(bool utf8 = true);
|
||||
//设置字体
|
||||
static void setFont(const QString &ttfFile = ":/image/DroidSansFallback.ttf",
|
||||
const QString &fontName = "Microsoft Yahei", int fontSize = 12);
|
||||
//设置翻译文件
|
||||
static void setTranslator(const QString &qmFile = ":/image/qt_zh_CN.qm");
|
||||
|
||||
//初始化数据库
|
||||
static void initDb(const QString &dbName);
|
||||
@@ -31,10 +42,7 @@ public:
|
||||
static bool checkIniFile(const QString &iniFile);
|
||||
|
||||
//设置图标到按钮
|
||||
static void setIconBtn(QAbstractButton *btn, const QString &png, const QChar &str);
|
||||
|
||||
//新建目录
|
||||
static void newDir(const QString &dirName);
|
||||
static void setIconBtn(QAbstractButton *btn, const QString &png, int icon);
|
||||
|
||||
//写入消息到额外的的消息日志文件
|
||||
static void writeInfo(const QString &info, bool needWrite = false, const QString &filePath = "log");
|
||||
@@ -47,18 +55,6 @@ public:
|
||||
QLabel *labIco, QPushButton *btnClose,
|
||||
bool tool = true, bool top = true, bool menu = false);
|
||||
|
||||
//设置窗体居中显示
|
||||
static void setFormInCenter(QWidget *frm);
|
||||
//设置翻译文件
|
||||
static void setTranslator(const QString &qmFile = ":/image/qt_zh_CN.qm");
|
||||
//设置编码
|
||||
static void setCode();
|
||||
//设置字体
|
||||
static void setFont(const QString &ttfFile = ":/image/DroidSansFallback.ttf",
|
||||
const QString &fontName = "Microsoft Yahei", int fontSize = 12);
|
||||
|
||||
//设置延时
|
||||
static void sleep(int msec);
|
||||
//设置系统时间
|
||||
static void setSystemDateTime(const QString &year, const QString &month, const QString &day,
|
||||
const QString &hour, const QString &min, const QString &sec);
|
||||
|
||||
@@ -285,7 +285,7 @@ void QUIInputBox::on_btnMenu_Close_clicked()
|
||||
close();
|
||||
}
|
||||
|
||||
void QUIInputBox::setIconMain(const QChar &icon, quint32 size)
|
||||
void QUIInputBox::setIconMain(int icon, quint32 size)
|
||||
{
|
||||
IconHelper::Instance()->setIcon(this->labIco, icon, size);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
QString getValue()const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIconMain(const QChar &icon, quint32 size = 12);
|
||||
void setIconMain(int icon, quint32 size = 12);
|
||||
void setParameter(const QString &title, int type = 0, int closeSec = 0,
|
||||
QString placeholderText = QString(), bool pwd = false,
|
||||
const QString &defaultValue = QString());
|
||||
|
||||
@@ -262,17 +262,17 @@ void QUIMessageBox::on_btnMenu_Close_clicked()
|
||||
close();
|
||||
}
|
||||
|
||||
void QUIMessageBox::setIconMain(const QChar &icon, quint32 size)
|
||||
void QUIMessageBox::setIconMain(int icon, quint32 size)
|
||||
{
|
||||
IconHelper::Instance()->setIcon(this->labIco, icon, size);
|
||||
}
|
||||
|
||||
void QUIMessageBox::setIconMsg(const QString &png, const QChar &str)
|
||||
void QUIMessageBox::setIconMsg(const QString &png, int icon)
|
||||
{
|
||||
//图片存在则取图片,不存在则取图形字体
|
||||
int size = this->labIcoMain->size().height();
|
||||
if (QImage(png).isNull()) {
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, str, size);
|
||||
IconHelper::Instance()->setIcon(this->labIcoMain, icon, size);
|
||||
} else {
|
||||
this->labIcoMain->setStyleSheet(QString("border-image:url(%1);").arg(png));
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ private slots:
|
||||
void on_btnMenu_Close_clicked();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIconMain(const QChar &icon, quint32 size = 12);
|
||||
void setIconMsg(const QString &png, const QChar &str);
|
||||
void setIconMain(int icon, quint32 size = 12);
|
||||
void setIconMsg(const QString &png, int icon);
|
||||
void setMessage(const QString &msg, int type, int closeSec = 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ void QUITipBox::on_btnMenu_Close_clicked()
|
||||
close();
|
||||
}
|
||||
|
||||
void QUITipBox::setIconMain(const QChar &icon, quint32 size)
|
||||
void QUITipBox::setIconMain(int icon, quint32 size)
|
||||
{
|
||||
IconHelper::Instance()->setIcon(this->labIco, icon, size);
|
||||
}
|
||||
@@ -216,8 +216,7 @@ void QUITipBox::setTip(const QString &title, const QString &tip, bool fullScreen
|
||||
this->labInfo->setAlignment(center ? Qt::AlignCenter : Qt::AlignLeft);
|
||||
this->setWindowTitle(this->labTitle->text());
|
||||
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
QRect rect = fullScreen ? qApp->desktop()->screenGeometry(screenIndex) : qApp->desktop()->availableGeometry(screenIndex);
|
||||
QRect rect = QUIHelper::getScreenRect(!fullScreen);
|
||||
int width = rect.width();
|
||||
int height = rect.height();
|
||||
int x = width - this->width() + rect.x();
|
||||
@@ -235,8 +234,7 @@ void QUITipBox::setTip(const QString &title, const QString &tip, bool fullScreen
|
||||
|
||||
void QUITipBox::hide()
|
||||
{
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
QRect rect = fullScreen ? qApp->desktop()->screenGeometry(screenIndex) : qApp->desktop()->availableGeometry(screenIndex);
|
||||
QRect rect = QUIHelper::getScreenRect(!fullScreen);
|
||||
int width = rect.width();
|
||||
int height = rect.height();
|
||||
int x = width - this->width() + rect.x();
|
||||
@@ -245,7 +243,7 @@ void QUITipBox::hide()
|
||||
//启动动画
|
||||
animation->stop();
|
||||
animation->setStartValue(QPoint(x, y));
|
||||
animation->setEndValue(QPoint(x, qApp->desktop()->geometry().height()));
|
||||
animation->setEndValue(QPoint(x, QUIHelper::getScreenRect(false).height()));
|
||||
animation->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ private slots:
|
||||
void on_btnMenu_Close_clicked();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setIconMain(const QChar &icon, quint32 size = 12);
|
||||
void setIconMain(int icon, quint32 size = 12);
|
||||
void setTip(const QString &title, const QString &tip, bool fullScreen = false, bool center = true, int closeSec = 0);
|
||||
void hide();
|
||||
};
|
||||
|
||||
@@ -271,7 +271,7 @@ void QUIWidget::changeStyle()
|
||||
emit changeStyle(qssFile);
|
||||
}
|
||||
|
||||
void QUIWidget::setIcon(QUIWidget::Widget widget, const QChar &icon, quint32 size)
|
||||
void QUIWidget::setIcon(QUIWidget::Widget widget, int icon, quint32 size)
|
||||
{
|
||||
if (widget == QUIWidget::Lab_Ico) {
|
||||
setIconMain(icon, size);
|
||||
@@ -293,7 +293,7 @@ void QUIWidget::setIcon(QUIWidget::Widget widget, const QChar &icon, quint32 siz
|
||||
}
|
||||
}
|
||||
|
||||
void QUIWidget::setIconMain(const QChar &icon, quint32 size)
|
||||
void QUIWidget::setIconMain(int icon, quint32 size)
|
||||
{
|
||||
QUIConfig::IconMain = icon;
|
||||
IconHelper::Instance()->setIcon(this->labIco, icon, size);
|
||||
@@ -418,8 +418,7 @@ void QUIWidget::on_btnMenu_Max_clicked()
|
||||
setIcon(QUIWidget::BtnMenu_Normal, QUIConfig::IconNormal);
|
||||
} else {
|
||||
location = this->geometry();
|
||||
int screenIndex = QUIHelper::getScreenIndex();
|
||||
this->setGeometry(qApp->desktop()->availableGeometry(screenIndex));
|
||||
this->setGeometry(QUIHelper::getScreenRect());
|
||||
setIcon(QUIWidget::BtnMenu_Max, QUIConfig::IconMax);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@ private slots:
|
||||
|
||||
public Q_SLOTS:
|
||||
//设置部件图标
|
||||
void setIcon(QUIWidget::Widget widget, const QChar &icon, quint32 size = 12);
|
||||
void setIconMain(const QChar &icon, quint32 size = 12);
|
||||
void setIcon(QUIWidget::Widget widget, int icon, quint32 size = 12);
|
||||
void setIconMain(int icon, quint32 size = 12);
|
||||
//设置部件图片
|
||||
void setPixmap(QUIWidget::Widget widget, const QString &file, const QSize &size = QSize(16, 16));
|
||||
//设置部件是否可见
|
||||
|
||||
Reference in New Issue
Block a user