更新代码

master
feiyangqingyun 2021-11-03 14:13:56 +08:00
parent 39bab16731
commit fdcaff2b21
150 changed files with 387 additions and 186 deletions

View File

@ -3,21 +3,20 @@
#include <QWidget>
namespace Ui
{
namespace Ui {
class frmBattery;
}
class frmBattery : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit frmBattery(QWidget *parent = 0);
~frmBattery();
explicit frmBattery(QWidget *parent = 0);
~frmBattery();
private:
Ui::frmBattery *ui;
Ui::frmBattery *ui;
private slots:
void initForm();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>300</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -9,7 +9,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
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
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else

View File

@ -5,11 +5,11 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = comtool
TEMPLATE = app
DESTDIR = $$PWD/../bin
RC_FILE = other/main.rc
RC_FILE = qrc/main.rc
SOURCES += main.cpp
HEADERS += head.h
RESOURCES += other/main.qrc
RESOURCES += qrc/main.qrc
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/api

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -43,5 +43,5 @@ SOURCES += \
$$PWD/quitipbox.cpp \
$$PWD/quiwidget.cpp
RESOURCES += $$PWD/resource/qm.qrc
RESOURCES += $$PWD/resource/ttf.qrc
RESOURCES += $$PWD/qrc/qm.qrc
RESOURCES += $$PWD/qrc/font.qrc

View File

@ -11,13 +11,13 @@ void IconHelper::initFont()
if (!isInit) {
isInit = true;
if (iconFontAliBaBa == 0) {
iconFontAliBaBa = new IconHelper(":/image/iconfont.ttf", "iconfont");
iconFontAliBaBa = new IconHelper(":/font/iconfont.ttf", "iconfont");
}
if (iconFontAwesome == 0) {
iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome");
iconFontAwesome = new IconHelper(":/font/fontawesome-webfont.ttf", "FontAwesome");
}
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");
}
}
}

7
core_qui/qrc/font.qrc Normal file
View File

@ -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>

6
core_qui/qrc/qm.qrc Normal file
View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qm/qt_zh_CN.qm</file>
<file>qm/widgets.qm</file>
</qresource>
</RCC>

View File

@ -68,7 +68,7 @@ void QUIDateSelect::initControl()
verticalLayout->setContentsMargins(1, 1, 1, 1);
widgetTitle = new QWidget(this);
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
@ -81,7 +81,7 @@ void QUIDateSelect::initControl()
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
labIco = new QLabel(widgetTitle);
labIco->setObjectName(QString::fromUtf8("labIco"));
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
@ -91,7 +91,7 @@ void QUIDateSelect::initControl()
horizontalLayout1->addWidget(labIco);
labTitle = new QLabel(widgetTitle);
labTitle->setObjectName(QString::fromUtf8("labTitle"));
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
@ -101,7 +101,7 @@ void QUIDateSelect::initControl()
horizontalLayout1->addWidget(labTitle);
widgetMenu = new QWidget(widgetTitle);
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
widgetMenu->setSizePolicy(sizePolicy1);
@ -126,7 +126,7 @@ void QUIDateSelect::initControl()
verticalLayout->addWidget(widgetTitle);
widgetMain = new QWidget(this);
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
verticalLayout1 = new QVBoxLayout(widgetMain);
verticalLayout1->setSpacing(6);
@ -134,19 +134,19 @@ void QUIDateSelect::initControl()
verticalLayout1->setContentsMargins(6, 6, 6, 6);
frame = new QFrame(widgetMain);
frame->setObjectName(QString::fromUtf8("frame"));
frame->setObjectName(QString::fromUtf8("QUIFrame"));
frame->setFrameShape(QFrame::Box);
frame->setFrameShadow(QFrame::Sunken);
gridLayout = new QGridLayout(frame);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
labStart = new QLabel(frame);
labStart->setObjectName(QString::fromUtf8("labStart"));
labStart->setObjectName(QString::fromUtf8("QUILabStart"));
labStart->setFocusPolicy(Qt::TabFocus);
gridLayout->addWidget(labStart, 0, 0, 1, 1);
btnOk = new QPushButton(frame);
btnOk->setObjectName(QString::fromUtf8("btnOk"));
btnOk->setObjectName(QString::fromUtf8("QUIBtnOk"));
btnOk->setMinimumSize(QSize(85, 0));
btnOk->setCursor(QCursor(Qt::PointingHandCursor));
btnOk->setFocusPolicy(Qt::StrongFocus);
@ -154,19 +154,19 @@ void QUIDateSelect::initControl()
btnOk->setDefault(true);
labEnd = new QLabel(frame);
labEnd->setObjectName(QString::fromUtf8("labEnd"));
labEnd->setObjectName(QString::fromUtf8("QUILabEnd"));
labEnd->setFocusPolicy(Qt::TabFocus);
gridLayout->addWidget(labEnd, 1, 0, 1, 1);
btnClose = new QPushButton(frame);
btnClose->setObjectName(QString::fromUtf8("btnClose"));
btnClose->setObjectName(QString::fromUtf8("QUIBtnClose"));
btnClose->setMinimumSize(QSize(85, 0));
btnClose->setCursor(QCursor(Qt::PointingHandCursor));
btnClose->setFocusPolicy(Qt::StrongFocus);
gridLayout->addWidget(btnClose, 1, 2, 1, 1);
dateStart = new QDateTimeEdit(frame);
dateStart->setObjectName(QString::fromUtf8("dateStart"));
dateStart->setObjectName(QString::fromUtf8("QUIDateStart"));
QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Fixed);
sizePolicy4.setHorizontalStretch(0);
sizePolicy4.setVerticalStretch(0);
@ -176,7 +176,7 @@ void QUIDateSelect::initControl()
gridLayout->addWidget(dateStart, 0, 1, 1, 1);
dateEnd = new QDateTimeEdit(frame);
dateEnd->setObjectName(QString::fromUtf8("dateEnd"));
dateEnd->setObjectName(QString::fromUtf8("QUIDateEnd"));
sizePolicy4.setHeightForWidth(dateEnd->sizePolicy().hasHeightForWidth());
dateEnd->setSizePolicy(sizePolicy4);
dateEnd->setCalendarPopup(true);
@ -213,10 +213,14 @@ void QUIDateSelect::initControl()
void QUIDateSelect::initForm()
{
//设置阴影
QUIHelper::setFormShadow(this, verticalLayout);
//设置无边框
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
this->setWindowTitle(this->labTitle->text());
this->setFixedSize(QUIDialogMinWidth + 50, QUIDialogMinHeight);
//按钮设置最小尺寸和图标大小
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
foreach (QPushButton *btn, btns) {
btn->setMinimumWidth(QUIBtnMinWidth);

View File

@ -296,6 +296,64 @@ void QUIHelper::writeError(const QString &info, bool needWrite, const QString &f
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)
{
widgetMain->setProperty("form", true);
@ -314,7 +372,10 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, bool tool, bool top, bool
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::WindowStaysOnTopHint);
}
if (menu) {
//如果是其他系统比如neokylin会产生系统边框
#ifdef Q_OS_WIN
widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
#endif
}
}
@ -1255,7 +1316,7 @@ int QUIHelper::showMessageBoxQuestion(const QString &info)
{
if (isCustomUI) {
QUIMessageBox msg;
msg.setMessage(info, 1);
msg.setMessage(info, 1);msg.update();
return msg.exec();
} else {
QMessageBox box(QMessageBox::Question, "询问", info);

View File

@ -32,10 +32,10 @@ public:
//设置编码
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);
//设置翻译文件
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);
@ -52,6 +52,17 @@ public:
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 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,
bool tool = false, bool top = false, bool menu = true);

View File

@ -44,7 +44,7 @@ void QUIInputBox::initControl()
verticalLayout1->setContentsMargins(1, 1, 1, 1);
widgetTitle = new QWidget(this);
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
@ -57,7 +57,7 @@ void QUIInputBox::initControl()
horizontalLayout1->setContentsMargins(0, 0, 0, 0);
labIco = new QLabel(widgetTitle);
labIco->setObjectName(QString::fromUtf8("labIco"));
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
@ -67,12 +67,12 @@ void QUIInputBox::initControl()
horizontalLayout1->addWidget(labIco);
labTitle = new QLabel(widgetTitle);
labTitle->setObjectName(QString::fromUtf8("labTitle"));
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
horizontalLayout1->addWidget(labTitle);
labCountDown = new QLabel(widgetTitle);
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
labCountDown->setObjectName(QString::fromUtf8("QUILabCountDown"));
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
@ -82,7 +82,7 @@ void QUIInputBox::initControl()
horizontalLayout1->addWidget(labCountDown);
widgetMenu = new QWidget(widgetTitle);
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
widgetMenu->setSizePolicy(sizePolicy1);
@ -107,7 +107,7 @@ void QUIInputBox::initControl()
verticalLayout1->addWidget(widgetTitle);
widgetMain = new QWidget(this);
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
verticalLayout2 = new QVBoxLayout(widgetMain);
verticalLayout2->setSpacing(5);
@ -115,12 +115,12 @@ void QUIInputBox::initControl()
verticalLayout2->setContentsMargins(5, 5, 5, 5);
frame = new QFrame(widgetMain);
frame->setObjectName(QString::fromUtf8("frame"));
frame->setObjectName(QString::fromUtf8("QUIFrame"));
frame->setFrameShape(QFrame::Box);
frame->setFrameShadow(QFrame::Sunken);
labInfo = new QLabel(frame);
labInfo->setObjectName(QString::fromUtf8("labInfo"));
labInfo->setObjectName(QString::fromUtf8("QUILabInfo"));
labInfo->setScaledContents(false);
labInfo->setWordWrap(true);
@ -129,11 +129,11 @@ void QUIInputBox::initControl()
verticalLayout3->addWidget(labInfo);
txtValue = new QLineEdit(frame);
txtValue->setObjectName(QString::fromUtf8("txtValue"));
txtValue->setObjectName(QString::fromUtf8("QUITxtValue"));
verticalLayout3->addWidget(txtValue);
cboxValue = new QComboBox(frame);
cboxValue->setObjectName(QString::fromUtf8("cboxValue"));
cboxValue->setObjectName(QString::fromUtf8("QUICboxValue"));
verticalLayout3->addWidget(cboxValue);
lay = new QHBoxLayout();
@ -142,13 +142,13 @@ void QUIInputBox::initControl()
lay->addItem(horizontalSpacer);
btnOk = new QPushButton(frame);
btnOk->setObjectName(QString::fromUtf8("btnOk"));
btnOk->setObjectName(QString::fromUtf8("QUIBtnOk"));
btnOk->setMinimumSize(QSize(85, 0));
lay->addWidget(btnOk);
btnOk->setDefault(true);
btnCancel = new QPushButton(frame);
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
btnCancel->setObjectName(QString::fromUtf8("QUIBtnCancel"));
btnCancel->setMinimumSize(QSize(85, 0));
lay->addWidget(btnCancel);
@ -170,10 +170,14 @@ void QUIInputBox::initControl()
void QUIInputBox::initForm()
{
//设置阴影
QUIHelper::setFormShadow(this, verticalLayout1);
//设置无边框
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
this->setWindowTitle(this->labTitle->text());
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight + 10);
//按钮设置最小尺寸和图标大小
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
foreach (QPushButton *btn, btns) {
btn->setMinimumWidth(QUIBtnMinWidth);

View File

@ -74,7 +74,7 @@ void QUIMessageBox::initControl()
verticalLayout1->setContentsMargins(1, 1, 1, 1);
widgetTitle = new QWidget(this);
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
@ -87,7 +87,7 @@ void QUIMessageBox::initControl()
horizontalLayout3->setContentsMargins(0, 0, 0, 0);
labIco = new QLabel(widgetTitle);
labIco->setObjectName(QString::fromUtf8("labIco"));
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
@ -97,12 +97,12 @@ void QUIMessageBox::initControl()
horizontalLayout3->addWidget(labIco);
labTitle = new QLabel(widgetTitle);
labTitle->setObjectName(QString::fromUtf8("labTitle"));
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
horizontalLayout3->addWidget(labTitle);
labCountDown = new QLabel(widgetTitle);
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
labCountDown->setObjectName(QString::fromUtf8("QUILabCountDown"));
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
@ -112,7 +112,7 @@ void QUIMessageBox::initControl()
horizontalLayout3->addWidget(labCountDown);
widgetMenu = new QWidget(widgetTitle);
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
widgetMenu->setSizePolicy(sizePolicy1);
@ -137,7 +137,7 @@ void QUIMessageBox::initControl()
verticalLayout1->addWidget(widgetTitle);
widgetMain = new QWidget(this);
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
verticalLayout2 = new QVBoxLayout(widgetMain);
verticalLayout2->setSpacing(5);
@ -145,12 +145,12 @@ void QUIMessageBox::initControl()
verticalLayout2->setContentsMargins(5, 5, 5, 5);
frame = new QFrame(widgetMain);
frame->setObjectName(QString::fromUtf8("frame"));
frame->setObjectName(QString::fromUtf8("QUIFrame"));
frame->setFrameShape(QFrame::Box);
frame->setFrameShadow(QFrame::Sunken);
labIcoMain = new QLabel(frame);
labIcoMain->setObjectName(QString::fromUtf8("labIcoMain"));
labIcoMain->setObjectName(QString::fromUtf8("QUILabIcoMain"));
labIcoMain->setAlignment(Qt::AlignCenter);
verticalLayout4 = new QVBoxLayout(frame);
@ -164,7 +164,7 @@ void QUIMessageBox::initControl()
horizontalLayout1->addItem(horizontalSpacer1);
labInfo = new QLabel(frame);
labInfo->setObjectName(QString::fromUtf8("labInfo"));
labInfo->setObjectName(QString::fromUtf8("QUILabInfo"));
QSizePolicy sizePolicy4(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy4.setHorizontalStretch(0);
sizePolicy4.setVerticalStretch(0);
@ -182,14 +182,14 @@ void QUIMessageBox::initControl()
horizontalLayout2->addItem(horizontalSpacer2);
btnOk = new QPushButton(frame);
btnOk->setObjectName(QString::fromUtf8("btnOk"));
btnOk->setObjectName(QString::fromUtf8("QUIBtnOk"));
btnOk->setMinimumSize(QSize(85, 0));
btnOk->setFocusPolicy(Qt::StrongFocus);
horizontalLayout2->addWidget(btnOk);
btnOk->setDefault(true);
btnCancel = new QPushButton(frame);
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
btnCancel->setObjectName(QString::fromUtf8("QUIBtnCancel"));
btnCancel->setMinimumSize(QSize(85, 0));
btnCancel->setFocusPolicy(Qt::StrongFocus);
horizontalLayout2->addWidget(btnCancel);
@ -212,11 +212,15 @@ void QUIMessageBox::initControl()
void QUIMessageBox::initForm()
{
//设置阴影
QUIHelper::setFormShadow(this, verticalLayout1);
//设置无边框
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
this->setWindowTitle(this->labTitle->text());
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
labIcoMain->setFixedSize(QUITitleMinSize, QUITitleMinSize);
//按钮设置最小尺寸和图标大小
QList<QPushButton *> btns = this->frame->findChildren<QPushButton *>();
foreach (QPushButton *btn, btns) {
btn->setMinimumWidth(QUIBtnMinWidth);
@ -226,6 +230,7 @@ void QUIMessageBox::initForm()
closeSec = 0;
currentSec = 0;
//倒计时定时器关闭窗体
QTimer *timer = new QTimer(this);
timer->setInterval(1000);
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->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->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
} else {
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
//this->setFixedSize(labInfo->sizeHint() + QSize(100, 120));
}
}

View File

@ -1,5 +1,33 @@
#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)
{
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;}";
#endif
//增加文本框只读背景颜色
list << QString("QLineEdit:read-only{background-color:#88%1;}").arg(QUIConfig::NormalColorStart.right(6));
QUIHelper::isCustomUI = true;
//阴影边框和配色方案自动变化
QUIHelper::setFormShadow(QUIConfig::HighColor);
QString paletteColor = qss.mid(20, 7);
qApp->setPalette(QPalette(paletteColor));
qApp->setStyleSheet(list.join(""));
@ -125,6 +159,13 @@ void QUIStyle::getQssColor(const QString &qss, QString &textColor,
QUIHelper::isCustomUI = true;
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)

View File

@ -27,6 +27,10 @@ public:
Style_BlackVideo = 16 //视频监控黑色样式
};
//获取是否是加深样式
static bool isDark1(const QString &styleName);
static bool isDark2(const QString &styleName);
//获取皮肤样式中文名称和对应的样式表文件
static void getStyle(QStringList &styleNames, QStringList &styleFiles);
//设置全局样式

View File

@ -71,7 +71,7 @@ void QUITipBox::initControl()
verticalLayout->setContentsMargins(1, 1, 1, 1);
widgetTitle = new QWidget(this);
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
@ -84,17 +84,17 @@ void QUITipBox::initControl()
horizontalLayout2->setContentsMargins(0, 0, 0, 0);
labIco = new QLabel(widgetTitle);
labIco->setObjectName(QString::fromUtf8("labIco"));
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
labIco->setAlignment(Qt::AlignCenter);
horizontalLayout2->addWidget(labIco);
labTitle = new QLabel(widgetTitle);
labTitle->setObjectName(QString::fromUtf8("labTitle"));
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
labTitle->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
horizontalLayout2->addWidget(labTitle);
labCountDown = new QLabel(widgetTitle);
labCountDown->setObjectName(QString::fromUtf8("labCountDown"));
labCountDown->setObjectName(QString::fromUtf8("QUILabCountDown"));
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
@ -104,7 +104,7 @@ void QUITipBox::initControl()
horizontalLayout2->addWidget(labCountDown);
widgetMenu = new QWidget(widgetTitle);
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
@ -132,11 +132,11 @@ void QUITipBox::initControl()
verticalLayout->addWidget(widgetTitle);
widgetMain = new QWidget(this);
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
widgetMain->setAutoFillBackground(true);
labInfo = new QLabel(widgetMain);
labInfo->setObjectName(QString::fromUtf8("labInfo"));
labInfo->setObjectName(QString::fromUtf8("QUILabInfo"));
labInfo->setScaledContents(true);
labInfo->setWordWrap(true);
@ -150,6 +150,9 @@ void QUITipBox::initControl()
void QUITipBox::initForm()
{
//设置阴影
QUIHelper::setFormShadow(this, verticalLayout);
//设置无边框
QUIHelper::setFramelessForm(this, widgetTitle, labIco, btnMenu_Close);
this->setWindowTitle(this->labTitle->text());
this->setFixedSize(QUIDialogMinWidth, QUIDialogMinHeight);
@ -157,6 +160,7 @@ void QUITipBox::initForm()
closeSec = 0;
currentSec = 0;
//关闭倒计时定时器
QTimer *timer = new QTimer(this);
timer->setInterval(1000);
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->setWindowTitle(this->labTitle->text());
//计算屏幕尺寸
QRect rect = QUIHelper::getScreenRect(!fullScreen);
int width = rect.width();
int height = rect.height();

View File

@ -110,14 +110,14 @@ void QUIWidget::initControl()
verticalLayout1->setObjectName(QString::fromUtf8("verticalLayout1"));
verticalLayout1->setContentsMargins(1, 1, 1, 1);
widgetMain = new QWidget(this);
widgetMain->setObjectName(QString::fromUtf8("widgetMainQUI"));
widgetMain->setObjectName(QString::fromUtf8("QUIWidgetMain"));
verticalLayout2 = new QVBoxLayout(widgetMain);
verticalLayout2->setSpacing(0);
verticalLayout2->setContentsMargins(11, 11, 11, 11);
verticalLayout2->setObjectName(QString::fromUtf8("verticalLayout2"));
verticalLayout2->setContentsMargins(0, 0, 0, 0);
widgetTitle = new QWidget(widgetMain);
widgetTitle->setObjectName(QString::fromUtf8("widgetTitle"));
widgetTitle->setObjectName(QString::fromUtf8("QUIWidgetTitle"));
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
@ -131,7 +131,7 @@ void QUIWidget::initControl()
horizontalLayout4->setContentsMargins(0, 0, 0, 0);
labIco = new QLabel(widgetTitle);
labIco->setObjectName(QString::fromUtf8("labIco"));
labIco->setObjectName(QString::fromUtf8("QUILabIco"));
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
@ -142,7 +142,7 @@ void QUIWidget::initControl()
horizontalLayout4->addWidget(labIco);
labTitle = new QLabel(widgetTitle);
labTitle->setObjectName(QString::fromUtf8("labTitle"));
labTitle->setObjectName(QString::fromUtf8("QUILabTitle"));
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
@ -152,7 +152,7 @@ void QUIWidget::initControl()
horizontalLayout4->addWidget(labTitle);
widgetMenu = new QWidget(widgetTitle);
widgetMenu->setObjectName(QString::fromUtf8("widgetMenu"));
widgetMenu->setObjectName(QString::fromUtf8("QUIWidgetMenu"));
sizePolicy1.setHeightForWidth(widgetMenu->sizePolicy().hasHeightForWidth());
widgetMenu->setSizePolicy(sizePolicy1);
horizontalLayout = new QHBoxLayout(widgetMenu);
@ -233,8 +233,11 @@ void QUIWidget::initForm()
setIcon(QUIWidget::BtnMenu_Normal, QUIConfig::IconNormal);
setIcon(QUIWidget::BtnMenu_Close, QUIConfig::IconClose);
//设置阴影
//QUIHelper::setFormShadow(this, verticalLayout1);
//设置无边框
QUIHelper::setFramelessForm(this);
this->widgetTitle->setProperty("form", "title");
QUIHelper::setFramelessForm(this, false, false, false);
//设置标题及对齐方式
title = "QUI Demo";

View File

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/">
<file>image/qt_zh_CN.qm</file>
<file>image/widgets.qm</file>
</qresource>
</RCC>

View File

@ -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>

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>500</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -7,6 +7,7 @@
#include "qfileinfo.h"
#include "qdir.h"
#include "qprogressbar.h"
#include "qtimer.h"
#include "qdebug.h"
#ifdef Q_OS_WIN
@ -52,7 +53,8 @@ DeviceSizeTable::DeviceSizeTable(QWidget *parent) : QTableWidget(parent)
this->setSelectionMode(QAbstractItemView::SingleSelection);
this->verticalHeader()->setVisible(true);
this->horizontalHeader()->setStretchLastSection(true);
QMetaObject::invokeMethod(this, "load");
//QMetaObject::invokeMethod(this, "load");
QTimer::singleShot(10, this, SLOT(load()));
}
QColor DeviceSizeTable::getBgColor() const

View File

@ -5,10 +5,11 @@
frmDeviceSizeTable::frmDeviceSizeTable(QWidget *parent) : QWidget(parent), ui(new Ui::frmDeviceSizeTable)
{
ui->setupUi(this);
ui->setupUi(this);
ui->tableWidget->verticalHeader()->setDefaultSectionSize(25);
}
frmDeviceSizeTable::~frmDeviceSizeTable()
{
delete ui;
delete ui;
}

View File

@ -3,21 +3,20 @@
#include <QWidget>
namespace Ui
{
namespace Ui {
class frmDeviceSizeTable;
}
class frmDeviceSizeTable : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit frmDeviceSizeTable(QWidget *parent = 0);
~frmDeviceSizeTable();
explicit frmDeviceSizeTable(QWidget *parent = 0);
~frmDeviceSizeTable();
private:
Ui::frmDeviceSizeTable *ui;
Ui::frmDeviceSizeTable *ui;
};
#endif // FRMDEVICESIZETABLE_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>300</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -9,7 +9,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
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
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
#endif
frmDeviceSizeTable w;
w.setWindowTitle("本地存储空间大小控件");
w.setWindowTitle("磁盘容量");
w.show();
return a.exec();

View File

@ -68,17 +68,17 @@ void FFmpegThread::initlib()
bool FFmpegThread::init()
{
//在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等
//设置缓存大小,1080p可将值调大
av_dict_set(&options, "buffer_size", "8192000", 0);
//以tcp方式打开,如果以udp方式打开将tcp替换为udp
av_dict_set(&options, "rtsp_transport", "tcp", 0);
//设置超时断开连接时间,单位微秒,3000000表示3秒
av_dict_set(&options, "stimeout", "3000000", 0);
//设置最大时延,单位微秒,1000000表示1秒
av_dict_set(&options, "max_delay", "1000000", 0);
//自动开启线程数
av_dict_set(&options, "threads", "auto", 0);
// //在打开码流前指定各种参数比如:探测时间/超时时间/最大延时等
// //设置缓存大小,1080p可将值调大
// av_dict_set(&options, "buffer_size", "8192000", 0);
// //以tcp方式打开,如果以udp方式打开将tcp替换为udp
// av_dict_set(&options, "rtsp_transport", "tcp", 0);
// //设置超时断开连接时间,单位微秒,3000000表示3秒
// av_dict_set(&options, "stimeout", "3000000", 0);
// //设置最大时延,单位微秒,1000000表示1秒
// av_dict_set(&options, "max_delay", "1000000", 0);
// //自动开启线程数
// av_dict_set(&options, "threads", "auto", 0);
//打开视频流
avFormatContext = avformat_alloc_context();
@ -239,7 +239,9 @@ void FFmpegThread::run()
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;
if (index == videoStreamIndex) {

View File

@ -8,14 +8,14 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
QStringList urls;
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.15:554/media/video1";
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_1";
ui->cboxUrl->addItems(urls);
ui->cboxUrl->setCurrentIndex(5);
ui->cboxUrl->setCurrentIndex(1);
}
Widget::~Widget()

View File

@ -19,9 +19,9 @@ void frmImageSwitch::initForm()
ui->imageSwitch1->setChecked(true);
ui->imageSwitch2->setChecked(true);
ui->imageSwitch3->setChecked(true);
ui->imageSwitch1->setFixedSize(87, 28);
ui->imageSwitch2->setFixedSize(87, 28);
ui->imageSwitch3->setFixedSize(87, 28);
ui->imageSwitch1->setFixedSize(87, 30);
ui->imageSwitch2->setFixedSize(87, 30);
ui->imageSwitch3->setFixedSize(87, 30);
ui->imageSwitch1->setButtonStyle(ImageSwitch::ButtonStyle_1);
ui->imageSwitch2->setButtonStyle(ImageSwitch::ButtonStyle_2);
ui->imageSwitch3->setButtonStyle(ImageSwitch::ButtonStyle_3);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>300</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -9,7 +9,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
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
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else

View File

@ -3,26 +3,25 @@
#include <QWidget>
namespace Ui
{
namespace Ui {
class frmLightButton;
}
class frmLightButton : public QWidget
{
Q_OBJECT
Q_OBJECT
public:
explicit frmLightButton(QWidget *parent = 0);
~frmLightButton();
explicit frmLightButton(QWidget *parent = 0);
~frmLightButton();
private:
Ui::frmLightButton *ui;
int type;
Ui::frmLightButton *ui;
int type;
private slots:
void initForm();
void updateValue();
void initForm();
void updateValue();
};
#endif // FRMLIGHTBUTTON_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>300</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -9,7 +9,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
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
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>500</height>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -15,7 +15,7 @@ LunarCalendarWidget::LunarCalendarWidget(QWidget *parent) : QWidget(parent)
//判断图形字体是否存在,不存在则加入
QFontDatabase fontDb;
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);
if (fontName.count() == 0) {
qDebug() << "load fontawesome-webfont.ttf error";

View File

@ -9,7 +9,7 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
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
QTextCodec *codec = QTextCodec::codecForName("gbk");
#else
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
#endif
frmLunarCalendarWidget w;
w.setWindowTitle("自定义农历控件");
w.setWindowTitle("农历控件");
w.show();
return a.exec();

View File

@ -1,6 +1,6 @@
<RCC>
<qresource prefix="/">
<file>image/bg_calendar.png</file>
<file>image/fontawesome-webfont.ttf</file>
<file>font/fontawesome-webfont.ttf</file>
</qresource>
</RCC>

View File

@ -181,14 +181,14 @@ void frmNavButton::initBtn4()
NavButton *btn = btns4.at(i);
btn->setLineSpace(10);
btn->setLineWidth(10);
btn->setPaddingRight(25);
btn->setPaddingRight(35);
btn->setShowTriangle(true);
btn->setTextAlign(NavButton::TextAlign_Right);
btn->setTrianglePosition(NavButton::TrianglePosition_Left);
btn->setLinePosition(NavButton::LinePosition_Right);
btn->setShowIcon(true);
btn->setIconSpace(10);
btn->setIconSpace(20);
btn->setIconSize(QSize(15, 15));
btn->setIconNormal(iconNormal);
btn->setIconHover(iconHover);

View File

@ -18,7 +18,7 @@
<rect>
<x>11</x>
<y>245</y>
<width>611</width>
<width>511</width>
<height>40</height>
</rect>
</property>

View File

@ -11,13 +11,13 @@ void IconHelper::initFont()
if (!isInit) {
isInit = true;
if (iconFontAliBaBa == 0) {
iconFontAliBaBa = new IconHelper(":/image/iconfont.ttf", "iconfont");
iconFontAliBaBa = new IconHelper(":/font/iconfont.ttf", "iconfont");
}
if (iconFontAwesome == 0) {
iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome");
iconFontAwesome = new IconHelper(":/font/fontawesome-webfont.ttf", "FontAwesome");
}
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");
}
}
}

View File

@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/">
<file>image/fontawesome-webfont.ttf</file>
<file>font/fontawesome-webfont.ttf</file>
</qresource>
</RCC>

View File

@ -29,7 +29,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab1">
<attribute name="title">
@ -63,7 +63,7 @@
<height>16777215</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
@ -76,27 +76,35 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="2" column="0" colspan="3">
<widget class="QListWidget" name="listWidget1"/>
<item row="0" column="0" colspan="2">
<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 row="0" 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">
<item row="1" column="0">
<widget class="QPushButton" name="btnListen1">
<property name="text">
<string>监听</string>
</property>
</widget>
</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">
<property name="minimumSize">
<size>
@ -118,6 +126,9 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QListWidget" name="listWidget1"/>
</item>
</layout>
</widget>
</item>
@ -155,7 +166,7 @@
<height>16777215</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
@ -168,27 +179,35 @@
<property name="bottomMargin">
<number>0</number>
</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">
<property name="text">
<string>监听</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="txtListenPort2"/>
</item>
<item row="0" column="2">
<item row="1" column="1">
<widget class="QPushButton" name="btnClear2">
<property name="text">
<string>清空</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QListWidget" name="listWidget2"/>
</item>
<item row="1" column="0" colspan="3">
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="labCount2">
<property name="minimumSize">
<size>
@ -210,6 +229,9 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QListWidget" name="listWidget2"/>
</item>
</layout>
</widget>
</item>

View File

@ -5,11 +5,11 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = netserver
TEMPLATE = app
DESTDIR = $$PWD/../bin
RC_FILE = other/main.rc
RC_FILE = qrc/main.rc
SOURCES += main.cpp
HEADERS += head.h
RESOURCES += other/main.qrc
RESOURCES += qrc/main.qrc
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/api

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -11,17 +11,17 @@ greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
TARGET = nettool
TEMPLATE = app
RC_FILE = other/main.rc
RC_FILE = qrc/main.rc
wasm {
DEFINES += emsdk
RESOURCES += other/font.qrc
RESOURCES += qrc/font.qrc
} else {
DESTDIR = $$PWD/../bin
}
SOURCES += main.cpp
HEADERS += head.h
RESOURCES += other/main.qrc
RESOURCES += qrc/main.qrc
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/api

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

@ -183,11 +183,11 @@ void frmMain::initTranslator()
{
//加载鼠标右键菜单翻译文件
QTranslator *translator1 = new QTranslator(qApp);
translator1->load(":/image/qt_zh_CN.qm");
translator1->load(":/qm/qt_zh_CN.qm");
qApp->installTranslator(translator1);
//加载富文本框鼠标右键菜单翻译文件
QTranslator *translator2 = new QTranslator(qApp);
translator2->load(":/image/widgets.qm");
translator2->load(":/qm/widgets.qm");
qApp->installTranslator(translator2);
}

5
styledemo/qrc/font.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>font/fontawesome-webfont.ttf</file>
</qresource>
</RCC>

View File

Before

Width:  |  Height:  |  Size: 968 KiB

After

Width:  |  Height:  |  Size: 968 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -2,11 +2,8 @@
<qresource prefix="/">
<file>image/btn_close.png</file>
<file>image/btn_ok.png</file>
<file>image/fontawesome-webfont.ttf</file>
<file>image/msg_error.png</file>
<file>image/msg_info.png</file>
<file>image/msg_question.png</file>
<file>image/qt_zh_CN.qm</file>
<file>image/widgets.qm</file>
</qresource>
</RCC>

6
styledemo/qrc/qm.qrc Normal file
View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qm/qt_zh_CN.qm</file>
<file>qm/widgets.qm</file>
</qresource>
</RCC>

View File

@ -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);
}
QLineEdit:read-only{
background-color:#E4E4E4;
}
QLineEdit,QTextEdit,QPlainTextEdit,QSpinBox,QDoubleSpinBox,QComboBox,QDateEdit,QTimeEdit,QDateTimeEdit{
border:1px solid #B6B6B6;
border-radius:3px;
@ -643,7 +647,7 @@ QTabWidget::pane:bottom{bottom:-1px;}
QTabWidget::pane:left{right:-1px;}
QTabWidget::pane:right{left:-1px;}
QDialog,QDial{
QDialog,QDial,#QUIWidgetMain{
background-color:#FFFFFF;
color:#57595B;
}
@ -660,7 +664,7 @@ QToolBar>*,QStatusBar>*{
margin:2px;
}
*:disabled,QMenu::item:disabled{
*:disabled,QMenu::item:disabled,QTabBar:tab:disabled,QHeaderView::section:disabled{
background:#FFFFFF;
border-color:#E4E4E4;
color:#B6B6B6;

View File

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 336 B

View File

Before

Width:  |  Height:  |  Size: 370 B

After

Width:  |  Height:  |  Size: 370 B

View File

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 358 B

View File

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

View File

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 337 B

View File

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 376 B

View File

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

View File

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 361 B

View File

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

View File

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 444 B

View File

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

View File

Before

Width:  |  Height:  |  Size: 740 B

After

Width:  |  Height:  |  Size: 740 B

View File

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 616 B

View File

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 639 B

View File

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 341 B

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 612 B

View File

Before

Width:  |  Height:  |  Size: 646 B

After

Width:  |  Height:  |  Size: 646 B

View File

Before

Width:  |  Height:  |  Size: 542 B

After

Width:  |  Height:  |  Size: 542 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More