更新代码
|
@ -3,21 +3,20 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui {
|
||||||
{
|
|
||||||
class frmBattery;
|
class frmBattery;
|
||||||
}
|
}
|
||||||
|
|
||||||
class frmBattery : public QWidget
|
class frmBattery : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit frmBattery(QWidget *parent = 0);
|
explicit frmBattery(QWidget *parent = 0);
|
||||||
~frmBattery();
|
~frmBattery();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::frmBattery *ui;
|
Ui::frmBattery *ui;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initForm();
|
void initForm();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>800</width>
|
||||||
<height>300</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -9,7 +9,7 @@ int main(int argc, char *argv[])
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setFont(QFont("Microsoft Yahei", 9));
|
a.setFont(QFont("Microsoft Yahei", 9));
|
||||||
|
|
||||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -5,11 +5,11 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
||||||
TARGET = comtool
|
TARGET = comtool
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
DESTDIR = $$PWD/../bin
|
DESTDIR = $$PWD/../bin
|
||||||
RC_FILE = other/main.rc
|
RC_FILE = qrc/main.rc
|
||||||
|
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
HEADERS += head.h
|
HEADERS += head.h
|
||||||
RESOURCES += other/main.qrc
|
RESOURCES += qrc/main.qrc
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
INCLUDEPATH += $$PWD/api
|
INCLUDEPATH += $$PWD/api
|
||||||
|
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
|
@ -43,5 +43,5 @@ SOURCES += \
|
||||||
$$PWD/quitipbox.cpp \
|
$$PWD/quitipbox.cpp \
|
||||||
$$PWD/quiwidget.cpp
|
$$PWD/quiwidget.cpp
|
||||||
|
|
||||||
RESOURCES += $$PWD/resource/qm.qrc
|
RESOURCES += $$PWD/qrc/qm.qrc
|
||||||
RESOURCES += $$PWD/resource/ttf.qrc
|
RESOURCES += $$PWD/qrc/font.qrc
|
||||||
|
|
|
@ -11,13 +11,13 @@ void IconHelper::initFont()
|
||||||
if (!isInit) {
|
if (!isInit) {
|
||||||
isInit = true;
|
isInit = true;
|
||||||
if (iconFontAliBaBa == 0) {
|
if (iconFontAliBaBa == 0) {
|
||||||
iconFontAliBaBa = new IconHelper(":/image/iconfont.ttf", "iconfont");
|
iconFontAliBaBa = new IconHelper(":/font/iconfont.ttf", "iconfont");
|
||||||
}
|
}
|
||||||
if (iconFontAwesome == 0) {
|
if (iconFontAwesome == 0) {
|
||||||
iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome");
|
iconFontAwesome = new IconHelper(":/font/fontawesome-webfont.ttf", "FontAwesome");
|
||||||
}
|
}
|
||||||
if (iconFontWeather == 0) {
|
if (iconFontWeather == 0) {
|
||||||
iconFontWeather = new IconHelper(":/image/pe-icon-set-weather.ttf", "pe-icon-set-weather");
|
iconFontWeather = new IconHelper(":/font/pe-icon-set-weather.ttf", "pe-icon-set-weather");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>font/fontawesome-webfont.ttf</file>
|
||||||
|
<file>font/iconfont.ttf</file>
|
||||||
|
<file>font/pe-icon-set-weather.ttf</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>qm/qt_zh_CN.qm</file>
|
||||||
|
<file>qm/widgets.qm</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -68,7 +68,7 @@ void QUIDateSelect::initControl()
|
||||||
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
||||||
|
|
||||||
widgetTitle = new QWidget(this);
|
widgetTitle = new QWidget(this);
|
||||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
sizePolicy.setVerticalStretch(0);
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
@ -81,7 +81,7 @@ void QUIDateSelect::initControl()
|
||||||
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
labIco = new QLabel(widgetTitle);
|
labIco = new QLabel(widgetTitle);
|
||||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
|
@ -91,7 +91,7 @@ void QUIDateSelect::initControl()
|
||||||
horizontalLayout1->addWidget(labIco);
|
horizontalLayout1->addWidget(labIco);
|
||||||
|
|
||||||
labTitle = new QLabel(widgetTitle);
|
labTitle = new QLabel(widgetTitle);
|
||||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
|
||||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
sizePolicy2.setHorizontalStretch(0);
|
sizePolicy2.setHorizontalStretch(0);
|
||||||
sizePolicy2.setVerticalStretch(0);
|
sizePolicy2.setVerticalStretch(0);
|
||||||
|
@ -101,7 +101,7 @@ void QUIDateSelect::initControl()
|
||||||
horizontalLayout1->addWidget(labTitle);
|
horizontalLayout1->addWidget(labTitle);
|
||||||
|
|
||||||
widgetMenu = new QWidget(widgetTitle);
|
widgetMenu = new QWidget(widgetTitle);
|
||||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
|
||||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||||
widgetMenu->setSizePolicy(sizePolicy1);
|
widgetMenu->setSizePolicy(sizePolicy1);
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void QUIDateSelect::initControl()
|
||||||
verticalLayout->addWidget(widgetTitle);
|
verticalLayout->addWidget(widgetTitle);
|
||||||
|
|
||||||
widgetMain = new QWidget(this);
|
widgetMain = new QWidget(this);
|
||||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
|
||||||
|
|
||||||
verticalLayout1 = new QVBoxLayout(widgetMain);
|
verticalLayout1 = new QVBoxLayout(widgetMain);
|
||||||
verticalLayout1->setSpacing(6);
|
verticalLayout1->setSpacing(6);
|
||||||
|
@ -134,19 +134,19 @@ void QUIDateSelect::initControl()
|
||||||
verticalLayout1->setContentsMargins(6, 6, 6, 6);
|
verticalLayout1->setContentsMargins(6, 6, 6, 6);
|
||||||
|
|
||||||
frame = new QFrame(widgetMain);
|
frame = new QFrame(widgetMain);
|
||||||
frame->setObjectName(QString::fromUtf8("frame"));
|
frame->setObjectName(QString::fromUtf8("QUIFrame"));
|
||||||
frame->setFrameShape(QFrame::Box);
|
frame->setFrameShape(QFrame::Box);
|
||||||
frame->setFrameShadow(QFrame::Sunken);
|
frame->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
gridLayout = new QGridLayout(frame);
|
gridLayout = new QGridLayout(frame);
|
||||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
|
||||||
labStart = new QLabel(frame);
|
labStart = new QLabel(frame);
|
||||||
labStart->setObjectName(QString::fromUtf8("labStart"));
|
labStart->setObjectName(QString::fromUtf8("QUILabStart"));
|
||||||
labStart->setFocusPolicy(Qt::TabFocus);
|
labStart->setFocusPolicy(Qt::TabFocus);
|
||||||
gridLayout->addWidget(labStart, 0, 0, 1, 1);
|
gridLayout->addWidget(labStart, 0, 0, 1, 1);
|
||||||
|
|
||||||
btnOk = new QPushButton(frame);
|
btnOk = new QPushButton(frame);
|
||||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
btnOk->setObjectName(QString::fromUtf8("QUIBtnOk"));
|
||||||
btnOk->setMinimumSize(QSize(85, 0));
|
btnOk->setMinimumSize(QSize(85, 0));
|
||||||
btnOk->setCursor(QCursor(Qt::PointingHandCursor));
|
btnOk->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
btnOk->setFocusPolicy(Qt::StrongFocus);
|
btnOk->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
@ -154,19 +154,19 @@ void QUIDateSelect::initControl()
|
||||||
btnOk->setDefault(true);
|
btnOk->setDefault(true);
|
||||||
|
|
||||||
labEnd = new QLabel(frame);
|
labEnd = new QLabel(frame);
|
||||||
labEnd->setObjectName(QString::fromUtf8("labEnd"));
|
labEnd->setObjectName(QString::fromUtf8("QUILabEnd"));
|
||||||
labEnd->setFocusPolicy(Qt::TabFocus);
|
labEnd->setFocusPolicy(Qt::TabFocus);
|
||||||
gridLayout->addWidget(labEnd, 1, 0, 1, 1);
|
gridLayout->addWidget(labEnd, 1, 0, 1, 1);
|
||||||
|
|
||||||
btnClose = new QPushButton(frame);
|
btnClose = new QPushButton(frame);
|
||||||
btnClose->setObjectName(QString::fromUtf8("btnClose"));
|
btnClose->setObjectName(QString::fromUtf8("QUIBtnClose"));
|
||||||
btnClose->setMinimumSize(QSize(85, 0));
|
btnClose->setMinimumSize(QSize(85, 0));
|
||||||
btnClose->setCursor(QCursor(Qt::PointingHandCursor));
|
btnClose->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
btnClose->setFocusPolicy(Qt::StrongFocus);
|
btnClose->setFocusPolicy(Qt::StrongFocus);
|
||||||
gridLayout->addWidget(btnClose, 1, 2, 1, 1);
|
gridLayout->addWidget(btnClose, 1, 2, 1, 1);
|
||||||
|
|
||||||
dateStart = new QDateTimeEdit(frame);
|
dateStart = new QDateTimeEdit(frame);
|
||||||
dateStart->setObjectName(QString::fromUtf8("dateStart"));
|
dateStart->setObjectName(QString::fromUtf8("QUIDateStart"));
|
||||||
QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
sizePolicy4.setHorizontalStretch(0);
|
sizePolicy4.setHorizontalStretch(0);
|
||||||
sizePolicy4.setVerticalStretch(0);
|
sizePolicy4.setVerticalStretch(0);
|
||||||
|
@ -176,7 +176,7 @@ void QUIDateSelect::initControl()
|
||||||
gridLayout->addWidget(dateStart, 0, 1, 1, 1);
|
gridLayout->addWidget(dateStart, 0, 1, 1, 1);
|
||||||
|
|
||||||
dateEnd = new QDateTimeEdit(frame);
|
dateEnd = new QDateTimeEdit(frame);
|
||||||
dateEnd->setObjectName(QString::fromUtf8("dateEnd"));
|
dateEnd->setObjectName(QString::fromUtf8("QUIDateEnd"));
|
||||||
sizePolicy4.setHeightForWidth(dateEnd->sizePolicy().hasHeightForWidth());
|
sizePolicy4.setHeightForWidth(dateEnd->sizePolicy().hasHeightForWidth());
|
||||||
dateEnd->setSizePolicy(sizePolicy4);
|
dateEnd->setSizePolicy(sizePolicy4);
|
||||||
dateEnd->setCalendarPopup(true);
|
dateEnd->setCalendarPopup(true);
|
||||||
|
@ -213,10 +213,14 @@ void QUIDateSelect::initControl()
|
||||||
|
|
||||||
void QUIDateSelect::initForm()
|
void QUIDateSelect::initForm()
|
||||||
{
|
{
|
||||||
|
//设置阴影
|
||||||
|
QUIHelper::setFormShadow(this, verticalLayout);
|
||||||
|
//设置无边框
|
||||||
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
||||||
this->setWindowTitle(this->labTitle->text());
|
this->setWindowTitle(this->labTitle->text());
|
||||||
this->setFixedSize(QUIDialogMinWidth + 50, QUIDialogMinHeight);
|
this->setFixedSize(QUIDialogMinWidth + 50, QUIDialogMinHeight);
|
||||||
|
|
||||||
|
//按钮设置最小尺寸和图标大小
|
||||||
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
|
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
|
||||||
foreach (QPushButton *btn, btns) {
|
foreach (QPushButton *btn, btns) {
|
||||||
btn->setMinimumWidth(QUIBtnMinWidth);
|
btn->setMinimumWidth(QUIBtnMinWidth);
|
||||||
|
|
|
@ -296,6 +296,64 @@ void QUIHelper::writeError(const QString &info, bool needWrite, const QString &f
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//在部分linux系统设置了背景透明是黑色的所以限定只在win
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
int QUIHelper::shadowMargin = 5;
|
||||||
|
#else
|
||||||
|
int QUIHelper::shadowMargin = 0;
|
||||||
|
#endif
|
||||||
|
int QUIHelper::shadowRadius = 15;
|
||||||
|
QString QUIHelper::shadowColor = "#333333";
|
||||||
|
void QUIHelper::setFormShadow(QWidget *widget, QLayout *layout, const QString &color, int margin, int radius)
|
||||||
|
{
|
||||||
|
if (margin <= 0 || radius <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//采用系统自带的函数设置阴影
|
||||||
|
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect(widget);
|
||||||
|
shadowEffect->setOffset(0, 0);
|
||||||
|
shadowEffect->setColor(color);
|
||||||
|
shadowEffect->setBlurRadius(radius);
|
||||||
|
widget->setGraphicsEffect(shadowEffect);
|
||||||
|
|
||||||
|
//必须设置背景透明
|
||||||
|
widget->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
|
//设置布局边距留出空间给边框阴影
|
||||||
|
layout->setContentsMargins(margin, margin, margin, margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QUIHelper::setFormShadow(const QString &color)
|
||||||
|
{
|
||||||
|
//重新应用边框阴影颜色等
|
||||||
|
QUIHelper::shadowColor = color;
|
||||||
|
QGraphicsDropShadowEffect *shadowEffect = 0;
|
||||||
|
|
||||||
|
//消息框
|
||||||
|
shadowEffect = (QGraphicsDropShadowEffect *) QUIMessageBox::Instance()->graphicsEffect();
|
||||||
|
if (shadowEffect != 0) {
|
||||||
|
shadowEffect->setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//输入框
|
||||||
|
shadowEffect = (QGraphicsDropShadowEffect *) QUIInputBox::Instance()->graphicsEffect();
|
||||||
|
if (shadowEffect != 0) {
|
||||||
|
shadowEffect->setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//右下角提示框
|
||||||
|
shadowEffect = (QGraphicsDropShadowEffect *) QUITipBox::Instance()->graphicsEffect();
|
||||||
|
if (shadowEffect != 0) {
|
||||||
|
shadowEffect->setColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
//日期选择框
|
||||||
|
shadowEffect = (QGraphicsDropShadowEffect *) QUIDateSelect::Instance()->graphicsEffect();
|
||||||
|
if (shadowEffect != 0) {
|
||||||
|
shadowEffect->setColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QUIHelper::setFramelessForm(QWidget *widgetMain, bool tool, bool top, bool menu)
|
void QUIHelper::setFramelessForm(QWidget *widgetMain, bool tool, bool top, bool menu)
|
||||||
{
|
{
|
||||||
widgetMain->setProperty("form", true);
|
widgetMain->setProperty("form", true);
|
||||||
|
@ -314,7 +372,10 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, bool tool, bool top, bool
|
||||||
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::WindowStaysOnTopHint);
|
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
}
|
}
|
||||||
if (menu) {
|
if (menu) {
|
||||||
|
//如果是其他系统比如neokylin会产生系统边框
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
|
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1255,7 +1316,7 @@ int QUIHelper::showMessageBoxQuestion(const QString &info)
|
||||||
{
|
{
|
||||||
if (isCustomUI) {
|
if (isCustomUI) {
|
||||||
QUIMessageBox msg;
|
QUIMessageBox msg;
|
||||||
msg.setMessage(info, 1);
|
msg.setMessage(info, 1);msg.update();
|
||||||
return msg.exec();
|
return msg.exec();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox box(QMessageBox::Question, "询问", info);
|
QMessageBox box(QMessageBox::Question, "询问", info);
|
||||||
|
|
|
@ -32,10 +32,10 @@ public:
|
||||||
//设置编码
|
//设置编码
|
||||||
static void setCode(bool utf8 = true);
|
static void setCode(bool utf8 = true);
|
||||||
//设置字体
|
//设置字体
|
||||||
static void setFont(const QString &ttfFile = ":/image/DroidSansFallback.ttf",
|
static void setFont(const QString &ttfFile = ":/font/DroidSansFallback.ttf",
|
||||||
const QString &fontName = "Microsoft Yahei", int fontSize = 12);
|
const QString &fontName = "Microsoft Yahei", int fontSize = 12);
|
||||||
//设置翻译文件
|
//设置翻译文件
|
||||||
static void setTranslator(const QString &qmFile = ":/image/qt_zh_CN.qm");
|
static void setTranslator(const QString &qmFile = ":/qm/qt_zh_CN.qm");
|
||||||
|
|
||||||
//初始化数据库
|
//初始化数据库
|
||||||
static void initDb(const QString &dbName);
|
static void initDb(const QString &dbName);
|
||||||
|
@ -52,6 +52,17 @@ public:
|
||||||
static void writeInfo(const QString &info, bool needWrite = false, const QString &filePath = "log");
|
static void writeInfo(const QString &info, bool needWrite = false, const QString &filePath = "log");
|
||||||
static void writeError(const QString &info, bool needWrite = false, const QString &filePath = "log");
|
static void writeError(const QString &info, bool needWrite = false, const QString &filePath = "log");
|
||||||
|
|
||||||
|
//设置边框阴影
|
||||||
|
static int shadowMargin;
|
||||||
|
static int shadowRadius;
|
||||||
|
static QString shadowColor;
|
||||||
|
static void setFormShadow(QWidget *widget, QLayout *layout,
|
||||||
|
const QString &color = shadowColor,
|
||||||
|
int margin = shadowMargin,
|
||||||
|
int radius = shadowRadius);
|
||||||
|
//立即更新所有阴影边框颜色比如换肤的时候需要用到
|
||||||
|
static void setFormShadow(const QString &color);
|
||||||
|
|
||||||
//设置无边框窗体
|
//设置无边框窗体
|
||||||
static void setFramelessForm(QWidget *widgetMain,
|
static void setFramelessForm(QWidget *widgetMain,
|
||||||
bool tool = false, bool top = false, bool menu = true);
|
bool tool = false, bool top = false, bool menu = true);
|
||||||
|
|
|
@ -44,7 +44,7 @@ void QUIInputBox::initControl()
|
||||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||||
|
|
||||||
widgetTitle = new QWidget(this);
|
widgetTitle = new QWidget(this);
|
||||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
sizePolicy.setVerticalStretch(0);
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
@ -57,7 +57,7 @@ void QUIInputBox::initControl()
|
||||||
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
labIco = new QLabel(widgetTitle);
|
labIco = new QLabel(widgetTitle);
|
||||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
|
@ -67,12 +67,12 @@ void QUIInputBox::initControl()
|
||||||
horizontalLayout1->addWidget(labIco);
|
horizontalLayout1->addWidget(labIco);
|
||||||
|
|
||||||
labTitle = new QLabel(widgetTitle);
|
labTitle = new QLabel(widgetTitle);
|
||||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
|
||||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
horizontalLayout1->addWidget(labTitle);
|
horizontalLayout1->addWidget(labTitle);
|
||||||
|
|
||||||
labCountDown = new QLabel(widgetTitle);
|
labCountDown = new QLabel(widgetTitle);
|
||||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
labCountDown->setObjectName(QString::fromUtf8("QUILabCountDown"));
|
||||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
sizePolicy2.setHorizontalStretch(0);
|
sizePolicy2.setHorizontalStretch(0);
|
||||||
sizePolicy2.setVerticalStretch(0);
|
sizePolicy2.setVerticalStretch(0);
|
||||||
|
@ -82,7 +82,7 @@ void QUIInputBox::initControl()
|
||||||
horizontalLayout1->addWidget(labCountDown);
|
horizontalLayout1->addWidget(labCountDown);
|
||||||
|
|
||||||
widgetMenu = new QWidget(widgetTitle);
|
widgetMenu = new QWidget(widgetTitle);
|
||||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
|
||||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||||
widgetMenu->setSizePolicy(sizePolicy1);
|
widgetMenu->setSizePolicy(sizePolicy1);
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ void QUIInputBox::initControl()
|
||||||
verticalLayout1->addWidget(widgetTitle);
|
verticalLayout1->addWidget(widgetTitle);
|
||||||
|
|
||||||
widgetMain = new QWidget(this);
|
widgetMain = new QWidget(this);
|
||||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
|
||||||
|
|
||||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||||
verticalLayout2->setSpacing(5);
|
verticalLayout2->setSpacing(5);
|
||||||
|
@ -115,12 +115,12 @@ void QUIInputBox::initControl()
|
||||||
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
||||||
|
|
||||||
frame = new QFrame(widgetMain);
|
frame = new QFrame(widgetMain);
|
||||||
frame->setObjectName(QString::fromUtf8("frame"));
|
frame->setObjectName(QString::fromUtf8("QUIFrame"));
|
||||||
frame->setFrameShape(QFrame::Box);
|
frame->setFrameShape(QFrame::Box);
|
||||||
frame->setFrameShadow(QFrame::Sunken);
|
frame->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
labInfo = new QLabel(frame);
|
labInfo = new QLabel(frame);
|
||||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
labInfo->setObjectName(QString::fromUtf8("QUILabInfo"));
|
||||||
labInfo->setScaledContents(false);
|
labInfo->setScaledContents(false);
|
||||||
labInfo->setWordWrap(true);
|
labInfo->setWordWrap(true);
|
||||||
|
|
||||||
|
@ -129,11 +129,11 @@ void QUIInputBox::initControl()
|
||||||
verticalLayout3->addWidget(labInfo);
|
verticalLayout3->addWidget(labInfo);
|
||||||
|
|
||||||
txtValue = new QLineEdit(frame);
|
txtValue = new QLineEdit(frame);
|
||||||
txtValue->setObjectName(QString::fromUtf8("txtValue"));
|
txtValue->setObjectName(QString::fromUtf8("QUITxtValue"));
|
||||||
verticalLayout3->addWidget(txtValue);
|
verticalLayout3->addWidget(txtValue);
|
||||||
|
|
||||||
cboxValue = new QComboBox(frame);
|
cboxValue = new QComboBox(frame);
|
||||||
cboxValue->setObjectName(QString::fromUtf8("cboxValue"));
|
cboxValue->setObjectName(QString::fromUtf8("QUICboxValue"));
|
||||||
verticalLayout3->addWidget(cboxValue);
|
verticalLayout3->addWidget(cboxValue);
|
||||||
|
|
||||||
lay = new QHBoxLayout();
|
lay = new QHBoxLayout();
|
||||||
|
@ -142,13 +142,13 @@ void QUIInputBox::initControl()
|
||||||
lay->addItem(horizontalSpacer);
|
lay->addItem(horizontalSpacer);
|
||||||
|
|
||||||
btnOk = new QPushButton(frame);
|
btnOk = new QPushButton(frame);
|
||||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
btnOk->setObjectName(QString::fromUtf8("QUIBtnOk"));
|
||||||
btnOk->setMinimumSize(QSize(85, 0));
|
btnOk->setMinimumSize(QSize(85, 0));
|
||||||
lay->addWidget(btnOk);
|
lay->addWidget(btnOk);
|
||||||
btnOk->setDefault(true);
|
btnOk->setDefault(true);
|
||||||
|
|
||||||
btnCancel = new QPushButton(frame);
|
btnCancel = new QPushButton(frame);
|
||||||
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
|
btnCancel->setObjectName(QString::fromUtf8("QUIBtnCancel"));
|
||||||
btnCancel->setMinimumSize(QSize(85, 0));
|
btnCancel->setMinimumSize(QSize(85, 0));
|
||||||
lay->addWidget(btnCancel);
|
lay->addWidget(btnCancel);
|
||||||
|
|
||||||
|
@ -170,10 +170,14 @@ void QUIInputBox::initControl()
|
||||||
|
|
||||||
void QUIInputBox::initForm()
|
void QUIInputBox::initForm()
|
||||||
{
|
{
|
||||||
|
//设置阴影
|
||||||
|
QUIHelper::setFormShadow(this, verticalLayout1);
|
||||||
|
//设置无边框
|
||||||
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
||||||
this->setWindowTitle(this->labTitle->text());
|
this->setWindowTitle(this->labTitle->text());
|
||||||
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight + 10);
|
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight + 10);
|
||||||
|
|
||||||
|
//按钮设置最小尺寸和图标大小
|
||||||
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
|
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
|
||||||
foreach (QPushButton *btn, btns) {
|
foreach (QPushButton *btn, btns) {
|
||||||
btn->setMinimumWidth(QUIBtnMinWidth);
|
btn->setMinimumWidth(QUIBtnMinWidth);
|
||||||
|
|
|
@ -74,7 +74,7 @@ void QUIMessageBox::initControl()
|
||||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||||
|
|
||||||
widgetTitle = new QWidget(this);
|
widgetTitle = new QWidget(this);
|
||||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
sizePolicy.setVerticalStretch(0);
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
@ -87,7 +87,7 @@ void QUIMessageBox::initControl()
|
||||||
horizontalLayout3->setContentsMargins(0, 0, 0, 0);
|
horizontalLayout3->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
labIco = new QLabel(widgetTitle);
|
labIco = new QLabel(widgetTitle);
|
||||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
|
@ -97,12 +97,12 @@ void QUIMessageBox::initControl()
|
||||||
horizontalLayout3->addWidget(labIco);
|
horizontalLayout3->addWidget(labIco);
|
||||||
|
|
||||||
labTitle = new QLabel(widgetTitle);
|
labTitle = new QLabel(widgetTitle);
|
||||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
|
||||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
horizontalLayout3->addWidget(labTitle);
|
horizontalLayout3->addWidget(labTitle);
|
||||||
|
|
||||||
labCountDown = new QLabel(widgetTitle);
|
labCountDown = new QLabel(widgetTitle);
|
||||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
labCountDown->setObjectName(QString::fromUtf8("QUILabCountDown"));
|
||||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
sizePolicy2.setHorizontalStretch(0);
|
sizePolicy2.setHorizontalStretch(0);
|
||||||
sizePolicy2.setVerticalStretch(0);
|
sizePolicy2.setVerticalStretch(0);
|
||||||
|
@ -112,7 +112,7 @@ void QUIMessageBox::initControl()
|
||||||
horizontalLayout3->addWidget(labCountDown);
|
horizontalLayout3->addWidget(labCountDown);
|
||||||
|
|
||||||
widgetMenu = new QWidget(widgetTitle);
|
widgetMenu = new QWidget(widgetTitle);
|
||||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
|
||||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||||
widgetMenu->setSizePolicy(sizePolicy1);
|
widgetMenu->setSizePolicy(sizePolicy1);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ void QUIMessageBox::initControl()
|
||||||
verticalLayout1->addWidget(widgetTitle);
|
verticalLayout1->addWidget(widgetTitle);
|
||||||
|
|
||||||
widgetMain = new QWidget(this);
|
widgetMain = new QWidget(this);
|
||||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
|
||||||
|
|
||||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||||
verticalLayout2->setSpacing(5);
|
verticalLayout2->setSpacing(5);
|
||||||
|
@ -145,12 +145,12 @@ void QUIMessageBox::initControl()
|
||||||
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
verticalLayout2->setContentsMargins(5, 5, 5, 5);
|
||||||
|
|
||||||
frame = new QFrame(widgetMain);
|
frame = new QFrame(widgetMain);
|
||||||
frame->setObjectName(QString::fromUtf8("frame"));
|
frame->setObjectName(QString::fromUtf8("QUIFrame"));
|
||||||
frame->setFrameShape(QFrame::Box);
|
frame->setFrameShape(QFrame::Box);
|
||||||
frame->setFrameShadow(QFrame::Sunken);
|
frame->setFrameShadow(QFrame::Sunken);
|
||||||
|
|
||||||
labIcoMain = new QLabel(frame);
|
labIcoMain = new QLabel(frame);
|
||||||
labIcoMain->setObjectName(QString::fromUtf8("labIcoMain"));
|
labIcoMain->setObjectName(QString::fromUtf8("QUILabIcoMain"));
|
||||||
labIcoMain->setAlignment(Qt::AlignCenter);
|
labIcoMain->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
verticalLayout4 = new QVBoxLayout(frame);
|
verticalLayout4 = new QVBoxLayout(frame);
|
||||||
|
@ -164,7 +164,7 @@ void QUIMessageBox::initControl()
|
||||||
horizontalLayout1->addItem(horizontalSpacer1);
|
horizontalLayout1->addItem(horizontalSpacer1);
|
||||||
|
|
||||||
labInfo = new QLabel(frame);
|
labInfo = new QLabel(frame);
|
||||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
labInfo->setObjectName(QString::fromUtf8("QUILabInfo"));
|
||||||
QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
sizePolicy4.setHorizontalStretch(0);
|
sizePolicy4.setHorizontalStretch(0);
|
||||||
sizePolicy4.setVerticalStretch(0);
|
sizePolicy4.setVerticalStretch(0);
|
||||||
|
@ -182,14 +182,14 @@ void QUIMessageBox::initControl()
|
||||||
horizontalLayout2->addItem(horizontalSpacer2);
|
horizontalLayout2->addItem(horizontalSpacer2);
|
||||||
|
|
||||||
btnOk = new QPushButton(frame);
|
btnOk = new QPushButton(frame);
|
||||||
btnOk->setObjectName(QString::fromUtf8("btnOk"));
|
btnOk->setObjectName(QString::fromUtf8("QUIBtnOk"));
|
||||||
btnOk->setMinimumSize(QSize(85, 0));
|
btnOk->setMinimumSize(QSize(85, 0));
|
||||||
btnOk->setFocusPolicy(Qt::StrongFocus);
|
btnOk->setFocusPolicy(Qt::StrongFocus);
|
||||||
horizontalLayout2->addWidget(btnOk);
|
horizontalLayout2->addWidget(btnOk);
|
||||||
btnOk->setDefault(true);
|
btnOk->setDefault(true);
|
||||||
|
|
||||||
btnCancel = new QPushButton(frame);
|
btnCancel = new QPushButton(frame);
|
||||||
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
|
btnCancel->setObjectName(QString::fromUtf8("QUIBtnCancel"));
|
||||||
btnCancel->setMinimumSize(QSize(85, 0));
|
btnCancel->setMinimumSize(QSize(85, 0));
|
||||||
btnCancel->setFocusPolicy(Qt::StrongFocus);
|
btnCancel->setFocusPolicy(Qt::StrongFocus);
|
||||||
horizontalLayout2->addWidget(btnCancel);
|
horizontalLayout2->addWidget(btnCancel);
|
||||||
|
@ -212,11 +212,15 @@ void QUIMessageBox::initControl()
|
||||||
|
|
||||||
void QUIMessageBox::initForm()
|
void QUIMessageBox::initForm()
|
||||||
{
|
{
|
||||||
|
//设置阴影
|
||||||
|
QUIHelper::setFormShadow(this, verticalLayout1);
|
||||||
|
//设置无边框
|
||||||
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
||||||
this->setWindowTitle(this->labTitle->text());
|
this->setWindowTitle(this->labTitle->text());
|
||||||
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
|
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
|
||||||
labIcoMain->setFixedSize(QUITitleMinSize, QUITitleMinSize);
|
labIcoMain->setFixedSize(QUITitleMinSize, QUITitleMinSize);
|
||||||
|
|
||||||
|
//按钮设置最小尺寸和图标大小
|
||||||
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
|
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
|
||||||
foreach (QPushButton *btn, btns) {
|
foreach (QPushButton *btn, btns) {
|
||||||
btn->setMinimumWidth(QUIBtnMinWidth);
|
btn->setMinimumWidth(QUIBtnMinWidth);
|
||||||
|
@ -226,6 +230,7 @@ void QUIMessageBox::initForm()
|
||||||
closeSec = 0;
|
closeSec = 0;
|
||||||
currentSec = 0;
|
currentSec = 0;
|
||||||
|
|
||||||
|
//倒计时定时器关闭窗体
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
timer->setInterval(1000);
|
timer->setInterval(1000);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(checkSec()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(checkSec()));
|
||||||
|
@ -300,11 +305,27 @@ void QUIMessageBox::setMessage(const QString &msg, int type, int closeSec)
|
||||||
|
|
||||||
this->labInfo->setText(msg);
|
this->labInfo->setText(msg);
|
||||||
this->setWindowTitle(this->labTitle->text());
|
this->setWindowTitle(this->labTitle->text());
|
||||||
|
|
||||||
|
//长度符合要求比如就两行只需要默认尺寸
|
||||||
|
bool normal = (msg.length() < 30);
|
||||||
|
//计算有多少个换行符
|
||||||
|
int count = 0;
|
||||||
|
foreach (QString s, msg) {
|
||||||
|
if (s == "\n") {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//如果包含换行超过1个则表示超过2行需要特殊布局尺寸
|
||||||
|
if (count > 1) {
|
||||||
|
normal = false;
|
||||||
|
}
|
||||||
|
|
||||||
//设置对话框的大小总以最合适的大小显示
|
//设置对话框的大小总以最合适的大小显示
|
||||||
if (msg.length() < 70) {
|
if (normal) {
|
||||||
this->layout()->setSizeConstraint(QLayout::SetMinimumSize);
|
this->layout()->setSizeConstraint(QLayout::SetMinimumSize);
|
||||||
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
|
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
|
||||||
} else {
|
} else {
|
||||||
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
|
//this->setFixedSize(labInfo->sizeHint() + QSize(100, 120));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,33 @@
|
||||||
#include "quistyle.h"
|
#include "quistyle.h"
|
||||||
|
|
||||||
|
bool QUIStyle::isDark1(const QString &styleName)
|
||||||
|
{
|
||||||
|
QStringList listDark;
|
||||||
|
listDark << "blackvideo" << "blackblue" << "darkblack" << "darkblue" << "flatblack" << "flatblue" << "purple";
|
||||||
|
bool dark = false;
|
||||||
|
foreach (QString list, listDark) {
|
||||||
|
if (styleName.contains(list)) {
|
||||||
|
dark = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QUIStyle::isDark2(const QString &styleName)
|
||||||
|
{
|
||||||
|
QStringList listDark;
|
||||||
|
listDark << "blackvideo" << "blackblue" << "darkblack" << "darkblue" << "purple";
|
||||||
|
bool dark = false;
|
||||||
|
foreach (QString list, listDark) {
|
||||||
|
if (styleName.contains(list)) {
|
||||||
|
dark = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dark;
|
||||||
|
}
|
||||||
|
|
||||||
void QUIStyle::getStyle(QStringList &styleNames, QStringList &styleFiles)
|
void QUIStyle::getStyle(QStringList &styleNames, QStringList &styleFiles)
|
||||||
{
|
{
|
||||||
static QStringList names;
|
static QStringList names;
|
||||||
|
@ -40,7 +68,13 @@ void QUIStyle::setStyle(const QString &qss)
|
||||||
list << "QTabBar::tab:right:selected,QTabBar::tab:right:hover{border-width:0px 2px 0px 0px;}";
|
list << "QTabBar::tab:right:selected,QTabBar::tab:right:hover{border-width:0px 2px 0px 0px;}";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//增加文本框只读背景颜色
|
||||||
|
list << QString("QLineEdit:read-only{background-color:#88%1;}").arg(QUIConfig::NormalColorStart.right(6));
|
||||||
|
|
||||||
QUIHelper::isCustomUI = true;
|
QUIHelper::isCustomUI = true;
|
||||||
|
//阴影边框和配色方案自动变化
|
||||||
|
QUIHelper::setFormShadow(QUIConfig::HighColor);
|
||||||
|
|
||||||
QString paletteColor = qss.mid(20, 7);
|
QString paletteColor = qss.mid(20, 7);
|
||||||
qApp->setPalette(QPalette(paletteColor));
|
qApp->setPalette(QPalette(paletteColor));
|
||||||
qApp->setStyleSheet(list.join(""));
|
qApp->setStyleSheet(list.join(""));
|
||||||
|
@ -125,6 +159,13 @@ void QUIStyle::getQssColor(const QString &qss, QString &textColor,
|
||||||
|
|
||||||
QUIHelper::isCustomUI = true;
|
QUIHelper::isCustomUI = true;
|
||||||
QUIConfig::TextColor = textColor;
|
QUIConfig::TextColor = textColor;
|
||||||
|
QUIConfig::PanelColor = panelColor;
|
||||||
|
QUIConfig::BorderColor = borderColor;
|
||||||
|
QUIConfig::NormalColorStart = normalColorStart;
|
||||||
|
QUIConfig::NormalColorEnd = normalColorEnd;
|
||||||
|
QUIConfig::DarkColorStart = darkColorStart;
|
||||||
|
QUIConfig::DarkColorEnd = darkColorEnd;
|
||||||
|
QUIConfig::HighColor = highColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QUIStyle::setLabStyle(QLabel *lab, quint8 type, const QString &bgColor, const QString &textColor)
|
void QUIStyle::setLabStyle(QLabel *lab, quint8 type, const QString &bgColor, const QString &textColor)
|
||||||
|
|
|
@ -27,6 +27,10 @@ public:
|
||||||
Style_BlackVideo = 16 //视频监控黑色样式
|
Style_BlackVideo = 16 //视频监控黑色样式
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//获取是否是加深样式
|
||||||
|
static bool isDark1(const QString &styleName);
|
||||||
|
static bool isDark2(const QString &styleName);
|
||||||
|
|
||||||
//获取皮肤样式中文名称和对应的样式表文件
|
//获取皮肤样式中文名称和对应的样式表文件
|
||||||
static void getStyle(QStringList &styleNames, QStringList &styleFiles);
|
static void getStyle(QStringList &styleNames, QStringList &styleFiles);
|
||||||
//设置全局样式
|
//设置全局样式
|
||||||
|
|
|
@ -71,7 +71,7 @@ void QUITipBox::initControl()
|
||||||
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
verticalLayout->setContentsMargins(1, 1, 1, 1);
|
||||||
|
|
||||||
widgetTitle = new QWidget(this);
|
widgetTitle = new QWidget(this);
|
||||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
sizePolicy.setVerticalStretch(0);
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
@ -84,17 +84,17 @@ void QUITipBox::initControl()
|
||||||
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
|
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
labIco = new QLabel(widgetTitle);
|
labIco = new QLabel(widgetTitle);
|
||||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
|
||||||
labIco->setAlignment(Qt::AlignCenter);
|
labIco->setAlignment(Qt::AlignCenter);
|
||||||
horizontalLayout2->addWidget(labIco);
|
horizontalLayout2->addWidget(labIco);
|
||||||
|
|
||||||
labTitle = new QLabel(widgetTitle);
|
labTitle = new QLabel(widgetTitle);
|
||||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
|
||||||
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
horizontalLayout2->addWidget(labTitle);
|
horizontalLayout2->addWidget(labTitle);
|
||||||
|
|
||||||
labCountDown = new QLabel(widgetTitle);
|
labCountDown = new QLabel(widgetTitle);
|
||||||
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
|
labCountDown->setObjectName(QString::fromUtf8("QUILabCountDown"));
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
|
@ -104,7 +104,7 @@ void QUITipBox::initControl()
|
||||||
horizontalLayout2->addWidget(labCountDown);
|
horizontalLayout2->addWidget(labCountDown);
|
||||||
|
|
||||||
widgetMenu = new QWidget(widgetTitle);
|
widgetMenu = new QWidget(widgetTitle);
|
||||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
|
||||||
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
sizePolicy2.setHorizontalStretch(0);
|
sizePolicy2.setHorizontalStretch(0);
|
||||||
sizePolicy2.setVerticalStretch(0);
|
sizePolicy2.setVerticalStretch(0);
|
||||||
|
@ -132,11 +132,11 @@ void QUITipBox::initControl()
|
||||||
verticalLayout->addWidget(widgetTitle);
|
verticalLayout->addWidget(widgetTitle);
|
||||||
|
|
||||||
widgetMain = new QWidget(this);
|
widgetMain = new QWidget(this);
|
||||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
|
||||||
widgetMain->setAutoFillBackground(true);
|
widgetMain->setAutoFillBackground(true);
|
||||||
|
|
||||||
labInfo = new QLabel(widgetMain);
|
labInfo = new QLabel(widgetMain);
|
||||||
labInfo->setObjectName(QString::fromUtf8("labInfo"));
|
labInfo->setObjectName(QString::fromUtf8("QUILabInfo"));
|
||||||
labInfo->setScaledContents(true);
|
labInfo->setScaledContents(true);
|
||||||
labInfo->setWordWrap(true);
|
labInfo->setWordWrap(true);
|
||||||
|
|
||||||
|
@ -150,6 +150,9 @@ void QUITipBox::initControl()
|
||||||
|
|
||||||
void QUITipBox::initForm()
|
void QUITipBox::initForm()
|
||||||
{
|
{
|
||||||
|
//设置阴影
|
||||||
|
QUIHelper::setFormShadow(this, verticalLayout);
|
||||||
|
//设置无边框
|
||||||
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
|
||||||
this->setWindowTitle(this->labTitle->text());
|
this->setWindowTitle(this->labTitle->text());
|
||||||
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
|
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
|
||||||
|
@ -157,6 +160,7 @@ void QUITipBox::initForm()
|
||||||
closeSec = 0;
|
closeSec = 0;
|
||||||
currentSec = 0;
|
currentSec = 0;
|
||||||
|
|
||||||
|
//关闭倒计时定时器
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
timer->setInterval(1000);
|
timer->setInterval(1000);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(checkSec()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(checkSec()));
|
||||||
|
@ -216,6 +220,7 @@ void QUITipBox::setTip(const QString &title, const QString &tip, bool fullScreen
|
||||||
this->labInfo->setAlignment(center ? Qt::AlignCenter : Qt::AlignLeft);
|
this->labInfo->setAlignment(center ? Qt::AlignCenter : Qt::AlignLeft);
|
||||||
this->setWindowTitle(this->labTitle->text());
|
this->setWindowTitle(this->labTitle->text());
|
||||||
|
|
||||||
|
//计算屏幕尺寸
|
||||||
QRect rect = QUIHelper::getScreenRect(!fullScreen);
|
QRect rect = QUIHelper::getScreenRect(!fullScreen);
|
||||||
int width = rect.width();
|
int width = rect.width();
|
||||||
int height = rect.height();
|
int height = rect.height();
|
||||||
|
|
|
@ -110,14 +110,14 @@ void QUIWidget::initControl()
|
||||||
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
|
||||||
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
verticalLayout1->setContentsMargins(1, 1, 1, 1);
|
||||||
widgetMain = new QWidget(this);
|
widgetMain = new QWidget(this);
|
||||||
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
|
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
|
||||||
verticalLayout2 = new QVBoxLayout(widgetMain);
|
verticalLayout2 = new QVBoxLayout(widgetMain);
|
||||||
verticalLayout2->setSpacing(0);
|
verticalLayout2->setSpacing(0);
|
||||||
verticalLayout2->setContentsMargins(11, 11, 11, 11);
|
verticalLayout2->setContentsMargins(11, 11, 11, 11);
|
||||||
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
|
||||||
verticalLayout2->setContentsMargins(0, 0, 0, 0);
|
verticalLayout2->setContentsMargins(0, 0, 0, 0);
|
||||||
widgetTitle = new QWidget(widgetMain);
|
widgetTitle = new QWidget(widgetMain);
|
||||||
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
|
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
sizePolicy.setVerticalStretch(0);
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
@ -131,7 +131,7 @@ void QUIWidget::initControl()
|
||||||
horizontalLayout4->setContentsMargins(0, 0, 0, 0);
|
horizontalLayout4->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
labIco = new QLabel(widgetTitle);
|
labIco = new QLabel(widgetTitle);
|
||||||
labIco->setObjectName(QString::fromUtf8("labIco"));
|
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
|
@ -142,7 +142,7 @@ void QUIWidget::initControl()
|
||||||
horizontalLayout4->addWidget(labIco);
|
horizontalLayout4->addWidget(labIco);
|
||||||
|
|
||||||
labTitle = new QLabel(widgetTitle);
|
labTitle = new QLabel(widgetTitle);
|
||||||
labTitle->setObjectName(QString::fromUtf8("labTitle"));
|
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
|
||||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
sizePolicy2.setHorizontalStretch(0);
|
sizePolicy2.setHorizontalStretch(0);
|
||||||
sizePolicy2.setVerticalStretch(0);
|
sizePolicy2.setVerticalStretch(0);
|
||||||
|
@ -152,7 +152,7 @@ void QUIWidget::initControl()
|
||||||
horizontalLayout4->addWidget(labTitle);
|
horizontalLayout4->addWidget(labTitle);
|
||||||
|
|
||||||
widgetMenu = new QWidget(widgetTitle);
|
widgetMenu = new QWidget(widgetTitle);
|
||||||
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
|
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
|
||||||
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
|
||||||
widgetMenu->setSizePolicy(sizePolicy1);
|
widgetMenu->setSizePolicy(sizePolicy1);
|
||||||
horizontalLayout = new QHBoxLayout(widgetMenu);
|
horizontalLayout = new QHBoxLayout(widgetMenu);
|
||||||
|
@ -233,8 +233,11 @@ void QUIWidget::initForm()
|
||||||
setIcon(QUIWidget::BtnMenu_Normal, QUIConfig::IconNormal);
|
setIcon(QUIWidget::BtnMenu_Normal, QUIConfig::IconNormal);
|
||||||
setIcon(QUIWidget::BtnMenu_Close, QUIConfig::IconClose);
|
setIcon(QUIWidget::BtnMenu_Close, QUIConfig::IconClose);
|
||||||
|
|
||||||
|
//设置阴影
|
||||||
|
//QUIHelper::setFormShadow(this, verticalLayout1);
|
||||||
|
//设置无边框
|
||||||
|
QUIHelper::setFramelessForm(this);
|
||||||
this->widgetTitle->setProperty("form", "title");
|
this->widgetTitle->setProperty("form", "title");
|
||||||
QUIHelper::setFramelessForm(this, false, false, false);
|
|
||||||
|
|
||||||
//设置标题及对齐方式
|
//设置标题及对齐方式
|
||||||
title = "QUI Demo";
|
title = "QUI Demo";
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>image/qt_zh_CN.qm</file>
|
|
||||||
<file>image/widgets.qm</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>image/fontawesome-webfont.ttf</file>
|
|
||||||
<file>image/iconfont.ttf</file>
|
|
||||||
<file>image/pe-icon-set-weather.ttf</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>500</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "qfileinfo.h"
|
#include "qfileinfo.h"
|
||||||
#include "qdir.h"
|
#include "qdir.h"
|
||||||
#include "qprogressbar.h"
|
#include "qprogressbar.h"
|
||||||
|
#include "qtimer.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -52,7 +53,8 @@ DeviceSizeTable::DeviceSizeTable(QWidget *parent) : QTableWidget(parent)
|
||||||
this->setSelectionMode(QAbstractItemView::SingleSelection);
|
this->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
this->verticalHeader()->setVisible(true);
|
this->verticalHeader()->setVisible(true);
|
||||||
this->horizontalHeader()->setStretchLastSection(true);
|
this->horizontalHeader()->setStretchLastSection(true);
|
||||||
QMetaObject::invokeMethod(this, "load");
|
//QMetaObject::invokeMethod(this, "load");
|
||||||
|
QTimer::singleShot(10, this, SLOT(load()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor DeviceSizeTable::getBgColor() const
|
QColor DeviceSizeTable::getBgColor() const
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
|
|
||||||
frmDeviceSizeTable::frmDeviceSizeTable(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceSizeTable)
|
frmDeviceSizeTable::frmDeviceSizeTable(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceSizeTable)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->tableWidget->verticalHeader()->setDefaultSectionSize(25);
|
||||||
}
|
}
|
||||||
|
|
||||||
frmDeviceSizeTable::~frmDeviceSizeTable()
|
frmDeviceSizeTable::~frmDeviceSizeTable()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,21 +3,20 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui {
|
||||||
{
|
|
||||||
class frmDeviceSizeTable;
|
class frmDeviceSizeTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
class frmDeviceSizeTable : public QWidget
|
class frmDeviceSizeTable : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit frmDeviceSizeTable(QWidget *parent = 0);
|
explicit frmDeviceSizeTable(QWidget *parent = 0);
|
||||||
~frmDeviceSizeTable();
|
~frmDeviceSizeTable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::frmDeviceSizeTable *ui;
|
Ui::frmDeviceSizeTable *ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRMDEVICESIZETABLE_H
|
#endif // FRMDEVICESIZETABLE_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>800</width>
|
||||||
<height>300</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -9,7 +9,7 @@ int main(int argc, char *argv[])
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setFont(QFont("Microsoft Yahei", 9));
|
a.setFont(QFont("Microsoft Yahei", 9));
|
||||||
|
|
||||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||||
#else
|
#else
|
||||||
|
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frmDeviceSizeTable w;
|
frmDeviceSizeTable w;
|
||||||
w.setWindowTitle("本地存储空间大小控件");
|
w.setWindowTitle("磁盘容量");
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
|
@ -68,17 +68,17 @@ void FFmpegThread::initlib()
|
||||||
|
|
||||||
bool FFmpegThread::init()
|
bool FFmpegThread::init()
|
||||||
{
|
{
|
||||||
//在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等
|
// //在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等
|
||||||
//设置缓存大小,1080p可将值调大
|
// //设置缓存大小,1080p可将值调大
|
||||||
av_dict_set(&options, "buffer_size", "8192000", 0);
|
// av_dict_set(&options, "buffer_size", "8192000", 0);
|
||||||
//以tcp方式打开,如果以udp方式打开将tcp替换为udp
|
// //以tcp方式打开,如果以udp方式打开将tcp替换为udp
|
||||||
av_dict_set(&options, "rtsp_transport", "tcp", 0);
|
// av_dict_set(&options, "rtsp_transport", "tcp", 0);
|
||||||
//设置超时断开连接时间,单位微秒,3000000表示3秒
|
// //设置超时断开连接时间,单位微秒,3000000表示3秒
|
||||||
av_dict_set(&options, "stimeout", "3000000", 0);
|
// av_dict_set(&options, "stimeout", "3000000", 0);
|
||||||
//设置最大时延,单位微秒,1000000表示1秒
|
// //设置最大时延,单位微秒,1000000表示1秒
|
||||||
av_dict_set(&options, "max_delay", "1000000", 0);
|
// av_dict_set(&options, "max_delay", "1000000", 0);
|
||||||
//自动开启线程数
|
// //自动开启线程数
|
||||||
av_dict_set(&options, "threads", "auto", 0);
|
// av_dict_set(&options, "threads", "auto", 0);
|
||||||
|
|
||||||
//打开视频流
|
//打开视频流
|
||||||
avFormatContext = avformat_alloc_context();
|
avFormatContext = avformat_alloc_context();
|
||||||
|
@ -239,7 +239,9 @@ void FFmpegThread::run()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (av_read_frame(avFormatContext, avPacket) >= 0) {
|
frameFinish = av_read_frame(avFormatContext, avPacket);
|
||||||
|
qDebug() << TIMEMS << frameFinish;
|
||||||
|
if (frameFinish >= 0) {
|
||||||
//判断当前包是视频还是音频
|
//判断当前包是视频还是音频
|
||||||
int index = avPacket->stream_index;
|
int index = avPacket->stream_index;
|
||||||
if (index == videoStreamIndex) {
|
if (index == videoStreamIndex) {
|
||||||
|
@ -252,7 +254,7 @@ void FFmpegThread::run()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
frameFinish = avcodec_receive_frame(videoCodec, avFrame2);
|
frameFinish = avcodec_receive_frame(videoCodec, avFrame2);
|
||||||
if (frameFinish < 0) {
|
if (frameFinish < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
||||||
|
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
||||||
urls << "rtsp://admin:Admin123456@192.168.1.64:554/Streaming/Channels/102?transportmode=unicast&profile=Profile_2";
|
urls << "rtsp://admin:Admin123456@192.168.0.64:554/Streaming/Channels/102?transportmode=unicast&profile=Profile_2";
|
||||||
urls << "rtsp://192.168.1.108:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif";
|
urls << "rtsp://192.168.1.108:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif";
|
||||||
urls << "rtsp://192.168.1.15:554/media/video1";
|
urls << "rtsp://192.168.1.15:554/media/video1";
|
||||||
urls << "rtsp://192.168.1.15:554/media/video2";
|
urls << "rtsp://192.168.1.15:554/media/video2";
|
||||||
urls << "rtsp://192.168.1.247:554/av0_0";
|
urls << "rtsp://192.168.1.247:554/av0_0";
|
||||||
urls << "rtsp://192.168.1.247:554/av0_1";
|
urls << "rtsp://192.168.1.247:554/av0_1";
|
||||||
ui->cboxUrl->addItems(urls);
|
ui->cboxUrl->addItems(urls);
|
||||||
ui->cboxUrl->setCurrentIndex(5);
|
ui->cboxUrl->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::~Widget()
|
Widget::~Widget()
|
||||||
|
|
|
@ -19,9 +19,9 @@ void frmImageSwitch::initForm()
|
||||||
ui->imageSwitch1->setChecked(true);
|
ui->imageSwitch1->setChecked(true);
|
||||||
ui->imageSwitch2->setChecked(true);
|
ui->imageSwitch2->setChecked(true);
|
||||||
ui->imageSwitch3->setChecked(true);
|
ui->imageSwitch3->setChecked(true);
|
||||||
ui->imageSwitch1->setFixedSize(87, 28);
|
ui->imageSwitch1->setFixedSize(87, 30);
|
||||||
ui->imageSwitch2->setFixedSize(87, 28);
|
ui->imageSwitch2->setFixedSize(87, 30);
|
||||||
ui->imageSwitch3->setFixedSize(87, 28);
|
ui->imageSwitch3->setFixedSize(87, 30);
|
||||||
ui->imageSwitch1->setButtonStyle(ImageSwitch::ButtonStyle_1);
|
ui->imageSwitch1->setButtonStyle(ImageSwitch::ButtonStyle_1);
|
||||||
ui->imageSwitch2->setButtonStyle(ImageSwitch::ButtonStyle_2);
|
ui->imageSwitch2->setButtonStyle(ImageSwitch::ButtonStyle_2);
|
||||||
ui->imageSwitch3->setButtonStyle(ImageSwitch::ButtonStyle_3);
|
ui->imageSwitch3->setButtonStyle(ImageSwitch::ButtonStyle_3);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>800</width>
|
||||||
<height>300</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -9,7 +9,7 @@ int main(int argc, char *argv[])
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setFont(QFont("Microsoft Yahei", 9));
|
a.setFont(QFont("Microsoft Yahei", 9));
|
||||||
|
|
||||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -3,26 +3,25 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui {
|
||||||
{
|
|
||||||
class frmLightButton;
|
class frmLightButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
class frmLightButton : public QWidget
|
class frmLightButton : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit frmLightButton(QWidget *parent = 0);
|
explicit frmLightButton(QWidget *parent = 0);
|
||||||
~frmLightButton();
|
~frmLightButton();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::frmLightButton *ui;
|
Ui::frmLightButton *ui;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initForm();
|
void initForm();
|
||||||
void updateValue();
|
void updateValue();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRMLIGHTBUTTON_H
|
#endif // FRMLIGHTBUTTON_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>800</width>
|
||||||
<height>300</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -9,7 +9,7 @@ int main(int argc, char *argv[])
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setFont(QFont("Microsoft Yahei", 9));
|
a.setFont(QFont("Microsoft Yahei", 9));
|
||||||
|
|
||||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>800</width>
|
||||||
<height>500</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -15,7 +15,7 @@ LunarCalendarWidget::LunarCalendarWidget(QWidget *parent) : QWidget(parent)
|
||||||
//判断图形字体是否存在,不存在则加入
|
//判断图形字体是否存在,不存在则加入
|
||||||
QFontDatabase fontDb;
|
QFontDatabase fontDb;
|
||||||
if (!fontDb.families().contains("FontAwesome")) {
|
if (!fontDb.families().contains("FontAwesome")) {
|
||||||
int fontId = fontDb.addApplicationFont(":/image/fontawesome-webfont.ttf");
|
int fontId = fontDb.addApplicationFont(":/font/fontawesome-webfont.ttf");
|
||||||
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
||||||
if (fontName.count() == 0) {
|
if (fontName.count() == 0) {
|
||||||
qDebug() << "load fontawesome-webfont.ttf error";
|
qDebug() << "load fontawesome-webfont.ttf error";
|
||||||
|
|
|
@ -9,7 +9,7 @@ int main(int argc, char *argv[])
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
a.setFont(QFont("Microsoft Yahei", 9));
|
a.setFont(QFont("Microsoft Yahei", 9));
|
||||||
|
|
||||||
#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||||
#else
|
#else
|
||||||
|
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frmLunarCalendarWidget w;
|
frmLunarCalendarWidget w;
|
||||||
w.setWindowTitle("自定义农历控件");
|
w.setWindowTitle("农历控件");
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>image/bg_calendar.png</file>
|
<file>image/bg_calendar.png</file>
|
||||||
<file>image/fontawesome-webfont.ttf</file>
|
<file>font/fontawesome-webfont.ttf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -181,14 +181,14 @@ void frmNavButton::initBtn4()
|
||||||
NavButton *btn = btns4.at(i);
|
NavButton *btn = btns4.at(i);
|
||||||
btn->setLineSpace(10);
|
btn->setLineSpace(10);
|
||||||
btn->setLineWidth(10);
|
btn->setLineWidth(10);
|
||||||
btn->setPaddingRight(25);
|
btn->setPaddingRight(35);
|
||||||
btn->setShowTriangle(true);
|
btn->setShowTriangle(true);
|
||||||
btn->setTextAlign(NavButton::TextAlign_Right);
|
btn->setTextAlign(NavButton::TextAlign_Right);
|
||||||
btn->setTrianglePosition(NavButton::TrianglePosition_Left);
|
btn->setTrianglePosition(NavButton::TrianglePosition_Left);
|
||||||
btn->setLinePosition(NavButton::LinePosition_Right);
|
btn->setLinePosition(NavButton::LinePosition_Right);
|
||||||
|
|
||||||
btn->setShowIcon(true);
|
btn->setShowIcon(true);
|
||||||
btn->setIconSpace(10);
|
btn->setIconSpace(20);
|
||||||
btn->setIconSize(QSize(15, 15));
|
btn->setIconSize(QSize(15, 15));
|
||||||
btn->setIconNormal(iconNormal);
|
btn->setIconNormal(iconNormal);
|
||||||
btn->setIconHover(iconHover);
|
btn->setIconHover(iconHover);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>11</x>
|
<x>11</x>
|
||||||
<y>245</y>
|
<y>245</y>
|
||||||
<width>611</width>
|
<width>511</width>
|
||||||
<height>40</height>
|
<height>40</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -11,13 +11,13 @@ void IconHelper::initFont()
|
||||||
if (!isInit) {
|
if (!isInit) {
|
||||||
isInit = true;
|
isInit = true;
|
||||||
if (iconFontAliBaBa == 0) {
|
if (iconFontAliBaBa == 0) {
|
||||||
iconFontAliBaBa = new IconHelper(":/image/iconfont.ttf", "iconfont");
|
iconFontAliBaBa = new IconHelper(":/font/iconfont.ttf", "iconfont");
|
||||||
}
|
}
|
||||||
if (iconFontAwesome == 0) {
|
if (iconFontAwesome == 0) {
|
||||||
iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome");
|
iconFontAwesome = new IconHelper(":/font/fontawesome-webfont.ttf", "FontAwesome");
|
||||||
}
|
}
|
||||||
if (iconFontWeather == 0) {
|
if (iconFontWeather == 0) {
|
||||||
iconFontWeather = new IconHelper(":/image/pe-icon-set-weather.ttf", "pe-icon-set-weather");
|
iconFontWeather = new IconHelper(":/font/pe-icon-set-weather.ttf", "pe-icon-set-weather");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>image/fontawesome-webfont.ttf</file>
|
<file>font/fontawesome-webfont.ttf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab1">
|
<widget class="QWidget" name="tab1">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -76,27 +76,35 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QListWidget" name="listWidget1"/>
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labListenPort1">
|
||||||
|
<property name="text">
|
||||||
|
<string>监听端口</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtListenPort1"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLineEdit" name="txtListenPort1"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="btnClear1">
|
|
||||||
<property name="text">
|
|
||||||
<string>清空</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="btnListen1">
|
<widget class="QPushButton" name="btnListen1">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>监听</string>
|
<string>监听</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3">
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="btnClear1">
|
||||||
|
<property name="text">
|
||||||
|
<string>清空</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="labCount1">
|
<widget class="QLabel" name="labCount1">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -118,6 +126,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QListWidget" name="listWidget1"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -155,7 +166,7 @@
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -168,27 +179,35 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1">
|
<item row="0" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labListenPort2">
|
||||||
|
<property name="text">
|
||||||
|
<string>监听端口</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtListenPort2"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="btnListen2">
|
<widget class="QPushButton" name="btnListen2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>监听</string>
|
<string>监听</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="1" column="1">
|
||||||
<widget class="QLineEdit" name="txtListenPort2"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="btnClear2">
|
<widget class="QPushButton" name="btnClear2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>清空</string>
|
<string>清空</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="3">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QListWidget" name="listWidget2"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="3">
|
|
||||||
<widget class="QLabel" name="labCount2">
|
<widget class="QLabel" name="labCount2">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
|
@ -210,6 +229,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QListWidget" name="listWidget2"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -5,11 +5,11 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
||||||
TARGET = netserver
|
TARGET = netserver
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
DESTDIR = $$PWD/../bin
|
DESTDIR = $$PWD/../bin
|
||||||
RC_FILE = other/main.rc
|
RC_FILE = qrc/main.rc
|
||||||
|
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
HEADERS += head.h
|
HEADERS += head.h
|
||||||
RESOURCES += other/main.qrc
|
RESOURCES += qrc/main.qrc
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
INCLUDEPATH += $$PWD/api
|
INCLUDEPATH += $$PWD/api
|
||||||
|
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
|
@ -11,17 +11,17 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
||||||
|
|
||||||
TARGET = nettool
|
TARGET = nettool
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
RC_FILE = other/main.rc
|
RC_FILE = qrc/main.rc
|
||||||
wasm {
|
wasm {
|
||||||
DEFINES += emsdk
|
DEFINES += emsdk
|
||||||
RESOURCES += other/font.qrc
|
RESOURCES += qrc/font.qrc
|
||||||
} else {
|
} else {
|
||||||
DESTDIR = $$PWD/../bin
|
DESTDIR = $$PWD/../bin
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
HEADERS += head.h
|
HEADERS += head.h
|
||||||
RESOURCES += other/main.qrc
|
RESOURCES += qrc/main.qrc
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
INCLUDEPATH += $$PWD/api
|
INCLUDEPATH += $$PWD/api
|
||||||
|
|
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
|
@ -183,11 +183,11 @@ void frmMain::initTranslator()
|
||||||
{
|
{
|
||||||
//加载鼠标右键菜单翻译文件
|
//加载鼠标右键菜单翻译文件
|
||||||
QTranslator *translator1 = new QTranslator(qApp);
|
QTranslator *translator1 = new QTranslator(qApp);
|
||||||
translator1->load(":/image/qt_zh_CN.qm");
|
translator1->load(":/qm/qt_zh_CN.qm");
|
||||||
qApp->installTranslator(translator1);
|
qApp->installTranslator(translator1);
|
||||||
|
|
||||||
//加载富文本框鼠标右键菜单翻译文件
|
//加载富文本框鼠标右键菜单翻译文件
|
||||||
QTranslator *translator2 = new QTranslator(qApp);
|
QTranslator *translator2 = new QTranslator(qApp);
|
||||||
translator2->load(":/image/widgets.qm");
|
translator2->load(":/qm/widgets.qm");
|
||||||
qApp->installTranslator(translator2);
|
qApp->installTranslator(translator2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>font/fontawesome-webfont.ttf</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
Before Width: | Height: | Size: 968 KiB After Width: | Height: | Size: 968 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
@ -2,11 +2,8 @@
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>image/btn_close.png</file>
|
<file>image/btn_close.png</file>
|
||||||
<file>image/btn_ok.png</file>
|
<file>image/btn_ok.png</file>
|
||||||
<file>image/fontawesome-webfont.ttf</file>
|
|
||||||
<file>image/msg_error.png</file>
|
<file>image/msg_error.png</file>
|
||||||
<file>image/msg_info.png</file>
|
<file>image/msg_info.png</file>
|
||||||
<file>image/msg_question.png</file>
|
<file>image/msg_question.png</file>
|
||||||
<file>image/qt_zh_CN.qm</file>
|
|
||||||
<file>image/widgets.qm</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>qm/qt_zh_CN.qm</file>
|
||||||
|
<file>qm/widgets.qm</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -68,6 +68,10 @@ border:1px solid #575959;
|
||||||
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1 #F6F6F6);
|
background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #F6F6F6,stop:1 #F6F6F6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLineEdit:read-only{
|
||||||
|
background-color:#E4E4E4;
|
||||||
|
}
|
||||||
|
|
||||||
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
|
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
|
||||||
border:1px solid #B6B6B6;
|
border:1px solid #B6B6B6;
|
||||||
border-radius:3px;
|
border-radius:3px;
|
||||||
|
@ -643,7 +647,7 @@ QTabWidget::pane:bottom{bottom:-1px;}
|
||||||
QTabWidget::pane:left{right:-1px;}
|
QTabWidget::pane:left{right:-1px;}
|
||||||
QTabWidget::pane:right{left:-1px;}
|
QTabWidget::pane:right{left:-1px;}
|
||||||
|
|
||||||
QDialog,QDial{
|
QDialog,QDial,#QUIWidgetMain{
|
||||||
background-color:#FFFFFF;
|
background-color:#FFFFFF;
|
||||||
color:#57595B;
|
color:#57595B;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +664,7 @@ QToolBar>*,QStatusBar>*{
|
||||||
margin:2px;
|
margin:2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
*:disabled,QMenu::item:disabled{
|
*:disabled,QMenu::item:disabled,QTabBar:tab:disabled,QHeaderView::section:disabled{
|
||||||
background:#FFFFFF;
|
background:#FFFFFF;
|
||||||
border-color:#E4E4E4;
|
border-color:#E4E4E4;
|
||||||
color:#B6B6B6;
|
color:#B6B6B6;
|
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 337 B |
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 360 B |
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 361 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 655 B After Width: | Height: | Size: 655 B |
Before Width: | Height: | Size: 740 B After Width: | Height: | Size: 740 B |
Before Width: | Height: | Size: 616 B After Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 612 B |
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |