更新代码
parent
bccc16b269
commit
62c05a76d7
|
@ -20,12 +20,12 @@ void EmailAddress::setAddress(const QString &address)
|
||||||
this->address = address;
|
this->address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString EmailAddress::getName() const
|
const QString &EmailAddress::getName() const
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString EmailAddress::getAddress() const
|
const QString &EmailAddress::getAddress() const
|
||||||
{
|
{
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ class EmailAddress : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit EmailAddress();
|
EmailAddress();
|
||||||
EmailAddress(const QString &address, const QString &name = "");
|
EmailAddress(const QString &address, const QString &name = "");
|
||||||
|
|
||||||
~EmailAddress();
|
~EmailAddress();
|
||||||
|
@ -16,8 +16,8 @@ public:
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
void setAddress(const QString &address);
|
void setAddress(const QString &address);
|
||||||
|
|
||||||
const QString getName() const;
|
const QString &getName() const;
|
||||||
const QString getAddress() const;
|
const QString &getAddress() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString name;
|
QString name;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
#include "mimemessage.h"
|
#include "mimemessage.h"
|
||||||
|
|
|
@ -14,7 +14,7 @@ SUBDIRS += devicesizetable #硬盘容量控件
|
||||||
SUBDIRS += styledemo #高仿PS黑色+扁平白色+淡蓝色风格主题
|
SUBDIRS += styledemo #高仿PS黑色+扁平白色+淡蓝色风格主题
|
||||||
SUBDIRS += navbutton #导航按钮控件
|
SUBDIRS += navbutton #导航按钮控件
|
||||||
SUBDIRS += videopanel #视频监控画面分割demo
|
SUBDIRS += videopanel #视频监控画面分割demo
|
||||||
SUBDIRS += framelesswidget #通用无边框拖动拉伸类
|
SUBDIRS += framelesswidget #跨平台无边框窗体
|
||||||
SUBDIRS += ipaddress #IP地址输入控件
|
SUBDIRS += ipaddress #IP地址输入控件
|
||||||
SUBDIRS += bgdemo #无边框背景透明窗体
|
SUBDIRS += bgdemo #无边框背景透明窗体
|
||||||
SUBDIRS += dbpage #通用数据库翻页查询
|
SUBDIRS += dbpage #通用数据库翻页查询
|
||||||
|
@ -35,9 +35,8 @@ SUBDIRS += videowidget #通用视频控件
|
||||||
SUBDIRS += screenwidget #屏幕截图控件
|
SUBDIRS += screenwidget #屏幕截图控件
|
||||||
SUBDIRS += imageswitch #图片开关控件
|
SUBDIRS += imageswitch #图片开关控件
|
||||||
SUBDIRS += netserver #网络中转服务器
|
SUBDIRS += netserver #网络中转服务器
|
||||||
SUBDIRS += base64 #图片文字base64互换
|
SUBDIRS += base64helper #图片文字base64互换
|
||||||
SUBDIRS += smoothcurve #平滑曲线
|
SUBDIRS += smoothcurve #平滑曲线
|
||||||
SUBDIRS += frameless #跨平台无边框窗体
|
|
||||||
|
|
||||||
#限定windows系统加载下面的项目
|
#限定windows系统加载下面的项目
|
||||||
win32 {
|
win32 {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#### 一、目录说明
|
#### 一、目录说明
|
||||||
1. **可以选择打开QWidgetDemo.pro一次性编译所有的,也可以进入到目录下打开pro进行编译。**
|
1. **可以选择打开QWidgetDemo.pro一次性编译所有的,也可以进入到目录下打开pro进行编译。**
|
||||||
2. **如果发现有些子项目没有加载请打开QWidgetDemo.pro仔细看里面的注释。**
|
2. **如果发现有些子项目没有加载请打开QWidgetDemo.pro仔细看里面的注释。**
|
||||||
3. **编译好的可执行文件在源码同级目录下的bin目录。**
|
3. **编译好的可执行文件在源码同级目录下的bin目录。**
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
| 9 | styledemo | 高仿PS黑色+扁平白色+淡蓝色风格主题 |
|
| 9 | styledemo | 高仿PS黑色+扁平白色+淡蓝色风格主题 |
|
||||||
| 10 | navbutton | 导航按钮控件 |
|
| 10 | navbutton | 导航按钮控件 |
|
||||||
| 11 | videopanel | 视频监控画面分割demo |
|
| 11 | videopanel | 视频监控画面分割demo |
|
||||||
| 12 | framelesswidget | 通用无边框拖动拉伸类 |
|
| 12 | framelesswidget | 跨平台无边框窗体 |
|
||||||
| 13 | ipaddress | IP地址输入控件 |
|
| 13 | ipaddress | IP地址输入控件 |
|
||||||
| 14 | bgdemo | 无边框背景透明窗体 |
|
| 14 | bgdemo | 无边框背景透明窗体 |
|
||||||
| 15 | dbpage | 通用数据库翻页查询 |
|
| 15 | dbpage | 通用数据库翻页查询 |
|
||||||
|
@ -49,7 +49,6 @@
|
||||||
| 41 | miniblink | miniblink示例 |
|
| 41 | miniblink | miniblink示例 |
|
||||||
| 42 | base64 | 图片文字base64互换 |
|
| 42 | base64 | 图片文字base64互换 |
|
||||||
| 43 | smoothcurve | 平滑曲线 |
|
| 43 | smoothcurve | 平滑曲线 |
|
||||||
| 44 | frameless | 跨平台无边框窗体 |
|
|
||||||
|
|
||||||
### 二、学习群
|
### 二、学习群
|
||||||
1. **Qt交流大会群 853086607(雨田哥)**
|
1. **Qt交流大会群 853086607(雨田哥)**
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#include "base64.h"
|
#include "base64helper.h"
|
||||||
#include "qbuffer.h"
|
#include "qbuffer.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
|
||||||
QString Base64::imageToBase64(const QImage &image)
|
QString Base64Helper::imageToBase64(const QImage &image)
|
||||||
{
|
{
|
||||||
return QString(imageToBase64x(image));
|
return QString(imageToBase64x(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Base64::imageToBase64x(const QImage &image)
|
QByteArray Base64Helper::imageToBase64x(const QImage &image)
|
||||||
{
|
{
|
||||||
//这个转换可能比较耗时建议在线程中执行
|
//这个转换可能比较耗时建议在线程中执行
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
@ -17,12 +17,12 @@ QByteArray Base64::imageToBase64x(const QImage &image)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Base64::base64ToImage(const QString &data)
|
QImage Base64Helper::base64ToImage(const QString &data)
|
||||||
{
|
{
|
||||||
return base64ToImagex(data.toUtf8());
|
return base64ToImagex(data.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Base64::base64ToImagex(const QByteArray &data)
|
QImage Base64Helper::base64ToImagex(const QByteArray &data)
|
||||||
{
|
{
|
||||||
//这个转换可能比较耗时建议在线程中执行
|
//这个转换可能比较耗时建议在线程中执行
|
||||||
QImage image;
|
QImage image;
|
||||||
|
@ -30,12 +30,12 @@ QImage Base64::base64ToImagex(const QByteArray &data)
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Base64::textToBase64(const QString &text)
|
QString Base64Helper::textToBase64(const QString &text)
|
||||||
{
|
{
|
||||||
return QString(text.toLocal8Bit().toBase64());
|
return QString(text.toLocal8Bit().toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Base64::base64ToText(const QString &text)
|
QString Base64Helper::base64ToText(const QString &text)
|
||||||
{
|
{
|
||||||
return QString(QByteArray::fromBase64(text.toLocal8Bit()));
|
return QString(QByteArray::fromBase64(text.toLocal8Bit()));
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef BASE64_H
|
#ifndef BASE64HELPER_H
|
||||||
#define BASE64_H
|
#define BASE64HELPER_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
#ifdef quc
|
#ifdef quc
|
||||||
class Q_DECL_EXPORT Base64
|
class Q_DECL_EXPORT Base64Helper
|
||||||
#else
|
#else
|
||||||
class Base64
|
class Base64Helper
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -34,4 +34,4 @@ public:
|
||||||
static QString base64ToText(const QString &text);
|
static QString base64ToText(const QString &text);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASE64_H
|
#endif // BASE64HELPER_H
|
|
@ -2,18 +2,18 @@ QT += core gui
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
||||||
|
|
||||||
TARGET = base64
|
TARGET = base64helper
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
DESTDIR = $$PWD/../bin
|
DESTDIR = $$PWD/../bin
|
||||||
CONFIG += warn_off
|
CONFIG += warn_off
|
||||||
|
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
|
|
||||||
SOURCES += frmbase64.cpp
|
SOURCES += frmbase64helper.cpp
|
||||||
SOURCES += base64.cpp
|
SOURCES += base64helper.cpp
|
||||||
|
|
||||||
HEADERS += frmbase64.h
|
HEADERS += frmbase64helper.h
|
||||||
HEADERS += base64.h
|
HEADERS += base64helper.h
|
||||||
|
|
||||||
FORMS += frmbase64.ui
|
FORMS += frmbase64helper.ui
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
#include "frmbase64.h"
|
#include "frmbase64helper.h"
|
||||||
#include "ui_frmbase64.h"
|
#include "ui_frmbase64helper.h"
|
||||||
#include "base64.h"
|
#include "base64helper.h"
|
||||||
#include "qfiledialog.h"
|
#include "qfiledialog.h"
|
||||||
#include "qelapsedtimer.h"
|
#include "qelapsedtimer.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
|
||||||
frmBase64::frmBase64(QWidget *parent) : QWidget(parent), ui(new Ui::frmBase64)
|
frmBase64Helper::frmBase64Helper(QWidget *parent) : QWidget(parent), ui(new Ui::frmBase64Helper)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
frmBase64::~frmBase64()
|
frmBase64Helper::~frmBase64Helper()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmBase64::on_btnOpen_clicked()
|
void frmBase64Helper::on_btnOpen_clicked()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, "选择文件", "", "图片(*.png *.bmp *.jpg)");
|
QString fileName = QFileDialog::getOpenFileName(this, "选择文件", "", "图片(*.png *.bmp *.jpg)");
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
|
@ -28,7 +28,7 @@ void frmBase64::on_btnOpen_clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmBase64::on_btnClear_clicked()
|
void frmBase64Helper::on_btnClear_clicked()
|
||||||
{
|
{
|
||||||
ui->txtFile->clear();
|
ui->txtFile->clear();
|
||||||
ui->txtText->clear();
|
ui->txtText->clear();
|
||||||
|
@ -36,7 +36,7 @@ void frmBase64::on_btnClear_clicked()
|
||||||
ui->labImage->clear();
|
ui->labImage->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmBase64::on_btnImageToBase64_clicked()
|
void frmBase64Helper::on_btnImageToBase64_clicked()
|
||||||
{
|
{
|
||||||
//计时
|
//计时
|
||||||
QElapsedTimer time;
|
QElapsedTimer time;
|
||||||
|
@ -44,7 +44,7 @@ void frmBase64::on_btnImageToBase64_clicked()
|
||||||
|
|
||||||
QString fileName = ui->txtFile->text().trimmed();
|
QString fileName = ui->txtFile->text().trimmed();
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
ui->txtBase64->setText(Base64::imageToBase64(QImage(fileName)));
|
ui->txtBase64->setText(Base64Helper::imageToBase64(QImage(fileName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//统计用时
|
//统计用时
|
||||||
|
@ -57,7 +57,7 @@ void frmBase64::on_btnImageToBase64_clicked()
|
||||||
qDebug() << QString("用时 %1 毫秒").arg(strTime);
|
qDebug() << QString("用时 %1 毫秒").arg(strTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmBase64::on_btnBase64ToImage_clicked()
|
void frmBase64Helper::on_btnBase64ToImage_clicked()
|
||||||
{
|
{
|
||||||
//计时
|
//计时
|
||||||
QElapsedTimer time;
|
QElapsedTimer time;
|
||||||
|
@ -65,7 +65,7 @@ void frmBase64::on_btnBase64ToImage_clicked()
|
||||||
|
|
||||||
QString text = ui->txtBase64->toPlainText().trimmed();
|
QString text = ui->txtBase64->toPlainText().trimmed();
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
QPixmap pix = QPixmap::fromImage(Base64::base64ToImage(text));
|
QPixmap pix = QPixmap::fromImage(Base64Helper::base64ToImage(text));
|
||||||
pix = pix.scaled(ui->labImage->size() - QSize(4, 4), Qt::KeepAspectRatio);
|
pix = pix.scaled(ui->labImage->size() - QSize(4, 4), Qt::KeepAspectRatio);
|
||||||
ui->labImage->setPixmap(pix);
|
ui->labImage->setPixmap(pix);
|
||||||
}
|
}
|
||||||
|
@ -80,18 +80,18 @@ void frmBase64::on_btnBase64ToImage_clicked()
|
||||||
qDebug() << QString("用时 %1 毫秒").arg(strTime);
|
qDebug() << QString("用时 %1 毫秒").arg(strTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmBase64::on_btnTextToBase64_clicked()
|
void frmBase64Helper::on_btnTextToBase64_clicked()
|
||||||
{
|
{
|
||||||
QString text = ui->txtText->text().trimmed();
|
QString text = ui->txtText->text().trimmed();
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
ui->txtBase64->setText(Base64::textToBase64(text));
|
ui->txtBase64->setText(Base64Helper::textToBase64(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmBase64::on_btnBase64ToText_clicked()
|
void frmBase64Helper::on_btnBase64ToText_clicked()
|
||||||
{
|
{
|
||||||
QString text = ui->txtBase64->toPlainText().trimmed();
|
QString text = ui->txtBase64->toPlainText().trimmed();
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
ui->txtText->setText(Base64::base64ToText(text));
|
ui->txtText->setText(Base64Helper::base64ToText(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,22 +1,22 @@
|
||||||
#ifndef FRMBASE64_H
|
#ifndef FRMBASE64HELPER_H
|
||||||
#define FRMBASE64_H
|
#define FRMBASE64HELPER_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class frmBase64;
|
class frmBase64Helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
class frmBase64 : public QWidget
|
class frmBase64Helper : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit frmBase64(QWidget *parent = 0);
|
explicit frmBase64Helper(QWidget *parent = 0);
|
||||||
~frmBase64();
|
~frmBase64Helper();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::frmBase64 *ui;
|
Ui::frmBase64Helper *ui;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_btnOpen_clicked();
|
void on_btnOpen_clicked();
|
||||||
|
@ -27,4 +27,4 @@ private slots:
|
||||||
void on_btnBase64ToText_clicked();
|
void on_btnBase64ToText_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRMBASE64_H
|
#endif // FRMBASE64HELPER_H
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>frmBase64</class>
|
<class>frmBase64Helper</class>
|
||||||
<widget class="QWidget" name="frmBase64">
|
<widget class="QWidget" name="frmBase64Helper">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<widget class="QPushButton" name="btnOpen">
|
<widget class="QPushButton" name="btnOpen">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<widget class="QPushButton" name="btnImageToBase64">
|
<widget class="QPushButton" name="btnImageToBase64">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<widget class="QPushButton" name="btnBase64ToImage">
|
<widget class="QPushButton" name="btnBase64ToImage">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
<widget class="QPushButton" name="btnClear">
|
<widget class="QPushButton" name="btnClear">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
<widget class="QPushButton" name="btnTextToBase64">
|
<widget class="QPushButton" name="btnTextToBase64">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
<widget class="QPushButton" name="btnBase64ToText">
|
<widget class="QPushButton" name="btnBase64ToText">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>110</width>
|
<width>120</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
#include "frmbase64.h"
|
#include "frmbase64helper.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ int main(int argc, char *argv[])
|
||||||
QTextCodec::setCodecForLocale(codec);
|
QTextCodec::setCodecForLocale(codec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frmBase64 w;
|
frmBase64Helper w;
|
||||||
w.setWindowTitle("图片文字base64编码互换");
|
w.setWindowTitle("图片文字base64编码互换");
|
||||||
w.show();
|
w.show();
|
||||||
|
|
|
@ -135,11 +135,11 @@ void ColorWidget::showColorValue()
|
||||||
int y = QCursor::pos().y();
|
int y = QCursor::pos().y();
|
||||||
txtPoint->setText(tr("x:%1 y:%2").arg(x).arg(y));
|
txtPoint->setText(tr("x:%1 y:%2").arg(x).arg(y));
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
QPixmap pixmap = QPixmap::grabWindow(qApp->desktop()->winId(), x, y, 2, 2);
|
|
||||||
#else
|
|
||||||
QScreen *screen = qApp->primaryScreen();
|
QScreen *screen = qApp->primaryScreen();
|
||||||
QPixmap pixmap = screen->grabWindow(0, x, y, 2, 2);
|
QPixmap pixmap = screen->grabWindow(0, x, y, 2, 2);
|
||||||
|
#else
|
||||||
|
QPixmap pixmap = QPixmap::grabWindow(qApp->desktop()->winId(), x, y, 2, 2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
#include "appinit.h"
|
|
||||||
#include "qmutex.h"
|
|
||||||
#include "qapplication.h"
|
|
||||||
#include "qevent.h"
|
|
||||||
#include "qwidget.h"
|
|
||||||
|
|
||||||
QScopedPointer<AppInit> AppInit::self;
|
|
||||||
AppInit *AppInit::Instance()
|
|
||||||
{
|
|
||||||
if (self.isNull()) {
|
|
||||||
static QMutex mutex;
|
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
if (self.isNull()) {
|
|
||||||
self.reset(new AppInit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
AppInit::AppInit(QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AppInit::eventFilter(QObject *watched, QEvent *event)
|
|
||||||
{
|
|
||||||
QWidget *w = (QWidget *)watched;
|
|
||||||
if (!w->property("canMove").toBool()) {
|
|
||||||
return QObject::eventFilter(watched, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
static QPoint mousePoint;
|
|
||||||
static bool mousePressed = false;
|
|
||||||
|
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
|
||||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
|
||||||
if (mouseEvent->button() == Qt::LeftButton) {
|
|
||||||
mousePressed = true;
|
|
||||||
mousePoint = mouseEvent->globalPos() - w->pos();
|
|
||||||
}
|
|
||||||
} else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
|
|
||||||
mousePressed = false;
|
|
||||||
} else if (mouseEvent->type() == QEvent::MouseMove) {
|
|
||||||
if (mousePressed) {
|
|
||||||
w->move(mouseEvent->globalPos() - mousePoint);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QObject::eventFilter(watched, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AppInit::start()
|
|
||||||
{
|
|
||||||
qApp->installEventFilter(this);
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
#ifndef APPINIT_H
|
|
||||||
#define APPINIT_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
class AppInit : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
static AppInit *Instance();
|
|
||||||
explicit AppInit(QObject *parent = 0);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static QScopedPointer<AppInit> self;
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void start();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // APPINIT_H
|
|
|
@ -1,41 +0,0 @@
|
||||||
#include "base64.h"
|
|
||||||
#include "qbuffer.h"
|
|
||||||
#include "qdebug.h"
|
|
||||||
|
|
||||||
QString Base64::imageToBase64(const QImage &image)
|
|
||||||
{
|
|
||||||
return QString(imageToBase64x(image));
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray Base64::imageToBase64x(const QImage &image)
|
|
||||||
{
|
|
||||||
//这个转换可能比较耗时建议在线程中执行
|
|
||||||
QByteArray data;
|
|
||||||
QBuffer buffer(&data);
|
|
||||||
image.save(&buffer, "JPG");
|
|
||||||
data = data.toBase64();
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage Base64::base64ToImage(const QString &data)
|
|
||||||
{
|
|
||||||
return base64ToImagex(data.toUtf8());
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage Base64::base64ToImagex(const QByteArray &data)
|
|
||||||
{
|
|
||||||
//这个转换可能比较耗时建议在线程中执行
|
|
||||||
QImage image;
|
|
||||||
image.loadFromData(QByteArray::fromBase64(data));
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Base64::textToBase64(const QString &text)
|
|
||||||
{
|
|
||||||
return QString(text.toLocal8Bit().toBase64());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Base64::base64ToText(const QString &text)
|
|
||||||
{
|
|
||||||
return QString(QByteArray::fromBase64(text.toLocal8Bit()));
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>image/fontawesome-webfont.ttf</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
|
@ -1,36 +0,0 @@
|
||||||
#指定编译产生的文件分门别类放到对应目录
|
|
||||||
MOC_DIR = temp/moc
|
|
||||||
RCC_DIR = temp/rcc
|
|
||||||
UI_DIR = temp/ui
|
|
||||||
OBJECTS_DIR = temp/obj
|
|
||||||
|
|
||||||
#指定编译生成的可执行文件放到源码上一级目录下的bin目录
|
|
||||||
!android {
|
|
||||||
!wasm {
|
|
||||||
DESTDIR = $$PWD/../bin
|
|
||||||
}}
|
|
||||||
|
|
||||||
#把所有警告都关掉眼不见为净
|
|
||||||
CONFIG += warn_off
|
|
||||||
#开启大资源支持
|
|
||||||
CONFIG += resources_big
|
|
||||||
#开启后会将打印信息用控制台输出
|
|
||||||
#CONFIG += console
|
|
||||||
|
|
||||||
#引入全志H3芯片依赖
|
|
||||||
include ($$PWD/h3.pri)
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
$$PWD/appinit.h \
|
|
||||||
$$PWD/base64.h \
|
|
||||||
$$PWD/iconhelper.h \
|
|
||||||
$$PWD/quihelper.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
$$PWD/appinit.cpp \
|
|
||||||
$$PWD/base64.cpp \
|
|
||||||
$$PWD/iconhelper.cpp \
|
|
||||||
$$PWD/quihelper.cpp
|
|
||||||
|
|
||||||
RESOURCES += \
|
|
||||||
$$PWD/common.qrc
|
|
|
@ -1,6 +0,0 @@
|
||||||
unix:!macx {
|
|
||||||
contains(DEFINES, arma7) {
|
|
||||||
INCLUDEPATH += /usr/local/openssl-1.0.2m-h3-gcc-4.9.2/include
|
|
||||||
LIBS += -L/usr/local/openssl-1.0.2m-h3-gcc-4.9.2/lib -lssl -lcrypto
|
|
||||||
LIBS += -L/usr/local/h3_rootfsv -lXdmcp
|
|
||||||
}}
|
|
|
@ -1,351 +0,0 @@
|
||||||
#include "iconhelper.h"
|
|
||||||
|
|
||||||
IconHelper *IconHelper::iconFontAliBaBa = 0;
|
|
||||||
IconHelper *IconHelper::iconFontAwesome = 0;
|
|
||||||
void IconHelper::initFont()
|
|
||||||
{
|
|
||||||
static bool isInit = false;
|
|
||||||
if (!isInit) {
|
|
||||||
isInit = true;
|
|
||||||
if (iconFontAliBaBa == 0) {
|
|
||||||
iconFontAliBaBa = new IconHelper(":/image/iconfont.ttf", "iconfont");
|
|
||||||
}
|
|
||||||
if (iconFontAwesome == 0) {
|
|
||||||
iconFontAwesome = new IconHelper(":/image/fontawesome-webfont.ttf", "FontAwesome");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setIcon(QLabel *lab, int icon, quint32 size)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
iconFontAliBaBa->setIcon1(lab, icon, size);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
iconFontAwesome->setIcon1(lab, icon, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setIcon(QAbstractButton *btn, int icon, quint32 size)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
iconFontAliBaBa->setIcon1(btn, icon, size);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
iconFontAwesome->setIcon1(btn, icon, size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setPixmap(QAbstractButton *btn, const QColor &color, int icon, quint32 size,
|
|
||||||
quint32 width, quint32 height, int flags)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
iconFontAliBaBa->setPixmap1(btn, color, icon, size, width, height, flags);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
iconFontAwesome->setPixmap1(btn, color, icon, size, width, height, flags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap IconHelper::getPixmap(const QColor &color, int icon, quint32 size,
|
|
||||||
quint32 width, quint32 height, int flags)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
QPixmap pix;
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
pix = iconFontAliBaBa->getPixmap1(color, icon, size, width, height, flags);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
pix = iconFontAwesome->getPixmap1(color, icon, size, width, height, flags);
|
|
||||||
}
|
|
||||||
return pix;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setStyle(QWidget *widget, QList<QPushButton *> btns,
|
|
||||||
QList<int> icons, const IconHelper::StyleColor &styleColor)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
int icon = icons.first();
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
iconFontAwesome->setStyle1(widget, btns, icons, styleColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setStyle(QWidget *widget, QList<QToolButton *> btns,
|
|
||||||
QList<int> icons, const IconHelper::StyleColor &styleColor)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
int icon = icons.first();
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
iconFontAwesome->setStyle1(widget, btns, icons, styleColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setStyle(QWidget *widget, QList<QAbstractButton *> btns,
|
|
||||||
QList<int> icons, const IconHelper::StyleColor &styleColor)
|
|
||||||
{
|
|
||||||
initFont();
|
|
||||||
|
|
||||||
//自动根据不同的字体的值选择对应的类,fontawesome 0xf开头 iconfont 0xe开头
|
|
||||||
int icon = icons.first();
|
|
||||||
if (icon > 0xe000 && icon < 0xf000) {
|
|
||||||
iconFontAliBaBa->setStyle1(widget, btns, icons, styleColor);
|
|
||||||
} else if (icon > 0xf000) {
|
|
||||||
iconFontAwesome->setStyle1(widget, btns, icons, styleColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IconHelper::IconHelper(const QString &fontFile, const QString &fontName, QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
//判断图形字体是否存在,不存在则加入
|
|
||||||
QFontDatabase fontDb;
|
|
||||||
if (!fontDb.families().contains(fontName)) {
|
|
||||||
int fontId = fontDb.addApplicationFont(fontFile);
|
|
||||||
QStringList listName = fontDb.applicationFontFamilies(fontId);
|
|
||||||
if (listName.count() == 0) {
|
|
||||||
qDebug() << QString("load %1 error").arg(fontName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fontDb.families().contains(fontName)) {
|
|
||||||
iconFont = QFont(fontName);
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0))
|
|
||||||
iconFont.setHintingPreference(QFont::PreferNoHinting);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IconHelper::eventFilter(QObject *watched, QEvent *event)
|
|
||||||
{
|
|
||||||
//根据不同的
|
|
||||||
if (watched->inherits("QAbstractButton")) {
|
|
||||||
QAbstractButton *btn = (QAbstractButton *)watched;
|
|
||||||
int index = btns.indexOf(btn);
|
|
||||||
if (index >= 0) {
|
|
||||||
//不同的事件设置不同的图标,同时区分选中的和没有选中的
|
|
||||||
if (btn->isChecked()) {
|
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
|
||||||
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
|
||||||
if (mouseEvent->button() == Qt::LeftButton) {
|
|
||||||
btn->setIcon(QIcon(pixChecked.at(index)));
|
|
||||||
}
|
|
||||||
} else if (event->type() == QEvent::Enter) {
|
|
||||||
btn->setIcon(QIcon(pixChecked.at(index)));
|
|
||||||
} else if (event->type() == QEvent::Leave) {
|
|
||||||
btn->setIcon(QIcon(pixChecked.at(index)));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
|
||||||
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
|
||||||
if (mouseEvent->button() == Qt::LeftButton) {
|
|
||||||
btn->setIcon(QIcon(pixPressed.at(index)));
|
|
||||||
}
|
|
||||||
} else if (event->type() == QEvent::Enter) {
|
|
||||||
btn->setIcon(QIcon(pixHover.at(index)));
|
|
||||||
} else if (event->type() == QEvent::Leave) {
|
|
||||||
btn->setIcon(QIcon(pixNormal.at(index)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QObject::eventFilter(watched, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::toggled(bool checked)
|
|
||||||
{
|
|
||||||
//选中和不选中设置不同的图标
|
|
||||||
QAbstractButton *btn = (QAbstractButton *)sender();
|
|
||||||
int index = btns.indexOf(btn);
|
|
||||||
if (checked) {
|
|
||||||
btn->setIcon(QIcon(pixChecked.at(index)));
|
|
||||||
} else {
|
|
||||||
btn->setIcon(QIcon(pixNormal.at(index)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setIcon1(QLabel *lab, int icon, quint32 size)
|
|
||||||
{
|
|
||||||
iconFont.setPixelSize(size);
|
|
||||||
lab->setFont(iconFont);
|
|
||||||
lab->setText((QChar)icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setIcon1(QAbstractButton *btn, int icon, quint32 size)
|
|
||||||
{
|
|
||||||
iconFont.setPixelSize(size);
|
|
||||||
btn->setFont(iconFont);
|
|
||||||
btn->setText((QChar)icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setPixmap1(QAbstractButton *btn, const QColor &color, int icon, quint32 size,
|
|
||||||
quint32 width, quint32 height, int flags)
|
|
||||||
{
|
|
||||||
btn->setIcon(getPixmap1(color, icon, size, width, height, flags));
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap IconHelper::getPixmap1(const QColor &color, int icon, quint32 size,
|
|
||||||
quint32 width, quint32 height, int flags)
|
|
||||||
{
|
|
||||||
//主动绘制图形字体到图片
|
|
||||||
QPixmap pix(width, height);
|
|
||||||
pix.fill(Qt::transparent);
|
|
||||||
|
|
||||||
QPainter painter;
|
|
||||||
painter.begin(&pix);
|
|
||||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
|
||||||
painter.setPen(color);
|
|
||||||
|
|
||||||
iconFont.setPixelSize(size);
|
|
||||||
painter.setFont(iconFont);
|
|
||||||
painter.drawText(pix.rect(), flags, (QChar)icon);
|
|
||||||
painter.end();
|
|
||||||
return pix;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QPushButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
|
||||||
{
|
|
||||||
QList<QAbstractButton *> list;
|
|
||||||
foreach (QPushButton *btn, btns) {
|
|
||||||
list << btn;
|
|
||||||
}
|
|
||||||
|
|
||||||
setStyle(widget, list, icons, styleColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
|
||||||
{
|
|
||||||
QList<QAbstractButton *> list;
|
|
||||||
foreach (QToolButton *btn, btns) {
|
|
||||||
list << btn;
|
|
||||||
}
|
|
||||||
|
|
||||||
setStyle(widget, list, icons, styleColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IconHelper::setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const IconHelper::StyleColor &styleColor)
|
|
||||||
{
|
|
||||||
int btnCount = btns.count();
|
|
||||||
int iconCount = icons.count();
|
|
||||||
if (btnCount <= 0 || iconCount <= 0 || btnCount != iconCount) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString position = styleColor.position;
|
|
||||||
quint32 iconSize = styleColor.iconSize;
|
|
||||||
quint32 iconWidth = styleColor.iconWidth;
|
|
||||||
quint32 iconHeight = styleColor.iconHeight;
|
|
||||||
quint32 borderWidth = styleColor.borderWidth;
|
|
||||||
|
|
||||||
//根据不同的位置计算边框
|
|
||||||
QString strBorder;
|
|
||||||
if (position == "top") {
|
|
||||||
strBorder = QString("border-width:%1px 0px 0px 0px;padding-top:%1px;padding-bottom:%2px;")
|
|
||||||
.arg(borderWidth).arg(borderWidth * 2);
|
|
||||||
} else if (position == "right") {
|
|
||||||
strBorder = QString("border-width:0px %1px 0px 0px;padding-right:%1px;padding-left:%2px;")
|
|
||||||
.arg(borderWidth).arg(borderWidth * 2);
|
|
||||||
} else if (position == "bottom") {
|
|
||||||
strBorder = QString("border-width:0px 0px %1px 0px;padding-bottom:%1px;padding-top:%2px;")
|
|
||||||
.arg(borderWidth).arg(borderWidth * 2);
|
|
||||||
} else if (position == "left") {
|
|
||||||
strBorder = QString("border-width:0px 0px 0px %1px;padding-left:%1px;padding-right:%2px;")
|
|
||||||
.arg(borderWidth).arg(borderWidth * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
//如果图标是左侧显示则需要让没有选中的按钮左侧也有加深的边框,颜色为背景颜色
|
|
||||||
QStringList qss;
|
|
||||||
if (styleColor.textBesideIcon) {
|
|
||||||
qss << QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:solid;border-radius:0px;%2border-color:%3;color:%4;background:%5;}")
|
|
||||||
.arg(position).arg(strBorder).arg(styleColor.normalBgColor).arg(styleColor.normalTextColor).arg(styleColor.normalBgColor);
|
|
||||||
} else {
|
|
||||||
qss << QString("QWidget[flag=\"%1\"] QAbstractButton{border-style:none;border-radius:0px;padding:5px;color:%2;background:%3;}")
|
|
||||||
.arg(position).arg(styleColor.normalTextColor).arg(styleColor.normalBgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
//悬停+按下+选中
|
|
||||||
qss << QString("QWidget[flag=\"%1\"] QAbstractButton:hover{border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
|
||||||
.arg(position).arg(strBorder).arg(styleColor.borderColor).arg(styleColor.hoverTextColor).arg(styleColor.hoverBgColor);
|
|
||||||
qss << QString("QWidget[flag=\"%1\"] QAbstractButton:pressed{border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
|
||||||
.arg(position).arg(strBorder).arg(styleColor.borderColor).arg(styleColor.pressedTextColor).arg(styleColor.pressedBgColor);
|
|
||||||
qss << QString("QWidget[flag=\"%1\"] QAbstractButton:checked{border-style:solid;%2border-color:%3;color:%4;background:%5;}")
|
|
||||||
.arg(position).arg(strBorder).arg(styleColor.borderColor).arg(styleColor.checkedTextColor).arg(styleColor.checkedBgColor);
|
|
||||||
|
|
||||||
//窗体背景颜色+按钮背景颜色
|
|
||||||
qss << QString("QWidget#%1{background:%2;}")
|
|
||||||
.arg(widget->objectName()).arg(styleColor.normalBgColor);
|
|
||||||
qss << QString("QWidget>QAbstractButton{border-width:0px;background-color:%1;color:%2;}")
|
|
||||||
.arg(styleColor.normalBgColor).arg(styleColor.normalTextColor);
|
|
||||||
qss << QString("QWidget>QAbstractButton:hover{background-color:%1;color:%2;}")
|
|
||||||
.arg(styleColor.hoverBgColor).arg(styleColor.hoverTextColor);
|
|
||||||
qss << QString("QWidget>QAbstractButton:pressed{background-color:%1;color:%2;}")
|
|
||||||
.arg(styleColor.pressedBgColor).arg(styleColor.pressedTextColor);
|
|
||||||
qss << QString("QWidget>QAbstractButton:checked{background-color:%1;color:%2;}")
|
|
||||||
.arg(styleColor.checkedBgColor).arg(styleColor.checkedTextColor);
|
|
||||||
|
|
||||||
//设置样式表
|
|
||||||
widget->setStyleSheet(qss.join(""));
|
|
||||||
|
|
||||||
//可能会重复调用设置所以先要移除上一次的
|
|
||||||
for (int i = 0; i < btnCount; i++) {
|
|
||||||
for (int j = 0; j < this->btns.count(); j++) {
|
|
||||||
if (this->btns.at(j) == btns.at(i)) {
|
|
||||||
disconnect(btns.at(i), SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
|
||||||
this->btns.at(j)->removeEventFilter(this);
|
|
||||||
this->btns.removeAt(j);
|
|
||||||
this->pixNormal.removeAt(j);
|
|
||||||
this->pixHover.removeAt(j);
|
|
||||||
this->pixPressed.removeAt(j);
|
|
||||||
this->pixChecked.removeAt(j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//存储对应按钮对象,方便鼠标移上去的时候切换图片
|
|
||||||
int checkedIndex = -1;
|
|
||||||
for (int i = 0; i < btnCount; i++) {
|
|
||||||
int icon = icons.at(i);
|
|
||||||
QPixmap pixNormal = getPixmap1(styleColor.normalTextColor, icon, iconSize, iconWidth, iconHeight);
|
|
||||||
QPixmap pixHover = getPixmap1(styleColor.hoverTextColor, icon, iconSize, iconWidth, iconHeight);
|
|
||||||
QPixmap pixPressed = getPixmap1(styleColor.pressedTextColor, icon, iconSize, iconWidth, iconHeight);
|
|
||||||
QPixmap pixChecked = getPixmap1(styleColor.checkedTextColor, icon, iconSize, iconWidth, iconHeight);
|
|
||||||
|
|
||||||
//记住最后选中的按钮
|
|
||||||
QAbstractButton *btn = btns.at(i);
|
|
||||||
if (btn->isChecked()) {
|
|
||||||
checkedIndex = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
btn->setIcon(QIcon(pixNormal));
|
|
||||||
btn->setIconSize(QSize(iconWidth, iconHeight));
|
|
||||||
btn->installEventFilter(this);
|
|
||||||
connect(btn, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
|
|
||||||
|
|
||||||
this->btns << btn;
|
|
||||||
this->pixNormal << pixNormal;
|
|
||||||
this->pixHover << pixHover;
|
|
||||||
this->pixPressed << pixPressed;
|
|
||||||
this->pixChecked << pixChecked;
|
|
||||||
}
|
|
||||||
|
|
||||||
//主动触发一下选中的按钮
|
|
||||||
if (checkedIndex >= 0) {
|
|
||||||
QMetaObject::invokeMethod(btns.at(checkedIndex), "toggled", Q_ARG(bool, true));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
#ifndef ICONHELPER_H
|
|
||||||
#define ICONHELPER_H
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
#include <QtWidgets>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 超级图形字体类 作者:feiyangqingyun(QQ:517216493) 2016-11-23
|
|
||||||
* 1. 可传入多种图形字体文件。
|
|
||||||
* 2. 可设置 QLabel+QAbstractButton 图形字体。
|
|
||||||
* 3. 可设置按钮图标。
|
|
||||||
* 4. 可获取指定尺寸的图形字体图片。
|
|
||||||
* 5. 超级导航栏样式设置,带图标和效果切换、悬停颜色、按下颜色、选中颜色。
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef quc
|
|
||||||
class Q_DECL_EXPORT IconHelper : public QObject
|
|
||||||
#else
|
|
||||||
class IconHelper : public QObject
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
//样式颜色结构体
|
|
||||||
struct StyleColor {
|
|
||||||
QString position; //位置 left right top bottom
|
|
||||||
bool textBesideIcon; //文字在图标左侧
|
|
||||||
|
|
||||||
quint32 iconSize; //图标字体尺寸
|
|
||||||
quint32 iconWidth; //图标图片宽度
|
|
||||||
quint32 iconHeight; //图标图片高度
|
|
||||||
|
|
||||||
quint32 borderWidth; //边框宽度
|
|
||||||
QString borderColor; //边框颜色
|
|
||||||
|
|
||||||
QString normalBgColor; //正常背景颜色
|
|
||||||
QString normalTextColor; //正常文字颜色
|
|
||||||
QString hoverBgColor; //悬停背景颜色
|
|
||||||
QString hoverTextColor; //悬停文字颜色
|
|
||||||
QString pressedBgColor; //按下背景颜色
|
|
||||||
QString pressedTextColor; //按下文字颜色
|
|
||||||
QString checkedBgColor; //选中背景颜色
|
|
||||||
QString checkedTextColor; //选中文字颜色
|
|
||||||
|
|
||||||
StyleColor() {
|
|
||||||
position = "left";
|
|
||||||
textBesideIcon = false;
|
|
||||||
|
|
||||||
iconSize = 12;
|
|
||||||
iconWidth = 15;
|
|
||||||
iconHeight = 15;
|
|
||||||
|
|
||||||
borderWidth = 3;
|
|
||||||
borderColor = "#029FEA";
|
|
||||||
|
|
||||||
normalBgColor = "#292F38";
|
|
||||||
normalTextColor = "#54626F";
|
|
||||||
hoverBgColor = "#40444D";
|
|
||||||
hoverTextColor = "#FDFDFD";
|
|
||||||
pressedBgColor = "#404244";
|
|
||||||
pressedTextColor = "#FDFDFD";
|
|
||||||
checkedBgColor = "#44494F";
|
|
||||||
checkedTextColor = "#FDFDFD";
|
|
||||||
}
|
|
||||||
|
|
||||||
//设置常规颜色 普通状态+加深状态
|
|
||||||
void setColor(const QString &normalBgColor,
|
|
||||||
const QString &normalTextColor,
|
|
||||||
const QString &darkBgColor,
|
|
||||||
const QString &darkTextColor) {
|
|
||||||
this->normalBgColor = normalBgColor;
|
|
||||||
this->normalTextColor = normalTextColor;
|
|
||||||
this->hoverBgColor = darkBgColor;
|
|
||||||
this->hoverTextColor = darkTextColor;
|
|
||||||
this->pressedBgColor = darkBgColor;
|
|
||||||
this->pressedTextColor = darkTextColor;
|
|
||||||
this->checkedBgColor = darkBgColor;
|
|
||||||
this->checkedTextColor = darkTextColor;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//阿里巴巴图形字体类
|
|
||||||
static IconHelper *iconFontAliBaBa;
|
|
||||||
//FontAwesome图形字体类
|
|
||||||
static IconHelper *iconFontAwesome;
|
|
||||||
//初始化图形字体
|
|
||||||
static void initFont();
|
|
||||||
|
|
||||||
static void setIcon(QLabel *lab, int icon, quint32 size = 12);
|
|
||||||
static void setIcon(QAbstractButton *btn, int icon, quint32 size = 12);
|
|
||||||
|
|
||||||
static void setPixmap(QAbstractButton *btn, const QColor &color,
|
|
||||||
int icon, quint32 size = 12,
|
|
||||||
quint32 width = 15, quint32 height = 15,
|
|
||||||
int flags = Qt::AlignCenter);
|
|
||||||
static QPixmap getPixmap(const QColor &color, int icon, quint32 size = 12,
|
|
||||||
quint32 width = 15, quint32 height = 15,
|
|
||||||
int flags = Qt::AlignCenter);
|
|
||||||
|
|
||||||
static void setStyle(QWidget *widget, QList<QPushButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
|
||||||
static void setStyle(QWidget *widget, QList<QToolButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
|
||||||
static void setStyle(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
|
||||||
|
|
||||||
//默认构造函数,传入字体文件+字体名称
|
|
||||||
explicit IconHelper(const QString &fontFile, const QString &fontName, QObject *parent = 0);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QFont iconFont; //图形字体
|
|
||||||
QList<QAbstractButton *> btns; //按钮队列
|
|
||||||
QList<QPixmap> pixNormal; //正常图片队列
|
|
||||||
QList<QPixmap> pixHover; //悬停图片队列
|
|
||||||
QList<QPixmap> pixPressed; //按下图片队列
|
|
||||||
QList<QPixmap> pixChecked; //选中图片队列
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
//按钮选中状态切换处理
|
|
||||||
void toggled(bool checked);
|
|
||||||
|
|
||||||
public:
|
|
||||||
//设置图形字体到标签
|
|
||||||
void setIcon1(QLabel *lab, int icon, quint32 size = 12);
|
|
||||||
//设置图形字体到按钮
|
|
||||||
void setIcon1(QAbstractButton *btn, int icon, quint32 size = 12);
|
|
||||||
|
|
||||||
//设置图形字体到图标
|
|
||||||
void setPixmap1(QAbstractButton *btn, const QColor &color,
|
|
||||||
int icon, quint32 size = 12,
|
|
||||||
quint32 width = 15, quint32 height = 15,
|
|
||||||
int flags = Qt::AlignCenter);
|
|
||||||
//获取指定图形字体,可以指定文字大小,图片宽高,文字对齐
|
|
||||||
QPixmap getPixmap1(const QColor &color, int icon, quint32 size = 12,
|
|
||||||
quint32 width = 15, quint32 height = 15,
|
|
||||||
int flags = Qt::AlignCenter);
|
|
||||||
|
|
||||||
//指定导航面板样式,带图标和效果切换+悬停颜色+按下颜色+选中颜色
|
|
||||||
void setStyle1(QWidget *widget, QList<QPushButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
|
||||||
void setStyle1(QWidget *widget, QList<QToolButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
|
||||||
void setStyle1(QWidget *widget, QList<QAbstractButton *> btns, QList<int> icons, const StyleColor &styleColor);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ICONHELPER_H
|
|
Binary file not shown.
|
@ -1,372 +0,0 @@
|
||||||
#include "quihelper.h"
|
|
||||||
|
|
||||||
int QUIHelper::getScreenIndex()
|
|
||||||
{
|
|
||||||
//需要对多个屏幕进行处理
|
|
||||||
int screenIndex = 0;
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
int screenCount = qApp->screens().count();
|
|
||||||
#else
|
|
||||||
int screenCount = qApp->desktop()->screenCount();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (screenCount > 1) {
|
|
||||||
//找到当前鼠标所在屏幕
|
|
||||||
QPoint pos = QCursor::pos();
|
|
||||||
for (int i = 0; i < screenCount; ++i) {
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
if (qApp->screens().at(i)->geometry().contains(pos)) {
|
|
||||||
#else
|
|
||||||
if (qApp->desktop()->screenGeometry(i).contains(pos)) {
|
|
||||||
#endif
|
|
||||||
screenIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return screenIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect QUIHelper::getScreenRect(bool available)
|
|
||||||
{
|
|
||||||
QRect rect;
|
|
||||||
int screenIndex = QUIHelper::getScreenIndex();
|
|
||||||
if (available) {
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
rect = qApp->screens().at(screenIndex)->availableGeometry();
|
|
||||||
#else
|
|
||||||
rect = qApp->desktop()->availableGeometry(screenIndex);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
rect = qApp->screens().at(screenIndex)->geometry();
|
|
||||||
#else
|
|
||||||
rect = qApp->desktop()->screenGeometry(screenIndex);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
int QUIHelper::deskWidth()
|
|
||||||
{
|
|
||||||
return getScreenRect().width();
|
|
||||||
}
|
|
||||||
|
|
||||||
int QUIHelper::deskHeight()
|
|
||||||
{
|
|
||||||
return getScreenRect().height();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *QUIHelper::centerBaseForm = 0;
|
|
||||||
void QUIHelper::setFormInCenter(QWidget *form)
|
|
||||||
{
|
|
||||||
int formWidth = form->width();
|
|
||||||
int formHeight = form->height();
|
|
||||||
|
|
||||||
//如果=0表示采用系统桌面屏幕为参照
|
|
||||||
QRect rect;
|
|
||||||
if (centerBaseForm == 0) {
|
|
||||||
rect = getScreenRect();
|
|
||||||
} else {
|
|
||||||
rect = centerBaseForm->geometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
int deskWidth = rect.width();
|
|
||||||
int deskHeight = rect.height();
|
|
||||||
QPoint movePoint(deskWidth / 2 - formWidth / 2 + rect.x(), deskHeight / 2 - formHeight / 2 + rect.y());
|
|
||||||
form->move(movePoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QUIHelper::appName()
|
|
||||||
{
|
|
||||||
//没有必要每次都获取,只有当变量为空时才去获取一次
|
|
||||||
static QString name;
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
name = qApp->applicationFilePath();
|
|
||||||
//下面的方法主要为了过滤安卓的路径 lib程序名_armeabi-v7a
|
|
||||||
QStringList list = name.split("/");
|
|
||||||
name = list.at(list.count() - 1).split(".").at(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QUIHelper::appPath()
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
//return QString("/sdcard/Android/%1").arg(appName());
|
|
||||||
return QString("/storage/emulated/0/%1").arg(appName());
|
|
||||||
#else
|
|
||||||
return qApp->applicationDirPath();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QUIHelper::getUuid()
|
|
||||||
{
|
|
||||||
QString uuid = QUuid::createUuid().toString();
|
|
||||||
uuid.replace("{", "");
|
|
||||||
uuid.replace("}", "");
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::initRand()
|
|
||||||
{
|
|
||||||
//初始化随机数种子
|
|
||||||
QTime t = QTime::currentTime();
|
|
||||||
srand(t.msec() + t.second() * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::newDir(const QString &dirName)
|
|
||||||
{
|
|
||||||
QString strDir = dirName;
|
|
||||||
|
|
||||||
//如果路径中包含斜杠字符则说明是绝对路径
|
|
||||||
//linux系统路径字符带有 / windows系统 路径字符带有 :/
|
|
||||||
if (!strDir.startsWith("/") && !strDir.contains(":/")) {
|
|
||||||
strDir = QString("%1/%2").arg(QUIHelper::appPath()).arg(strDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDir dir(strDir);
|
|
||||||
if (!dir.exists()) {
|
|
||||||
dir.mkpath(strDir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::sleep(int msec)
|
|
||||||
{
|
|
||||||
if (msec > 0) {
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
|
||||||
QTime endTime = QTime::currentTime().addMSecs(msec);
|
|
||||||
while (QTime::currentTime() < endTime) {
|
|
||||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
QThread::msleep(msec);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::setStyle()
|
|
||||||
{
|
|
||||||
//打印下所有内置风格的名字
|
|
||||||
qDebug() << "Qt内置的样式" << QStyleFactory::keys();
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
|
||||||
#else
|
|
||||||
qApp->setStyle(QStyleFactory::create("Cleanlooks"));
|
|
||||||
#endif
|
|
||||||
//qApp->setPalette(QPalette("#FFFFFF"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::setFont(int fontSize)
|
|
||||||
{
|
|
||||||
QFont font;
|
|
||||||
font.setFamily("MicroSoft Yahei");
|
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
font.setPixelSize(15);
|
|
||||||
#elif __arm__
|
|
||||||
font.setPixelSize(25);
|
|
||||||
#else
|
|
||||||
font.setPixelSize(fontSize);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef rk3399
|
|
||||||
qApp->setFont(font);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::setCode(bool utf8)
|
|
||||||
{
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
|
||||||
#if _MSC_VER
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
|
||||||
#else
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
|
||||||
#endif
|
|
||||||
QTextCodec::setCodecForLocale(codec);
|
|
||||||
QTextCodec::setCodecForCStrings(codec);
|
|
||||||
QTextCodec::setCodecForTr(codec);
|
|
||||||
#else
|
|
||||||
//如果想要控制台打印信息中文正常就注释掉这个设置
|
|
||||||
if (utf8) {
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
|
||||||
QTextCodec::setCodecForLocale(codec);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::setTranslator(const QString &qmFile)
|
|
||||||
{
|
|
||||||
QTranslator *translator = new QTranslator(qApp);
|
|
||||||
translator->load(qmFile);
|
|
||||||
qApp->installTranslator(translator);
|
|
||||||
}
|
|
||||||
|
|
||||||
int QUIHelper::showMessageBox(const QString &info, int type, int closeSec, bool exec)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
if (type == 0) {
|
|
||||||
showMessageBoxInfo(info, closeSec, exec);
|
|
||||||
} else if (type == 1) {
|
|
||||||
showMessageBoxError(info, closeSec, exec);
|
|
||||||
} else if (type == 2) {
|
|
||||||
result = showMessageBoxQuestion(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::showMessageBoxInfo(const QString &info, int closeSec, bool exec)
|
|
||||||
{
|
|
||||||
QMessageBox box(QMessageBox::Information, "提示", info);
|
|
||||||
box.setStandardButtons(QMessageBox::Yes);
|
|
||||||
box.setButtonText(QMessageBox::Yes, QString("确 定"));
|
|
||||||
box.exec();
|
|
||||||
//QMessageBox::information(0, "提示", info, QMessageBox::Yes);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::showMessageBoxError(const QString &info, int closeSec, bool exec)
|
|
||||||
{
|
|
||||||
QMessageBox box(QMessageBox::Critical, "错误", info);
|
|
||||||
box.setStandardButtons(QMessageBox::Yes);
|
|
||||||
box.setButtonText(QMessageBox::Yes, QString("确 定"));
|
|
||||||
box.exec();
|
|
||||||
//QMessageBox::critical(0, "错误", info, QMessageBox::Yes);
|
|
||||||
}
|
|
||||||
|
|
||||||
int QUIHelper::showMessageBoxQuestion(const QString &info)
|
|
||||||
{
|
|
||||||
QMessageBox box(QMessageBox::Question, "询问", info);
|
|
||||||
box.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
|
||||||
box.setButtonText(QMessageBox::Yes, QString("确 定"));
|
|
||||||
box.setButtonText(QMessageBox::No, QString("取 消"));
|
|
||||||
return box.exec();
|
|
||||||
//return QMessageBox::question(0, "询问", info, QMessageBox::Yes | QMessageBox::No);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QUIHelper::getXorEncryptDecrypt(const QString &value, char key)
|
|
||||||
{
|
|
||||||
//矫正范围外的数据
|
|
||||||
if (key < 0 || key >= 127) {
|
|
||||||
key = 127;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString result = value;
|
|
||||||
int count = result.count();
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
result[i] = QChar(result.at(i).toLatin1() ^ key);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
uchar QUIHelper::getOrCode(const QByteArray &data)
|
|
||||||
{
|
|
||||||
int len = data.length();
|
|
||||||
uchar result = 0;
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
result ^= data.at(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
uchar QUIHelper::getCheckCode(const QByteArray &data)
|
|
||||||
{
|
|
||||||
int len = data.length();
|
|
||||||
uchar temp = 0;
|
|
||||||
for (uchar i = 0; i < len; i++) {
|
|
||||||
temp += data.at(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return temp % 256;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVisible, bool edit, bool stretchLast)
|
|
||||||
{
|
|
||||||
//取消自动换行
|
|
||||||
tableView->setWordWrap(false);
|
|
||||||
//超出文本不显示省略号
|
|
||||||
tableView->setTextElideMode(Qt::ElideNone);
|
|
||||||
//奇数偶数行颜色交替
|
|
||||||
tableView->setAlternatingRowColors(false);
|
|
||||||
//垂直表头是否可见
|
|
||||||
tableView->verticalHeader()->setVisible(headVisible);
|
|
||||||
//选中一行表头是否加粗
|
|
||||||
tableView->horizontalHeader()->setHighlightSections(false);
|
|
||||||
//最后一行拉伸填充
|
|
||||||
tableView->horizontalHeader()->setStretchLastSection(stretchLast);
|
|
||||||
//行标题最小宽度尺寸
|
|
||||||
tableView->horizontalHeader()->setMinimumSectionSize(0);
|
|
||||||
//行标题最小高度,等同于和默认行高一致
|
|
||||||
tableView->horizontalHeader()->setFixedHeight(rowHeight);
|
|
||||||
//默认行高
|
|
||||||
tableView->verticalHeader()->setDefaultSectionSize(rowHeight);
|
|
||||||
//选中时一行整体选中
|
|
||||||
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
//只允许选择单个
|
|
||||||
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
||||||
|
|
||||||
//表头不可单击
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
tableView->horizontalHeader()->setSectionsClickable(false);
|
|
||||||
#else
|
|
||||||
tableView->horizontalHeader()->setClickable(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//鼠标按下即进入编辑模式
|
|
||||||
if (edit) {
|
|
||||||
tableView->setEditTriggers(QAbstractItemView::CurrentChanged | QAbstractItemView::DoubleClicked);
|
|
||||||
} else {
|
|
||||||
tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::openFile(const QString &fileName, const QString &msg)
|
|
||||||
{
|
|
||||||
#ifdef __arm__
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
if (fileName.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (QUIHelper::showMessageBoxQuestion(msg + "成功!确定现在就打开吗?") == QMessageBox::Yes) {
|
|
||||||
QString url = QString("file:///%1").arg(fileName);
|
|
||||||
QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QUIHelper::checkIniFile(const QString &iniFile)
|
|
||||||
{
|
|
||||||
//如果配置文件大小为0,则以初始值继续运行,并生成配置文件
|
|
||||||
QFile file(iniFile);
|
|
||||||
if (file.size() == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//如果配置文件不完整,则以初始值继续运行,并生成配置文件
|
|
||||||
if (file.open(QFile::ReadOnly)) {
|
|
||||||
bool ok = true;
|
|
||||||
while (!file.atEnd()) {
|
|
||||||
QString line = file.readLine();
|
|
||||||
line.replace("\r", "");
|
|
||||||
line.replace("\n", "");
|
|
||||||
QStringList list = line.split("=");
|
|
||||||
|
|
||||||
if (list.count() == 2) {
|
|
||||||
if (list.at(1) == "") {
|
|
||||||
qDebug() << "ini node no value" << list.at(0);
|
|
||||||
ok = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ok) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
#ifndef QUIHELPER2_H
|
|
||||||
#define QUIHELPER2_H
|
|
||||||
|
|
||||||
#include "head.h"
|
|
||||||
|
|
||||||
class QUIHelper
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//获取当前鼠标所在屏幕索引+尺寸
|
|
||||||
static int getScreenIndex();
|
|
||||||
static QRect getScreenRect(bool available = true);
|
|
||||||
|
|
||||||
//获取桌面宽度高度+居中显示
|
|
||||||
static int deskWidth();
|
|
||||||
static int deskHeight();
|
|
||||||
|
|
||||||
//居中显示窗体
|
|
||||||
//定义标志位指定是以桌面为参照还是主程序界面为参照
|
|
||||||
static QWidget *centerBaseForm;
|
|
||||||
static void setFormInCenter(QWidget *form);
|
|
||||||
|
|
||||||
//程序文件名称+当前所在路径
|
|
||||||
static QString appName();
|
|
||||||
static QString appPath();
|
|
||||||
|
|
||||||
//获取uuid+初始化随机数种子+新建目录+延时
|
|
||||||
static QString getUuid();
|
|
||||||
static void initRand();
|
|
||||||
static void newDir(const QString &dirName);
|
|
||||||
static void sleep(int msec);
|
|
||||||
|
|
||||||
//设置样式+字体+编码+居中+翻译
|
|
||||||
static void setStyle();
|
|
||||||
static void setFont(int fontSize = 12);
|
|
||||||
static void setCode(bool utf8 = true);
|
|
||||||
static void setTranslator(const QString &qmFile = ":/image/qt_zh_CN.qm");
|
|
||||||
|
|
||||||
//弹出框
|
|
||||||
static int showMessageBox(const QString &info, int type = 0, int closeSec = 0, bool exec = false);
|
|
||||||
//弹出消息框
|
|
||||||
static void showMessageBoxInfo(const QString &info, int closeSec = 0, bool exec = false);
|
|
||||||
//弹出错误框
|
|
||||||
static void showMessageBoxError(const QString &info, int closeSec = 0, bool exec = false);
|
|
||||||
//弹出询问框
|
|
||||||
static int showMessageBoxQuestion(const QString &info);
|
|
||||||
|
|
||||||
//异或加密-只支持字符,如果是中文需要将其转换base64编码
|
|
||||||
static QString getXorEncryptDecrypt(const QString &value, char key);
|
|
||||||
//异或校验
|
|
||||||
static uchar getOrCode(const QByteArray &data);
|
|
||||||
//计算校验码
|
|
||||||
static uchar getCheckCode(const QByteArray &data);
|
|
||||||
|
|
||||||
//初始化表格
|
|
||||||
static void initTableView(QTableView *tableView, int rowHeight = 25,
|
|
||||||
bool headVisible = false, bool edit = false,
|
|
||||||
bool stretchLast = true);
|
|
||||||
//打开文件带提示框
|
|
||||||
static void openFile(const QString &fileName, const QString &msg);
|
|
||||||
|
|
||||||
//检查ini配置文件
|
|
||||||
static bool checkIniFile(const QString &iniFile);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QUIHELPER2_H
|
|
|
@ -1,37 +0,0 @@
|
||||||
#ifndef BASE64_H
|
|
||||||
#define BASE64_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
|
||||||
* 1. 图片转base64字符串。
|
|
||||||
* 2. base64字符串转图片。
|
|
||||||
* 3. 字符转base64字符串。
|
|
||||||
* 4. base64字符串转字符。
|
|
||||||
* 5. 后期增加数据压缩。
|
|
||||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%。
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <QImage>
|
|
||||||
|
|
||||||
#ifdef quc
|
|
||||||
class Q_DECL_EXPORT Base64
|
|
||||||
#else
|
|
||||||
class Base64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//图片转base64字符串
|
|
||||||
static QString imageToBase64(const QImage &image);
|
|
||||||
static QByteArray imageToBase64x(const QImage &image);
|
|
||||||
|
|
||||||
//base64字符串转图片
|
|
||||||
static QImage base64ToImage(const QString &data);
|
|
||||||
static QImage base64ToImagex(const QByteArray &data);
|
|
||||||
|
|
||||||
//字符串与base64互转
|
|
||||||
static QString textToBase64(const QString &text);
|
|
||||||
static QString base64ToText(const QString &text);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // BASE64_H
|
|
|
@ -1,13 +1,13 @@
|
||||||
#include "base64.h"
|
#include "base64helper.h"
|
||||||
#include "qbuffer.h"
|
#include "qbuffer.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
|
||||||
QString Base64::imageToBase64(const QImage &image)
|
QString Base64Helper::imageToBase64(const QImage &image)
|
||||||
{
|
{
|
||||||
return QString(imageToBase64x(image));
|
return QString(imageToBase64x(image));
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Base64::imageToBase64x(const QImage &image)
|
QByteArray Base64Helper::imageToBase64x(const QImage &image)
|
||||||
{
|
{
|
||||||
//这个转换可能比较耗时建议在线程中执行
|
//这个转换可能比较耗时建议在线程中执行
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
|
@ -17,12 +17,12 @@ QByteArray Base64::imageToBase64x(const QImage &image)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Base64::base64ToImage(const QString &data)
|
QImage Base64Helper::base64ToImage(const QString &data)
|
||||||
{
|
{
|
||||||
return base64ToImagex(data.toUtf8());
|
return base64ToImagex(data.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Base64::base64ToImagex(const QByteArray &data)
|
QImage Base64Helper::base64ToImagex(const QByteArray &data)
|
||||||
{
|
{
|
||||||
//这个转换可能比较耗时建议在线程中执行
|
//这个转换可能比较耗时建议在线程中执行
|
||||||
QImage image;
|
QImage image;
|
||||||
|
@ -30,12 +30,12 @@ QImage Base64::base64ToImagex(const QByteArray &data)
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Base64::textToBase64(const QString &text)
|
QString Base64Helper::textToBase64(const QString &text)
|
||||||
{
|
{
|
||||||
return QString(text.toLocal8Bit().toBase64());
|
return QString(text.toLocal8Bit().toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Base64::base64ToText(const QString &text)
|
QString Base64Helper::base64ToText(const QString &text)
|
||||||
{
|
{
|
||||||
return QString(QByteArray::fromBase64(text.toLocal8Bit()));
|
return QString(QByteArray::fromBase64(text.toLocal8Bit()));
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef BASE64_H
|
#ifndef BASE64HELPER_H
|
||||||
#define BASE64_H
|
#define BASE64HELPER_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
#ifdef quc
|
#ifdef quc
|
||||||
class Q_DECL_EXPORT Base64
|
class Q_DECL_EXPORT Base64Helper
|
||||||
#else
|
#else
|
||||||
class Base64
|
class Base64Helper
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -34,4 +34,4 @@ public:
|
||||||
static QString base64ToText(const QString &text);
|
static QString base64ToText(const QString &text);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASE64_H
|
#endif // BASE64HELPER_H
|
|
@ -21,7 +21,7 @@ CONFIG += resources_big
|
||||||
include ($$PWD/h3.pri)
|
include ($$PWD/h3.pri)
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/base64.h \
|
$$PWD/base64helper.h \
|
||||||
$$PWD/iconhelper.h \
|
$$PWD/iconhelper.h \
|
||||||
$$PWD/quiconfig.h \
|
$$PWD/quiconfig.h \
|
||||||
$$PWD/quidateselect.h \
|
$$PWD/quidateselect.h \
|
||||||
|
@ -34,7 +34,7 @@ HEADERS += \
|
||||||
$$PWD/quiwidget.h
|
$$PWD/quiwidget.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/base64.cpp \
|
$$PWD/base64helper.cpp \
|
||||||
$$PWD/iconhelper.cpp \
|
$$PWD/iconhelper.cpp \
|
||||||
$$PWD/quiconfig.cpp \
|
$$PWD/quiconfig.cpp \
|
||||||
$$PWD/quidateselect.cpp \
|
$$PWD/quidateselect.cpp \
|
||||||
|
|
|
@ -55,7 +55,6 @@
|
||||||
#include "quihelper.h"
|
#include "quihelper.h"
|
||||||
#include "quiconfig.h"
|
#include "quiconfig.h"
|
||||||
#include "quistyle.h"
|
#include "quistyle.h"
|
||||||
#include "quihead.h"
|
|
||||||
#include "quimessagebox.h"
|
#include "quimessagebox.h"
|
||||||
#include "quitipbox.h"
|
#include "quitipbox.h"
|
||||||
#include "quidateselect.h"
|
#include "quidateselect.h"
|
||||||
|
|
|
@ -134,21 +134,29 @@ void QUIHelper::newDir(const QString &dirName)
|
||||||
|
|
||||||
void QUIHelper::sleep(int msec)
|
void QUIHelper::sleep(int msec)
|
||||||
{
|
{
|
||||||
if (msec > 0) {
|
if (msec <= 0) {
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,7,0))
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
|
QThread::msleep(msec);
|
||||||
|
#else
|
||||||
QTime endTime = QTime::currentTime().addMSecs(msec);
|
QTime endTime = QTime::currentTime().addMSecs(msec);
|
||||||
while (QTime::currentTime() < endTime) {
|
while (QTime::currentTime() < endTime) {
|
||||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
QThread::msleep(msec);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void QUIHelper::setCode(bool utf8)
|
void QUIHelper::setCode(bool utf8)
|
||||||
{
|
{
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
|
//如果想要控制台打印信息中文正常就注释掉这个设置
|
||||||
|
if (utf8) {
|
||||||
|
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||||
|
QTextCodec::setCodecForLocale(codec);
|
||||||
|
}
|
||||||
|
#else
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
QTextCodec *codec = QTextCodec::codecForName("gbk");
|
||||||
#else
|
#else
|
||||||
|
@ -157,12 +165,6 @@ void QUIHelper::setCode(bool utf8)
|
||||||
QTextCodec::setCodecForLocale(codec);
|
QTextCodec::setCodecForLocale(codec);
|
||||||
QTextCodec::setCodecForCStrings(codec);
|
QTextCodec::setCodecForCStrings(codec);
|
||||||
QTextCodec::setCodecForTr(codec);
|
QTextCodec::setCodecForTr(codec);
|
||||||
#else
|
|
||||||
//如果想要控制台打印信息中文正常就注释掉这个设置
|
|
||||||
if (utf8) {
|
|
||||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
|
||||||
QTextCodec::setCodecForLocale(codec);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +380,75 @@ void QUIHelper::runWithSystem(const QString &strName, const QString &strPath, bo
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QColor> QUIHelper::colors = QList<QColor>();
|
||||||
|
QList<QColor> QUIHelper::getColorList()
|
||||||
|
{
|
||||||
|
//备用颜色集合 可以自行添加
|
||||||
|
if (colors.count() == 0) {
|
||||||
|
colors << QColor(0, 176, 180) << QColor(0, 113, 193) << QColor(255, 192, 0);
|
||||||
|
colors << QColor(72, 103, 149) << QColor(185, 87, 86) << QColor(0, 177, 125);
|
||||||
|
colors << QColor(214, 77, 84) << QColor(71, 164, 233) << QColor(34, 163, 169);
|
||||||
|
colors << QColor(59, 123, 156) << QColor(162, 121, 197) << QColor(72, 202, 245);
|
||||||
|
colors << QColor(0, 150, 121) << QColor(111, 9, 176) << QColor(250, 170, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
return colors;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList QUIHelper::getColorNames()
|
||||||
|
{
|
||||||
|
QList<QColor> colors = getColorList();
|
||||||
|
QStringList colorNames;
|
||||||
|
foreach (QColor color, colors) {
|
||||||
|
colorNames << color.name();
|
||||||
|
}
|
||||||
|
return colorNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor QUIHelper::getRandColor()
|
||||||
|
{
|
||||||
|
QList<QColor> colors = getColorList();
|
||||||
|
int index = getRandValue(0, colors.count(), true);
|
||||||
|
return colors.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
double QUIHelper::getRandValue(int min, int max, bool contansMin, bool contansMax)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
#if (QT_VERSION <= QT_VERSION_CHECK(5,10,0))
|
||||||
|
//通用公式 a是起始值,n是整数的范围
|
||||||
|
//int value = a + rand() % n;
|
||||||
|
if (contansMin) {
|
||||||
|
if (contansMax) {
|
||||||
|
value = min + 0 + (rand() % (max - min + 1));
|
||||||
|
} else {
|
||||||
|
value = min + 0 + (rand() % (max - min + 0));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (contansMax) {
|
||||||
|
value = min + 1 + (rand() % (max - min + 0));
|
||||||
|
} else {
|
||||||
|
value = min + 1 + (rand() % (max - min - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (contansMin) {
|
||||||
|
if (contansMax) {
|
||||||
|
value = QRandomGenerator::global()->bounded(min + 0, max + 1);
|
||||||
|
} else {
|
||||||
|
value = QRandomGenerator::global()->bounded(min + 0, max + 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (contansMax) {
|
||||||
|
value = QRandomGenerator::global()->bounded(min + 1, max + 1);
|
||||||
|
} else {
|
||||||
|
value = QRandomGenerator::global()->bounded(min + 1, max + 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
QString QUIHelper::getIP(const QString &url)
|
QString QUIHelper::getIP(const QString &url)
|
||||||
{
|
{
|
||||||
//取出IP地址
|
//取出IP地址
|
||||||
|
|
|
@ -65,6 +65,16 @@ public:
|
||||||
//设置开机自启动
|
//设置开机自启动
|
||||||
static void runWithSystem(const QString &strName, const QString &strPath, bool autoRun = true);
|
static void runWithSystem(const QString &strName, const QString &strPath, bool autoRun = true);
|
||||||
|
|
||||||
|
//获取内置颜色集合
|
||||||
|
static QList<QColor> colors;
|
||||||
|
static QList<QColor> getColorList();
|
||||||
|
static QStringList getColorNames();
|
||||||
|
//随机获取颜色集合中的颜色
|
||||||
|
static QColor getRandColor();
|
||||||
|
|
||||||
|
//获取随机数,指定最小值和最大值
|
||||||
|
static double getRandValue(int min, int max, bool contansMin = false, bool contansMax = false);
|
||||||
|
|
||||||
//从字符串获取IP地址
|
//从字符串获取IP地址
|
||||||
static QString getIP(const QString &url);
|
static QString getIP(const QString &url);
|
||||||
//判断是否是IP地址
|
//判断是否是IP地址
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtSql>
|
#include <QtSql>
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define FFMPEG_H
|
#define FFMPEG_H
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,72 @@
|
||||||
#ifndef BASE64_H
|
/*
|
||||||
#define BASE64_H
|
* Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
|
||||||
|
*
|
||||||
/**
|
* This file is part of FFmpeg.
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
*
|
||||||
* 1. 图片转base64字符串。
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
* 2. base64字符串转图片。
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* 3. 字符转base64字符串。
|
* License as published by the Free Software Foundation; either
|
||||||
* 4. base64字符串转字符。
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
* 5. 后期增加数据压缩。
|
*
|
||||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%。
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QImage>
|
#ifndef AVUTIL_BASE64_H
|
||||||
|
#define AVUTIL_BASE64_H
|
||||||
|
|
||||||
#ifdef quc
|
#include <stdint.h>
|
||||||
class Q_DECL_EXPORT Base64
|
|
||||||
#else
|
|
||||||
class Base64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
/**
|
||||||
public:
|
* @defgroup lavu_base64 Base64
|
||||||
//图片转base64字符串
|
* @ingroup lavu_crypto
|
||||||
static QString imageToBase64(const QImage &image);
|
* @{
|
||||||
static QByteArray imageToBase64x(const QImage &image);
|
*/
|
||||||
|
|
||||||
//base64字符串转图片
|
/**
|
||||||
static QImage base64ToImage(const QString &data);
|
* Decode a base64-encoded string.
|
||||||
static QImage base64ToImagex(const QByteArray &data);
|
*
|
||||||
|
* @param out buffer for decoded data
|
||||||
|
* @param in null-terminated input string
|
||||||
|
* @param out_size size in bytes of the out buffer, must be at
|
||||||
|
* least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
|
||||||
|
* @return number of bytes written, or a negative value in case of
|
||||||
|
* invalid input
|
||||||
|
*/
|
||||||
|
int av_base64_decode(uint8_t *out, const char *in, int out_size);
|
||||||
|
|
||||||
//字符串与base64互转
|
/**
|
||||||
static QString textToBase64(const QString &text);
|
* Calculate the output size in bytes needed to decode a base64 string
|
||||||
static QString base64ToText(const QString &text);
|
* with length x to a data buffer.
|
||||||
};
|
*/
|
||||||
|
#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
|
||||||
|
|
||||||
#endif // BASE64_H
|
/**
|
||||||
|
* Encode data to base64 and null-terminate.
|
||||||
|
*
|
||||||
|
* @param out buffer for encoded data
|
||||||
|
* @param out_size size in bytes of the out buffer (including the
|
||||||
|
* null terminator), must be at least AV_BASE64_SIZE(in_size)
|
||||||
|
* @param in input buffer containing the data to encode
|
||||||
|
* @param in_size size in bytes of the in buffer
|
||||||
|
* @return out or NULL in case of error
|
||||||
|
*/
|
||||||
|
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the output size needed to base64-encode x bytes to a
|
||||||
|
* null-terminated string.
|
||||||
|
*/
|
||||||
|
#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* AVUTIL_BASE64_H */
|
||||||
|
|
|
@ -1,37 +1,72 @@
|
||||||
#ifndef BASE64_H
|
/*
|
||||||
#define BASE64_H
|
* Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
|
||||||
|
*
|
||||||
/**
|
* This file is part of FFmpeg.
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
*
|
||||||
* 1. 图片转base64字符串。
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
* 2. base64字符串转图片。
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* 3. 字符转base64字符串。
|
* License as published by the Free Software Foundation; either
|
||||||
* 4. base64字符串转字符。
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
* 5. 后期增加数据压缩。
|
*
|
||||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%。
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QImage>
|
#ifndef AVUTIL_BASE64_H
|
||||||
|
#define AVUTIL_BASE64_H
|
||||||
|
|
||||||
#ifdef quc
|
#include <stdint.h>
|
||||||
class Q_DECL_EXPORT Base64
|
|
||||||
#else
|
|
||||||
class Base64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
/**
|
||||||
public:
|
* @defgroup lavu_base64 Base64
|
||||||
//图片转base64字符串
|
* @ingroup lavu_crypto
|
||||||
static QString imageToBase64(const QImage &image);
|
* @{
|
||||||
static QByteArray imageToBase64x(const QImage &image);
|
*/
|
||||||
|
|
||||||
//base64字符串转图片
|
/**
|
||||||
static QImage base64ToImage(const QString &data);
|
* Decode a base64-encoded string.
|
||||||
static QImage base64ToImagex(const QByteArray &data);
|
*
|
||||||
|
* @param out buffer for decoded data
|
||||||
|
* @param in null-terminated input string
|
||||||
|
* @param out_size size in bytes of the out buffer, must be at
|
||||||
|
* least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
|
||||||
|
* @return number of bytes written, or a negative value in case of
|
||||||
|
* invalid input
|
||||||
|
*/
|
||||||
|
int av_base64_decode(uint8_t *out, const char *in, int out_size);
|
||||||
|
|
||||||
//字符串与base64互转
|
/**
|
||||||
static QString textToBase64(const QString &text);
|
* Calculate the output size in bytes needed to decode a base64 string
|
||||||
static QString base64ToText(const QString &text);
|
* with length x to a data buffer.
|
||||||
};
|
*/
|
||||||
|
#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
|
||||||
|
|
||||||
#endif // BASE64_H
|
/**
|
||||||
|
* Encode data to base64 and null-terminate.
|
||||||
|
*
|
||||||
|
* @param out buffer for encoded data
|
||||||
|
* @param out_size size in bytes of the out buffer (including the
|
||||||
|
* null terminator), must be at least AV_BASE64_SIZE(in_size)
|
||||||
|
* @param in input buffer containing the data to encode
|
||||||
|
* @param in_size size in bytes of the in buffer
|
||||||
|
* @return out or NULL in case of error
|
||||||
|
*/
|
||||||
|
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the output size needed to base64-encode x bytes to a
|
||||||
|
* null-terminated string.
|
||||||
|
*/
|
||||||
|
#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* AVUTIL_BASE64_H */
|
||||||
|
|
|
@ -1,37 +1,72 @@
|
||||||
#ifndef BASE64_H
|
/*
|
||||||
#define BASE64_H
|
* Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
|
||||||
|
*
|
||||||
/**
|
* This file is part of FFmpeg.
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
*
|
||||||
* 1. 图片转base64字符串。
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
* 2. base64字符串转图片。
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* 3. 字符转base64字符串。
|
* License as published by the Free Software Foundation; either
|
||||||
* 4. base64字符串转字符。
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
* 5. 后期增加数据压缩。
|
*
|
||||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%。
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QImage>
|
#ifndef AVUTIL_BASE64_H
|
||||||
|
#define AVUTIL_BASE64_H
|
||||||
|
|
||||||
#ifdef quc
|
#include <stdint.h>
|
||||||
class Q_DECL_EXPORT Base64
|
|
||||||
#else
|
|
||||||
class Base64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
/**
|
||||||
public:
|
* @defgroup lavu_base64 Base64
|
||||||
//图片转base64字符串
|
* @ingroup lavu_crypto
|
||||||
static QString imageToBase64(const QImage &image);
|
* @{
|
||||||
static QByteArray imageToBase64x(const QImage &image);
|
*/
|
||||||
|
|
||||||
//base64字符串转图片
|
/**
|
||||||
static QImage base64ToImage(const QString &data);
|
* Decode a base64-encoded string.
|
||||||
static QImage base64ToImagex(const QByteArray &data);
|
*
|
||||||
|
* @param out buffer for decoded data
|
||||||
|
* @param in null-terminated input string
|
||||||
|
* @param out_size size in bytes of the out buffer, must be at
|
||||||
|
* least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
|
||||||
|
* @return number of bytes written, or a negative value in case of
|
||||||
|
* invalid input
|
||||||
|
*/
|
||||||
|
int av_base64_decode(uint8_t *out, const char *in, int out_size);
|
||||||
|
|
||||||
//字符串与base64互转
|
/**
|
||||||
static QString textToBase64(const QString &text);
|
* Calculate the output size in bytes needed to decode a base64 string
|
||||||
static QString base64ToText(const QString &text);
|
* with length x to a data buffer.
|
||||||
};
|
*/
|
||||||
|
#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
|
||||||
|
|
||||||
#endif // BASE64_H
|
/**
|
||||||
|
* Encode data to base64 and null-terminate.
|
||||||
|
*
|
||||||
|
* @param out buffer for encoded data
|
||||||
|
* @param out_size size in bytes of the out buffer (including the
|
||||||
|
* null terminator), must be at least AV_BASE64_SIZE(in_size)
|
||||||
|
* @param in input buffer containing the data to encode
|
||||||
|
* @param in_size size in bytes of the in buffer
|
||||||
|
* @return out or NULL in case of error
|
||||||
|
*/
|
||||||
|
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the output size needed to base64-encode x bytes to a
|
||||||
|
* null-terminated string.
|
||||||
|
*/
|
||||||
|
#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* AVUTIL_BASE64_H */
|
||||||
|
|
|
@ -1,37 +1,72 @@
|
||||||
#ifndef BASE64_H
|
/*
|
||||||
#define BASE64_H
|
* Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com)
|
||||||
|
*
|
||||||
/**
|
* This file is part of FFmpeg.
|
||||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
*
|
||||||
* 1. 图片转base64字符串。
|
* FFmpeg is free software; you can redistribute it and/or
|
||||||
* 2. base64字符串转图片。
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* 3. 字符转base64字符串。
|
* License as published by the Free Software Foundation; either
|
||||||
* 4. base64字符串转字符。
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
* 5. 后期增加数据压缩。
|
*
|
||||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%。
|
* FFmpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QImage>
|
#ifndef AVUTIL_BASE64_H
|
||||||
|
#define AVUTIL_BASE64_H
|
||||||
|
|
||||||
#ifdef quc
|
#include <stdint.h>
|
||||||
class Q_DECL_EXPORT Base64
|
|
||||||
#else
|
|
||||||
class Base64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
/**
|
||||||
public:
|
* @defgroup lavu_base64 Base64
|
||||||
//图片转base64字符串
|
* @ingroup lavu_crypto
|
||||||
static QString imageToBase64(const QImage &image);
|
* @{
|
||||||
static QByteArray imageToBase64x(const QImage &image);
|
*/
|
||||||
|
|
||||||
//base64字符串转图片
|
/**
|
||||||
static QImage base64ToImage(const QString &data);
|
* Decode a base64-encoded string.
|
||||||
static QImage base64ToImagex(const QByteArray &data);
|
*
|
||||||
|
* @param out buffer for decoded data
|
||||||
|
* @param in null-terminated input string
|
||||||
|
* @param out_size size in bytes of the out buffer, must be at
|
||||||
|
* least 3/4 of the length of in, that is AV_BASE64_DECODE_SIZE(strlen(in))
|
||||||
|
* @return number of bytes written, or a negative value in case of
|
||||||
|
* invalid input
|
||||||
|
*/
|
||||||
|
int av_base64_decode(uint8_t *out, const char *in, int out_size);
|
||||||
|
|
||||||
//字符串与base64互转
|
/**
|
||||||
static QString textToBase64(const QString &text);
|
* Calculate the output size in bytes needed to decode a base64 string
|
||||||
static QString base64ToText(const QString &text);
|
* with length x to a data buffer.
|
||||||
};
|
*/
|
||||||
|
#define AV_BASE64_DECODE_SIZE(x) ((x) * 3LL / 4)
|
||||||
|
|
||||||
#endif // BASE64_H
|
/**
|
||||||
|
* Encode data to base64 and null-terminate.
|
||||||
|
*
|
||||||
|
* @param out buffer for encoded data
|
||||||
|
* @param out_size size in bytes of the out buffer (including the
|
||||||
|
* null terminator), must be at least AV_BASE64_SIZE(in_size)
|
||||||
|
* @param in input buffer containing the data to encode
|
||||||
|
* @param in_size size in bytes of the in buffer
|
||||||
|
* @return out or NULL in case of error
|
||||||
|
*/
|
||||||
|
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the output size needed to base64-encode x bytes to a
|
||||||
|
* null-terminated string.
|
||||||
|
*/
|
||||||
|
#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* AVUTIL_BASE64_H */
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
QT += core gui
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat
|
|
||||||
|
|
||||||
TARGET = frameless
|
|
||||||
TEMPLATE = app
|
|
||||||
DESTDIR = $$PWD/../bin
|
|
||||||
|
|
||||||
CONFIG += warn_off
|
|
||||||
HEADERS += head.h
|
|
||||||
SOURCES += main.cpp
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
|
||||||
INCLUDEPATH += $$PWD/form
|
|
||||||
include ($$PWD/form/form.pri)
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../core_frameless
|
|
||||||
include ($$PWD/../core_frameless/core_frameless.pri)
|
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD/../core_common
|
|
||||||
include ($$PWD/../core_common/core_common.pri)
|
|
|
@ -1,746 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 4.14.0, 2021-08-31T16:37:05. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{849db446-6f90-46aa-afcf-9e726de1fb02}</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
|
||||||
<value type="int">1</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
|
||||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
|
||||||
<value type="QString" key="language">Cpp</value>
|
|
||||||
<valuemap type="QVariantMap" key="value">
|
|
||||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
|
||||||
</valuemap>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
|
||||||
<value type="QString" key="language">QmlJS</value>
|
|
||||||
<valuemap type="QVariantMap" key="value">
|
|
||||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
|
||||||
</valuemap>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
|
||||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
|
||||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
|
||||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
|
||||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
|
||||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
|
||||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">0</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
|
||||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
|
||||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
|
||||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
|
||||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="QString" key="DeviceType">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">desk5.7.0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">desk5.7.0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{30975ac4-3883-489b-ac7a-132064e40ec0}</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk5_7_0-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk5_7_0-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk5_7_0-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk5_7_0-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk5_7_0-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk5_7_0-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
|
||||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
|
||||||
<value type="QString">cpu-cycles</value>
|
|
||||||
</valuelist>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
|
||||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
|
||||||
<value type="QString">-e</value>
|
|
||||||
<value type="QString">cpu-cycles</value>
|
|
||||||
<value type="QString">--call-graph</value>
|
|
||||||
<value type="QString">dwarf,4096</value>
|
|
||||||
<value type="QString">-F</value>
|
|
||||||
<value type="QString">250</value>
|
|
||||||
</valuelist>
|
|
||||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
|
||||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
|
||||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
|
||||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
|
||||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
|
||||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
|
||||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
|
||||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
|
||||||
<value type="int">0</value>
|
|
||||||
<value type="int">1</value>
|
|
||||||
<value type="int">2</value>
|
|
||||||
<value type="int">3</value>
|
|
||||||
<value type="int">4</value>
|
|
||||||
<value type="int">5</value>
|
|
||||||
<value type="int">6</value>
|
|
||||||
<value type="int">7</value>
|
|
||||||
<value type="int">8</value>
|
|
||||||
<value type="int">9</value>
|
|
||||||
<value type="int">10</value>
|
|
||||||
<value type="int">11</value>
|
|
||||||
<value type="int">12</value>
|
|
||||||
<value type="int">13</value>
|
|
||||||
<value type="int">14</value>
|
|
||||||
</valuelist>
|
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/frameless/frameless.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">I:/gitee/QWidgetDemo/frameless/frameless.pro</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">I:/gitee/QWidgetDemo/core_common/../bin</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Target.1</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="QString" key="DeviceType">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">desk5.7.1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">desk5.7.1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{dde7e584-9f35-480c-9d61-83b32a324d7c}</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk5_7_1-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk5_7_1-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk5_7_1-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk5_7_1-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk5_7_1-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk5_7_1-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
|
||||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
|
||||||
<value type="QString">cpu-cycles</value>
|
|
||||||
</valuelist>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
|
||||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
|
||||||
<value type="QString">-e</value>
|
|
||||||
<value type="QString">cpu-cycles</value>
|
|
||||||
<value type="QString">--call-graph</value>
|
|
||||||
<value type="QString">dwarf,4096</value>
|
|
||||||
<value type="QString">-F</value>
|
|
||||||
<value type="QString">250</value>
|
|
||||||
</valuelist>
|
|
||||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
|
||||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
|
||||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
|
||||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
|
||||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
|
||||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
|
||||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
|
||||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
|
||||||
<value type="int">0</value>
|
|
||||||
<value type="int">1</value>
|
|
||||||
<value type="int">2</value>
|
|
||||||
<value type="int">3</value>
|
|
||||||
<value type="int">4</value>
|
|
||||||
<value type="int">5</value>
|
|
||||||
<value type="int">6</value>
|
|
||||||
<value type="int">7</value>
|
|
||||||
<value type="int">8</value>
|
|
||||||
<value type="int">9</value>
|
|
||||||
<value type="int">10</value>
|
|
||||||
<value type="int">11</value>
|
|
||||||
<value type="int">12</value>
|
|
||||||
<value type="int">13</value>
|
|
||||||
<value type="int">14</value>
|
|
||||||
</valuelist>
|
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/frameless/frameless.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">I:/gitee/QWidgetDemo/frameless/frameless.pro</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">I:/gitee/QWidgetDemo/core_common/../bin</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Target.2</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="QString" key="DeviceType">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">desk6.2.0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">desk6.2.0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5a1d4711-9200-4ff6-be1e-e1f5a4d5b8d2}</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk6_2_0-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk6_2_0-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk6_2_0-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk6_2_0-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">I:\gitee\QWidgetDemo\build-frameless-desk6_2_0-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">I:/gitee/QWidgetDemo/build-frameless-desk6_2_0-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="RunSystemFunction">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
|
||||||
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
|
|
||||||
<value type="QString">cpu-cycles</value>
|
|
||||||
</valuelist>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
|
|
||||||
<value type="int" key="Analyzer.Perf.Frequency">250</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
|
|
||||||
<value type="QString">-e</value>
|
|
||||||
<value type="QString">cpu-cycles</value>
|
|
||||||
<value type="QString">--call-graph</value>
|
|
||||||
<value type="QString">dwarf,4096</value>
|
|
||||||
<value type="QString">-F</value>
|
|
||||||
<value type="QString">250</value>
|
|
||||||
</valuelist>
|
|
||||||
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
|
|
||||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
|
||||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
|
||||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
|
||||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
|
||||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
|
||||||
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
|
||||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
|
||||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
|
||||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
|
||||||
<value type="int">0</value>
|
|
||||||
<value type="int">1</value>
|
|
||||||
<value type="int">2</value>
|
|
||||||
<value type="int">3</value>
|
|
||||||
<value type="int">4</value>
|
|
||||||
<value type="int">5</value>
|
|
||||||
<value type="int">6</value>
|
|
||||||
<value type="int">7</value>
|
|
||||||
<value type="int">8</value>
|
|
||||||
<value type="int">9</value>
|
|
||||||
<value type="int">10</value>
|
|
||||||
<value type="int">11</value>
|
|
||||||
<value type="int">12</value>
|
|
||||||
<value type="int">13</value>
|
|
||||||
<value type="int">14</value>
|
|
||||||
</valuelist>
|
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:I:/gitee/QWidgetDemo/frameless/frameless.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">I:/gitee/QWidgetDemo/frameless/frameless.pro</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">I:/gitee/QWidgetDemo/core_common/../bin</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
|
||||||
<value type="int">3</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
|
||||||
<value type="int">22</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>Version</variable>
|
|
||||||
<value type="int">22</value>
|
|
||||||
</data>
|
|
||||||
</qtcreator>
|
|
|
@ -1,15 +0,0 @@
|
||||||
#include <QtCore>
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
|
||||||
#include <QtWidgets>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
|
||||||
#include <QtCore5Compat>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TIMEMS qPrintable(QTime::currentTime().toString("HH:mm:ss zzz"))
|
|
||||||
#define DATETIME qPrintable(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss"))
|
|
||||||
#pragma execution_character_set("utf-8")
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#include "quihelper.h"
|
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "widget.h"
|
|
||||||
#include "dialog.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
|
||||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor);
|
|
||||||
#endif
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
|
|
||||||
QUIHelper::setStyle();
|
|
||||||
QUIHelper::setFont(15);
|
|
||||||
QUIHelper::setCode();
|
|
||||||
|
|
||||||
MainWindow w;
|
|
||||||
//Widget w;
|
|
||||||
//Dialog w;
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
|
||||||
w.resize(800, 600);
|
|
||||||
#else
|
|
||||||
w.resize(800, 550);
|
|
||||||
#endif
|
|
||||||
QUIHelper::setFormInCenter(&w);
|
|
||||||
w.show();
|
|
||||||
return a.exec();
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
### 一 前言
|
|
||||||
不知道各位程序员有没有遇到过这样一种困惑,好不容易在开源网站找到了类似的想要的项目代码,结果down下来一编译,我勒个去,几百个错误,根本没法用,熟悉的人还好可以直接阅读代码进行修改(有些只要做小改动就能正常编译,有些可能需要大刀阔斧),可是对于绝大部分的初学者来说绝对是噩梦,连把代码看下去的勇气都没有,我们没有任何权利和理由去责怪开原作者,只是期望各位能够在项目开源的同时,将开源项目完善好、测试好,最起码要把项目中依赖的遗漏的文件一起打包好,或者作出必要的说明,比如对应的开发编译版本要求,以来的文件去哪里下载。很多优秀的项目就毁在这个地方,没人完善和维护(可能因为没有耐心,也没有持续的收入来源,所以干的没劲,作者甚至转行送外卖了)。只有解决了这个痛点才能使得对应的开源项目持续发光发热。
|
|
||||||
|
|
||||||
本人自从学习Qt开发以来,开源过至少上百个项目(大部分早期开源的目前不在开源主页,有空会全部整理好重新发布),我要是说在国内Qt界开源的项目数量和质量排第十的话,没人敢说排第一、第二、第三...到第九。关于无边框界面方案,网上也有不少的优秀的开源的例子,99%都存在以下几个问题,针对以上问题,解决这些痛点,借助自己刚好有多个操作系统、几十个Qt版本的开发测试环境,特意完善了这个无边框类。
|
|
||||||
|
|
||||||
- 无法正常编译,缺少文件,作者真粗心,自己都没测试过。
|
|
||||||
- 只限定了部分特定的版本才能编译。
|
|
||||||
- 只解决了单个问题,比如无边框拖动,没有系统特性拉到左侧右侧半屏、顶部最大化。
|
|
||||||
- 代码赶鸭子上架,复制粘贴的一坨坨,毫无章法。
|
|
||||||
- 代码就是给作者自己用的,放上去就是给个参考,管他那么多。
|
|
||||||
- 往左侧拉动抖动的厉害。
|
|
||||||
- mac系统上不能最小化。
|
|
||||||
- 不能同时支持win、linux、mac三种主流操作系统。
|
|
||||||
|
|
||||||
### 二 功能特点
|
|
||||||
1. 同时支持Qt4-Qt6,亲测Qt4.7到Qt6.2以及后续版本。
|
|
||||||
2. 同时支持mingw、msvc、gcc等。
|
|
||||||
3. 同时支持windows、linux、mac。
|
|
||||||
4. 同时支持QMainWindow、QWidget、QDialog。
|
|
||||||
5. 使用方法极其简单,只需要将继承类修改即可。
|
|
||||||
6. 自动识别双击标题栏响应。
|
|
||||||
7. 无边框拉伸在windows下不抖动。
|
|
||||||
8. 在windows下具有移动到边缘半屏、移动到顶部全屏特性。
|
|
||||||
9. 解决mac系统上无边框最小化最大化失效的BUG。
|
|
||||||
10. 解决系统休眠后再次启动程序懵逼的BUG。
|
|
||||||
11. 解决有时候窗体重新显示的时候假死不刷新的BUG。
|
|
||||||
12. 轻量级,1个代码文件,核心代码行数不到300行。
|
|
||||||
13. 注释详细,示例完美,非常适合阅读和学习。
|
|
||||||
14. 开源开箱即用,保证任意Qt版本可正常编译运行,无需任何调整。
|
|
||||||
|
|
||||||
### 三 效果图
|
|
||||||
#### 1 windows
|
|
||||||
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/frameless/snap/win.gif)
|
|
||||||
|
|
||||||
#### 2 ubuntu
|
|
||||||
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/frameless/snap/ubuntu.gif)
|
|
||||||
|
|
||||||
#### 3 uos
|
|
||||||
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/frameless/snap/uos.gif)
|
|
||||||
|
|
||||||
#### 4 kylin
|
|
||||||
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/frameless/snap/kylin.gif)
|
|
||||||
|
|
||||||
#### 5 mac
|
|
||||||
![avatar](https://gitee.com/feiyangqingyun/QWidgetDemo/raw/master/frameless/snap/mac.gif)
|
|
||||||
|
|
||||||
### 四 特别说明
|
|
||||||
1. 点赞、评论、留言、转发、发代码。
|
|
||||||
2. 国内站点:[https://gitee.com/feiyangqingyun/QWidgetDemo](https://gitee.com/feiyangqingyun/QWidgetDemo)
|
|
||||||
3. 国际站点:[https://github.com/feiyangqingyun/QWidgetDemo](https://github.com/feiyangqingyun/QWidgetDemo)
|
|
Binary file not shown.
Before Width: | Height: | Size: 460 KiB |
Binary file not shown.
Before Width: | Height: | Size: 720 KiB |
Binary file not shown.
Before Width: | Height: | Size: 841 KiB |
Binary file not shown.
Before Width: | Height: | Size: 323 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 MiB |
|
@ -1,7 +1,7 @@
|
||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "ui_dialog.h"
|
#include "ui_dialog.h"
|
||||||
#include "head.h"
|
|
||||||
|
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
Dialog::Dialog(QWidget *parent) : FramelessDialog(parent), ui(new Ui::Dialog)
|
Dialog::Dialog(QWidget *parent) : FramelessDialog(parent), ui(new Ui::Dialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
|
@ -1,7 +1,7 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "head.h"
|
|
||||||
|
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
MainWindow::MainWindow(QWidget *parent) : FramelessMainWindow(parent), ui(new Ui::MainWindow)
|
MainWindow::MainWindow(QWidget *parent) : FramelessMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
|
@ -1,7 +1,7 @@
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "ui_widget.h"
|
#include "ui_widget.h"
|
||||||
#include "head.h"
|
|
||||||
|
|
||||||
|
#pragma execution_character_set("utf-8")
|
||||||
Widget::Widget(QWidget *parent) : FramelessWidget(parent), ui(new Ui::Widget)
|
Widget::Widget(QWidget *parent) : FramelessWidget(parent), ui(new Ui::Widget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
|
@ -1,221 +0,0 @@
|
||||||
#include "framelesswidget.h"
|
|
||||||
#include "qevent.h"
|
|
||||||
#include "qdebug.h"
|
|
||||||
|
|
||||||
FramelessWidget::FramelessWidget(QObject *parent) : QObject(parent)
|
|
||||||
{
|
|
||||||
padding = 8;
|
|
||||||
moveEnable = true;
|
|
||||||
resizeEnable = true;
|
|
||||||
widget = 0;
|
|
||||||
|
|
||||||
mousePressed = false;
|
|
||||||
mousePoint = QPoint(0, 0);
|
|
||||||
mouseRect = QRect(0, 0, 0, 0);
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
pressedArea << false;
|
|
||||||
pressedRect << QRect(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//如果父类是窗体则直接设置
|
|
||||||
if (parent->isWidgetType()) {
|
|
||||||
setWidget((QWidget *)parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FramelessWidget::eventFilter(QObject *watched, QEvent *event)
|
|
||||||
{
|
|
||||||
if (widget != 0 && watched == widget) {
|
|
||||||
if (event->type() == QEvent::WindowStateChange) {
|
|
||||||
//解决mac系统上无边框最小化失效的BUG
|
|
||||||
#ifdef Q_OS_MACOS
|
|
||||||
if (widget->windowState() & Qt::WindowMinimized) {
|
|
||||||
isMin = true;
|
|
||||||
} else {
|
|
||||||
if (isMin) {
|
|
||||||
//设置无边框属性
|
|
||||||
widget->setWindowFlags(flags | Qt::FramelessWindowHint);
|
|
||||||
widget->setVisible(true);
|
|
||||||
isMin = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else if (event->type() == QEvent::Resize) {
|
|
||||||
//重新计算八个描点的区域,描点区域的作用还有就是计算鼠标坐标是否在某一个区域内
|
|
||||||
int width = widget->width();
|
|
||||||
int height = widget->height();
|
|
||||||
|
|
||||||
//左侧描点区域
|
|
||||||
pressedRect[0] = QRect(0, padding, padding, height - padding * 2);
|
|
||||||
//右侧描点区域
|
|
||||||
pressedRect[1] = QRect(width - padding, padding, padding, height - padding * 2);
|
|
||||||
//上侧描点区域
|
|
||||||
pressedRect[2] = QRect(padding, 0, width - padding * 2, padding);
|
|
||||||
//下侧描点区域
|
|
||||||
pressedRect[3] = QRect(padding, height - padding, width - padding * 2, padding);
|
|
||||||
|
|
||||||
//左上角描点区域
|
|
||||||
pressedRect[4] = QRect(0, 0, padding, padding);
|
|
||||||
//右上角描点区域
|
|
||||||
pressedRect[5] = QRect(width - padding, 0, padding, padding);
|
|
||||||
//左下角描点区域
|
|
||||||
pressedRect[6] = QRect(0, height - padding, padding, padding);
|
|
||||||
//右下角描点区域
|
|
||||||
pressedRect[7] = QRect(width - padding, height - padding, padding, padding);
|
|
||||||
} else if (event->type() == QEvent::HoverMove) {
|
|
||||||
//设置对应鼠标形状,这个必须放在这里而不是下面,因为可以在鼠标没有按下的时候识别
|
|
||||||
QHoverEvent *hoverEvent = (QHoverEvent *)event;
|
|
||||||
QPoint point = hoverEvent->pos();
|
|
||||||
if (resizeEnable) {
|
|
||||||
if (pressedRect.at(0).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeHorCursor);
|
|
||||||
} else if (pressedRect.at(1).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeHorCursor);
|
|
||||||
} else if (pressedRect.at(2).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeVerCursor);
|
|
||||||
} else if (pressedRect.at(3).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeVerCursor);
|
|
||||||
} else if (pressedRect.at(4).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeFDiagCursor);
|
|
||||||
} else if (pressedRect.at(5).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeBDiagCursor);
|
|
||||||
} else if (pressedRect.at(6).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeBDiagCursor);
|
|
||||||
} else if (pressedRect.at(7).contains(point)) {
|
|
||||||
widget->setCursor(Qt::SizeFDiagCursor);
|
|
||||||
} else {
|
|
||||||
widget->setCursor(Qt::ArrowCursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据当前鼠标位置,计算XY轴移动了多少
|
|
||||||
int offsetX = point.x() - mousePoint.x();
|
|
||||||
int offsetY = point.y() - mousePoint.y();
|
|
||||||
|
|
||||||
//根据按下处的位置判断是否是移动控件还是拉伸控件
|
|
||||||
if (moveEnable && mousePressed) {
|
|
||||||
widget->move(widget->x() + offsetX, widget->y() + offsetY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resizeEnable) {
|
|
||||||
int rectX = mouseRect.x();
|
|
||||||
int rectY = mouseRect.y();
|
|
||||||
int rectW = mouseRect.width();
|
|
||||||
int rectH = mouseRect.height();
|
|
||||||
|
|
||||||
if (pressedArea.at(0)) {
|
|
||||||
int resizeW = widget->width() - offsetX;
|
|
||||||
if (widget->minimumWidth() <= resizeW) {
|
|
||||||
widget->setGeometry(widget->x() + offsetX, rectY, resizeW, rectH);
|
|
||||||
}
|
|
||||||
} else if (pressedArea.at(1)) {
|
|
||||||
widget->setGeometry(rectX, rectY, rectW + offsetX, rectH);
|
|
||||||
} else if (pressedArea.at(2)) {
|
|
||||||
int resizeH = widget->height() - offsetY;
|
|
||||||
if (widget->minimumHeight() <= resizeH) {
|
|
||||||
widget->setGeometry(rectX, widget->y() + offsetY, rectW, resizeH);
|
|
||||||
}
|
|
||||||
} else if (pressedArea.at(3)) {
|
|
||||||
widget->setGeometry(rectX, rectY, rectW, rectH + offsetY);
|
|
||||||
} else if (pressedArea.at(4)) {
|
|
||||||
int resizeW = widget->width() - offsetX;
|
|
||||||
int resizeH = widget->height() - offsetY;
|
|
||||||
if (widget->minimumWidth() <= resizeW) {
|
|
||||||
widget->setGeometry(widget->x() + offsetX, widget->y(), resizeW, resizeH);
|
|
||||||
}
|
|
||||||
if (widget->minimumHeight() <= resizeH) {
|
|
||||||
widget->setGeometry(widget->x(), widget->y() + offsetY, resizeW, resizeH);
|
|
||||||
}
|
|
||||||
} else if (pressedArea.at(5)) {
|
|
||||||
int resizeW = rectW + offsetX;
|
|
||||||
int resizeH = widget->height() - offsetY;
|
|
||||||
if (widget->minimumHeight() <= resizeH) {
|
|
||||||
widget->setGeometry(widget->x(), widget->y() + offsetY, resizeW, resizeH);
|
|
||||||
}
|
|
||||||
} else if (pressedArea.at(6)) {
|
|
||||||
int resizeW = widget->width() - offsetX;
|
|
||||||
int resizeH = rectH + offsetY;
|
|
||||||
if (widget->minimumWidth() <= resizeW) {
|
|
||||||
widget->setGeometry(widget->x() + offsetX, widget->y(), resizeW, resizeH);
|
|
||||||
}
|
|
||||||
if (widget->minimumHeight() <= resizeH) {
|
|
||||||
widget->setGeometry(widget->x(), widget->y(), resizeW, resizeH);
|
|
||||||
}
|
|
||||||
} else if (pressedArea.at(7)) {
|
|
||||||
int resizeW = rectW + offsetX;
|
|
||||||
int resizeH = rectH + offsetY;
|
|
||||||
widget->setGeometry(widget->x(), widget->y(), resizeW, resizeH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (event->type() == QEvent::MouseButtonPress) {
|
|
||||||
//记住鼠标按下的坐标+窗体区域
|
|
||||||
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
|
||||||
mousePoint = mouseEvent->pos();
|
|
||||||
mouseRect = widget->geometry();
|
|
||||||
|
|
||||||
//判断按下的手柄的区域位置
|
|
||||||
if (pressedRect.at(0).contains(mousePoint)) {
|
|
||||||
pressedArea[0] = true;
|
|
||||||
} else if (pressedRect.at(1).contains(mousePoint)) {
|
|
||||||
pressedArea[1] = true;
|
|
||||||
} else if (pressedRect.at(2).contains(mousePoint)) {
|
|
||||||
pressedArea[2] = true;
|
|
||||||
} else if (pressedRect.at(3).contains(mousePoint)) {
|
|
||||||
pressedArea[3] = true;
|
|
||||||
} else if (pressedRect.at(4).contains(mousePoint)) {
|
|
||||||
pressedArea[4] = true;
|
|
||||||
} else if (pressedRect.at(5).contains(mousePoint)) {
|
|
||||||
pressedArea[5] = true;
|
|
||||||
} else if (pressedRect.at(6).contains(mousePoint)) {
|
|
||||||
pressedArea[6] = true;
|
|
||||||
} else if (pressedRect.at(7).contains(mousePoint)) {
|
|
||||||
pressedArea[7] = true;
|
|
||||||
} else {
|
|
||||||
mousePressed = true;
|
|
||||||
}
|
|
||||||
} else if (event->type() == QEvent::MouseMove) {
|
|
||||||
//改成用HoverMove识别
|
|
||||||
} else if (event->type() == QEvent::MouseButtonRelease) {
|
|
||||||
//恢复所有
|
|
||||||
widget->setCursor(Qt::ArrowCursor);
|
|
||||||
mousePressed = false;
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
pressedArea[i] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QObject::eventFilter(watched, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessWidget::setPadding(int padding)
|
|
||||||
{
|
|
||||||
this->padding = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessWidget::setMoveEnable(bool moveEnable)
|
|
||||||
{
|
|
||||||
this->moveEnable = moveEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessWidget::setResizeEnable(bool resizeEnable)
|
|
||||||
{
|
|
||||||
this->resizeEnable = resizeEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FramelessWidget::setWidget(QWidget *widget)
|
|
||||||
{
|
|
||||||
if (this->widget == 0) {
|
|
||||||
this->widget = widget;
|
|
||||||
//设置鼠标追踪为真
|
|
||||||
this->widget->setMouseTracking(true);
|
|
||||||
//绑定事件过滤器
|
|
||||||
this->widget->installEventFilter(this);
|
|
||||||
//设置悬停为真,必须设置这个,不然当父窗体里边还有子窗体全部遮挡了识别不到MouseMove,需要识别HoverMove
|
|
||||||
this->widget->setAttribute(Qt::WA_Hover, true);
|
|
||||||
|
|
||||||
isMin = false;
|
|
||||||
flags = widget->windowFlags();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
#ifndef FRAMELESSWIDGET_H
|
|
||||||
#define FRAMELESSWIDGET_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无边框窗体类 作者:feiyangqingyun(QQ:517216493) 2019-10-03
|
|
||||||
* 1. 可以指定需要无边框的widget。
|
|
||||||
* 2. 边框四周八个方位都可以自由拉伸。
|
|
||||||
* 3. 可设置对应位置的边距,以便识别更大区域。
|
|
||||||
* 4. 可设置是否允许拖动。
|
|
||||||
* 5. 可设置是否允许拉伸。
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
#ifdef quc
|
|
||||||
class Q_DECL_EXPORT FramelessWidget : public QObject
|
|
||||||
#else
|
|
||||||
class FramelessWidget : public QObject
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit FramelessWidget(QObject *parent = 0);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
//边距+可移动+可拉伸
|
|
||||||
int padding;
|
|
||||||
bool moveEnable;
|
|
||||||
bool resizeEnable;
|
|
||||||
|
|
||||||
//无边框窗体
|
|
||||||
QWidget *widget;
|
|
||||||
|
|
||||||
//鼠标是否按下+按下坐标+按下时窗体区域
|
|
||||||
bool mousePressed;
|
|
||||||
QPoint mousePoint;
|
|
||||||
QRect mouseRect;
|
|
||||||
|
|
||||||
//鼠标是否按下某个区域+按下区域的大小
|
|
||||||
//依次为 左侧+右侧+上侧+下侧+左上侧+右上侧+左下侧+右下侧
|
|
||||||
QList<bool> pressedArea;
|
|
||||||
QList<QRect> pressedRect;
|
|
||||||
|
|
||||||
//记录是否最小化
|
|
||||||
bool isMin;
|
|
||||||
//存储窗体默认的属性
|
|
||||||
Qt::WindowFlags flags;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
//设置边距
|
|
||||||
void setPadding(int padding);
|
|
||||||
//设置是否可拖动+拉伸
|
|
||||||
void setMoveEnable(bool moveEnable);
|
|
||||||
void setResizeEnable(bool resizeEnable);
|
|
||||||
|
|
||||||
//设置要无边框的窗体
|
|
||||||
void setWidget(QWidget *widget);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FRAMELESSWIDGET_H
|
|
|
@ -9,11 +9,15 @@ CONFIG += warn_off
|
||||||
|
|
||||||
SOURCES += main.cpp
|
SOURCES += main.cpp
|
||||||
SOURCES += frmframelesswidget.cpp
|
SOURCES += frmframelesswidget.cpp
|
||||||
SOURCES += framelesswidget.cpp
|
|
||||||
SOURCES += framelesswidget2.cpp
|
SOURCES += framelesswidget2.cpp
|
||||||
|
|
||||||
HEADERS += frmframelesswidget.h
|
HEADERS += frmframelesswidget.h
|
||||||
HEADERS += framelesswidget.h
|
|
||||||
HEADERS += framelesswidget2.h
|
HEADERS += framelesswidget2.h
|
||||||
|
|
||||||
FORMS += frmframelesswidget.ui
|
FORMS += frmframelesswidget.ui
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/framelesscore
|
||||||
|
INCLUDEPATH += $$PWD/framelessform
|
||||||
|
|
||||||
|
include ($$PWD/framelesscore/framelesscore.pri)
|
||||||
|
include ($$PWD/framelessform/framelessform.pri)
|
||||||
|
|
|
@ -1,123 +1,193 @@
|
||||||
#include "framelesswidget2.h"
|
#include "framelesswidget2.h"
|
||||||
#include "qdatetime.h"
|
|
||||||
#include "qevent.h"
|
#include "qevent.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
FramelessWidget2::FramelessWidget2(QObject *parent) : QObject(parent)
|
||||||
#include "windows.h"
|
|
||||||
#pragma comment (lib,"user32.lib")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TIMEMS qPrintable(QTime::currentTime().toString("HH:mm:ss zzz"))
|
|
||||||
|
|
||||||
FramelessWidget2::FramelessWidget2(QWidget *parent) : QWidget(parent)
|
|
||||||
{
|
{
|
||||||
padding = 8;
|
padding = 8;
|
||||||
moveEnable = true;
|
moveEnable = true;
|
||||||
resizeEnable = true;
|
resizeEnable = true;
|
||||||
|
widget = 0;
|
||||||
|
|
||||||
//安装事件过滤器识别拖动
|
mousePressed = false;
|
||||||
this->installEventFilter(this);
|
mousePoint = QPoint(0, 0);
|
||||||
|
mouseRect = QRect(0, 0, 0, 0);
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; ++i) {
|
||||||
|
pressedArea << false;
|
||||||
|
pressedRect << QRect(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果父类是窗体则直接设置
|
||||||
|
if (parent->isWidgetType()) {
|
||||||
|
setWidget((QWidget *)parent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FramelessWidget2::eventFilter(QObject *watched, QEvent *event)
|
bool FramelessWidget2::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (watched == this && moveEnable) {
|
if (widget != 0 && watched == widget) {
|
||||||
static QPoint mousePoint;
|
if (event->type() == QEvent::WindowStateChange) {
|
||||||
static bool mousePressed = false;
|
//解决mac系统上无边框最小化失效的BUG
|
||||||
|
|
||||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
|
||||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
|
||||||
if (mouseEvent->button() == Qt::LeftButton) {
|
|
||||||
mousePressed = true;
|
|
||||||
mousePoint = mouseEvent->globalPos() - this->pos();
|
|
||||||
}
|
|
||||||
} else if (mouseEvent->type() == QEvent::MouseButtonRelease) {
|
|
||||||
mousePressed = false;
|
|
||||||
} else if (mouseEvent->type() == QEvent::MouseMove) {
|
|
||||||
if (mousePressed) {
|
|
||||||
this->move(mouseEvent->globalPos() - mousePoint);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::eventFilter(watched, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
|
||||||
bool FramelessWidget2::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
|
|
||||||
#else
|
|
||||||
bool FramelessWidget2::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (eventType == "windows_generic_MSG") {
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
MSG *msg = static_cast<MSG *>(message);
|
|
||||||
//qDebug() << TIMEMS << "nativeEvent" << msg->wParam << msg->message;
|
|
||||||
|
|
||||||
//不同的消息类型和参数进行不同的处理
|
|
||||||
if (msg->message == WM_NCCALCSIZE) {
|
|
||||||
*result = 0;
|
|
||||||
return true;
|
|
||||||
} else if (msg->message == WM_NCHITTEST) {
|
|
||||||
//计算鼠标对应的屏幕坐标
|
|
||||||
long x = LOWORD(msg->lParam);
|
|
||||||
long y = HIWORD(msg->lParam);
|
|
||||||
QPoint pos = mapFromGlobal(QPoint(x, y));
|
|
||||||
|
|
||||||
//判断当前鼠标位置在哪个区域
|
|
||||||
bool left = pos.x() < padding;
|
|
||||||
bool right = pos.x() > width() - padding;
|
|
||||||
bool top = pos.y() < padding;
|
|
||||||
bool bottom = pos.y() > height() - padding;
|
|
||||||
|
|
||||||
//鼠标移动到四个角,这个消息是当鼠标移动或者有鼠标键按下时候发出的
|
|
||||||
*result = 0;
|
|
||||||
if (resizeEnable) {
|
|
||||||
if (left && top) {
|
|
||||||
*result = HTTOPLEFT;
|
|
||||||
} else if (left && bottom) {
|
|
||||||
*result = HTBOTTOMLEFT;
|
|
||||||
} else if (right && top) {
|
|
||||||
*result = HTTOPRIGHT;
|
|
||||||
} else if (right && bottom) {
|
|
||||||
*result = HTBOTTOMRIGHT;
|
|
||||||
} else if (left) {
|
|
||||||
*result = HTLEFT;
|
|
||||||
} else if (right) {
|
|
||||||
*result = HTRIGHT;
|
|
||||||
} else if (top) {
|
|
||||||
*result = HTTOP;
|
|
||||||
} else if (bottom) {
|
|
||||||
*result = HTBOTTOM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//先处理掉拉伸
|
|
||||||
if (0 != *result) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else if (eventType == "NSEvent") {
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
#endif
|
if (widget->windowState() & Qt::WindowMinimized) {
|
||||||
} else if (eventType == "xcb_generic_event_t") {
|
isMin = true;
|
||||||
#ifdef Q_OS_LINUX
|
} else {
|
||||||
#endif
|
if (isMin) {
|
||||||
|
//设置无边框属性
|
||||||
|
widget->setWindowFlags(flags | Qt::FramelessWindowHint);
|
||||||
|
widget->setVisible(true);
|
||||||
|
isMin = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else if (event->type() == QEvent::Resize) {
|
||||||
|
//重新计算八个描点的区域,描点区域的作用还有就是计算鼠标坐标是否在某一个区域内
|
||||||
|
int width = widget->width();
|
||||||
|
int height = widget->height();
|
||||||
|
|
||||||
|
//左侧描点区域
|
||||||
|
pressedRect[0] = QRect(0, padding, padding, height - padding * 2);
|
||||||
|
//右侧描点区域
|
||||||
|
pressedRect[1] = QRect(width - padding, padding, padding, height - padding * 2);
|
||||||
|
//上侧描点区域
|
||||||
|
pressedRect[2] = QRect(padding, 0, width - padding * 2, padding);
|
||||||
|
//下侧描点区域
|
||||||
|
pressedRect[3] = QRect(padding, height - padding, width - padding * 2, padding);
|
||||||
|
|
||||||
|
//左上角描点区域
|
||||||
|
pressedRect[4] = QRect(0, 0, padding, padding);
|
||||||
|
//右上角描点区域
|
||||||
|
pressedRect[5] = QRect(width - padding, 0, padding, padding);
|
||||||
|
//左下角描点区域
|
||||||
|
pressedRect[6] = QRect(0, height - padding, padding, padding);
|
||||||
|
//右下角描点区域
|
||||||
|
pressedRect[7] = QRect(width - padding, height - padding, padding, padding);
|
||||||
|
} else if (event->type() == QEvent::HoverMove) {
|
||||||
|
//设置对应鼠标形状,这个必须放在这里而不是下面,因为可以在鼠标没有按下的时候识别
|
||||||
|
QHoverEvent *hoverEvent = (QHoverEvent *)event;
|
||||||
|
QPoint point = hoverEvent->pos();
|
||||||
|
if (resizeEnable) {
|
||||||
|
if (pressedRect.at(0).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeHorCursor);
|
||||||
|
} else if (pressedRect.at(1).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeHorCursor);
|
||||||
|
} else if (pressedRect.at(2).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeVerCursor);
|
||||||
|
} else if (pressedRect.at(3).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeVerCursor);
|
||||||
|
} else if (pressedRect.at(4).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeFDiagCursor);
|
||||||
|
} else if (pressedRect.at(5).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeBDiagCursor);
|
||||||
|
} else if (pressedRect.at(6).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeBDiagCursor);
|
||||||
|
} else if (pressedRect.at(7).contains(point)) {
|
||||||
|
widget->setCursor(Qt::SizeFDiagCursor);
|
||||||
|
} else {
|
||||||
|
widget->setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
//根据当前鼠标位置,计算XY轴移动了多少
|
||||||
#ifdef Q_OS_WIN
|
int offsetX = point.x() - mousePoint.x();
|
||||||
bool FramelessWidget2::winEvent(MSG *message, long *result)
|
int offsetY = point.y() - mousePoint.y();
|
||||||
{
|
|
||||||
return nativeEvent("windows_generic_MSG", message, result);
|
//根据按下处的位置判断是否是移动控件还是拉伸控件
|
||||||
|
if (moveEnable && mousePressed) {
|
||||||
|
widget->move(widget->x() + offsetX, widget->y() + offsetY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resizeEnable) {
|
||||||
|
int rectX = mouseRect.x();
|
||||||
|
int rectY = mouseRect.y();
|
||||||
|
int rectW = mouseRect.width();
|
||||||
|
int rectH = mouseRect.height();
|
||||||
|
|
||||||
|
if (pressedArea.at(0)) {
|
||||||
|
int resizeW = widget->width() - offsetX;
|
||||||
|
if (widget->minimumWidth() <= resizeW) {
|
||||||
|
widget->setGeometry(widget->x() + offsetX, rectY, resizeW, rectH);
|
||||||
|
}
|
||||||
|
} else if (pressedArea.at(1)) {
|
||||||
|
widget->setGeometry(rectX, rectY, rectW + offsetX, rectH);
|
||||||
|
} else if (pressedArea.at(2)) {
|
||||||
|
int resizeH = widget->height() - offsetY;
|
||||||
|
if (widget->minimumHeight() <= resizeH) {
|
||||||
|
widget->setGeometry(rectX, widget->y() + offsetY, rectW, resizeH);
|
||||||
|
}
|
||||||
|
} else if (pressedArea.at(3)) {
|
||||||
|
widget->setGeometry(rectX, rectY, rectW, rectH + offsetY);
|
||||||
|
} else if (pressedArea.at(4)) {
|
||||||
|
int resizeW = widget->width() - offsetX;
|
||||||
|
int resizeH = widget->height() - offsetY;
|
||||||
|
if (widget->minimumWidth() <= resizeW) {
|
||||||
|
widget->setGeometry(widget->x() + offsetX, widget->y(), resizeW, resizeH);
|
||||||
|
}
|
||||||
|
if (widget->minimumHeight() <= resizeH) {
|
||||||
|
widget->setGeometry(widget->x(), widget->y() + offsetY, resizeW, resizeH);
|
||||||
|
}
|
||||||
|
} else if (pressedArea.at(5)) {
|
||||||
|
int resizeW = rectW + offsetX;
|
||||||
|
int resizeH = widget->height() - offsetY;
|
||||||
|
if (widget->minimumHeight() <= resizeH) {
|
||||||
|
widget->setGeometry(widget->x(), widget->y() + offsetY, resizeW, resizeH);
|
||||||
|
}
|
||||||
|
} else if (pressedArea.at(6)) {
|
||||||
|
int resizeW = widget->width() - offsetX;
|
||||||
|
int resizeH = rectH + offsetY;
|
||||||
|
if (widget->minimumWidth() <= resizeW) {
|
||||||
|
widget->setGeometry(widget->x() + offsetX, widget->y(), resizeW, resizeH);
|
||||||
|
}
|
||||||
|
if (widget->minimumHeight() <= resizeH) {
|
||||||
|
widget->setGeometry(widget->x(), widget->y(), resizeW, resizeH);
|
||||||
|
}
|
||||||
|
} else if (pressedArea.at(7)) {
|
||||||
|
int resizeW = rectW + offsetX;
|
||||||
|
int resizeH = rectH + offsetY;
|
||||||
|
widget->setGeometry(widget->x(), widget->y(), resizeW, resizeH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event->type() == QEvent::MouseButtonPress) {
|
||||||
|
//记住鼠标按下的坐标+窗体区域
|
||||||
|
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
||||||
|
mousePoint = mouseEvent->pos();
|
||||||
|
mouseRect = widget->geometry();
|
||||||
|
|
||||||
|
//判断按下的手柄的区域位置
|
||||||
|
if (pressedRect.at(0).contains(mousePoint)) {
|
||||||
|
pressedArea[0] = true;
|
||||||
|
} else if (pressedRect.at(1).contains(mousePoint)) {
|
||||||
|
pressedArea[1] = true;
|
||||||
|
} else if (pressedRect.at(2).contains(mousePoint)) {
|
||||||
|
pressedArea[2] = true;
|
||||||
|
} else if (pressedRect.at(3).contains(mousePoint)) {
|
||||||
|
pressedArea[3] = true;
|
||||||
|
} else if (pressedRect.at(4).contains(mousePoint)) {
|
||||||
|
pressedArea[4] = true;
|
||||||
|
} else if (pressedRect.at(5).contains(mousePoint)) {
|
||||||
|
pressedArea[5] = true;
|
||||||
|
} else if (pressedRect.at(6).contains(mousePoint)) {
|
||||||
|
pressedArea[6] = true;
|
||||||
|
} else if (pressedRect.at(7).contains(mousePoint)) {
|
||||||
|
pressedArea[7] = true;
|
||||||
|
} else {
|
||||||
|
mousePressed = true;
|
||||||
|
}
|
||||||
|
} else if (event->type() == QEvent::MouseMove) {
|
||||||
|
//改成用HoverMove识别
|
||||||
|
} else if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
|
//恢复所有
|
||||||
|
widget->setCursor(Qt::ArrowCursor);
|
||||||
|
mousePressed = false;
|
||||||
|
for (int i = 0; i < 8; ++i) {
|
||||||
|
pressedArea[i] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QObject::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void FramelessWidget2::setPadding(int padding)
|
void FramelessWidget2::setPadding(int padding)
|
||||||
{
|
{
|
||||||
|
@ -133,3 +203,19 @@ void FramelessWidget2::setResizeEnable(bool resizeEnable)
|
||||||
{
|
{
|
||||||
this->resizeEnable = resizeEnable;
|
this->resizeEnable = resizeEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FramelessWidget2::setWidget(QWidget *widget)
|
||||||
|
{
|
||||||
|
if (this->widget == 0) {
|
||||||
|
this->widget = widget;
|
||||||
|
//设置鼠标追踪为真
|
||||||
|
this->widget->setMouseTracking(true);
|
||||||
|
//绑定事件过滤器
|
||||||
|
this->widget->installEventFilter(this);
|
||||||
|
//设置悬停为真,必须设置这个,不然当父窗体里边还有子窗体全部遮挡了识别不到MouseMove,需要识别HoverMove
|
||||||
|
this->widget->setAttribute(Qt::WA_Hover, true);
|
||||||
|
|
||||||
|
isMin = false;
|
||||||
|
flags = widget->windowFlags();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,47 +1,64 @@
|
||||||
#ifndef FRAMELESSWIDGET2_H
|
#ifndef FRAMELESSWIDGET2_H
|
||||||
#define FRAMELESSWIDGET2_H
|
#define FRAMELESSWIDGET2_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无边框窗体类 作者:feiyangqingyun(QQ:517216493) 2019-10-03
|
||||||
|
* 1. 可以指定需要无边框的widget。
|
||||||
|
* 2. 边框四周八个方位都可以自由拉伸。
|
||||||
|
* 3. 可设置对应位置的边距,以便识别更大区域。
|
||||||
|
* 4. 可设置是否允许拖动。
|
||||||
|
* 5. 可设置是否允许拉伸。
|
||||||
|
*/
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#ifdef quc
|
#ifdef quc
|
||||||
class Q_DECL_EXPORT FramelessWidget2 : public QWidget
|
class Q_DECL_EXPORT FramelessWidget2 : public QObject
|
||||||
#else
|
#else
|
||||||
class FramelessWidget2 : public QWidget
|
class FramelessWidget2 : public QObject
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit FramelessWidget2(QWidget *parent = 0);
|
explicit FramelessWidget2(QObject *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
//拦截系统事件用于修复系统休眠后唤醒程序的BUG
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
|
||||||
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result);
|
|
||||||
#else
|
|
||||||
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Qt4的写法
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
bool winEvent(MSG *message, long *result);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//边距+可移动+可拉伸
|
//边距+可移动+可拉伸
|
||||||
int padding;
|
int padding;
|
||||||
bool moveEnable;
|
bool moveEnable;
|
||||||
bool resizeEnable;
|
bool resizeEnable;
|
||||||
|
|
||||||
public:
|
//无边框窗体
|
||||||
//设置边距+可拖动+可拉伸
|
QWidget *widget;
|
||||||
|
|
||||||
|
//鼠标是否按下+按下坐标+按下时窗体区域
|
||||||
|
bool mousePressed;
|
||||||
|
QPoint mousePoint;
|
||||||
|
QRect mouseRect;
|
||||||
|
|
||||||
|
//鼠标是否按下某个区域+按下区域的大小
|
||||||
|
//依次为 左侧+右侧+上侧+下侧+左上侧+右上侧+左下侧+右下侧
|
||||||
|
QList<bool> pressedArea;
|
||||||
|
QList<QRect> pressedRect;
|
||||||
|
|
||||||
|
//记录是否最小化
|
||||||
|
bool isMin;
|
||||||
|
//存储窗体默认的属性
|
||||||
|
Qt::WindowFlags flags;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
//设置边距
|
||||||
void setPadding(int padding);
|
void setPadding(int padding);
|
||||||
|
//设置是否可拖动+拉伸
|
||||||
void setMoveEnable(bool moveEnable);
|
void setMoveEnable(bool moveEnable);
|
||||||
void setResizeEnable(bool resizeEnable);
|
void setResizeEnable(bool resizeEnable);
|
||||||
|
|
||||||
|
//设置要无边框的窗体
|
||||||
|
void setWidget(QWidget *widget);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRAMELESSWIDGET2_H
|
#endif // FRAMELESSWIDGET2_H
|
||||||
|
|
|
@ -4,15 +4,13 @@
|
||||||
#include "ui_frmframelesswidget.h"
|
#include "ui_frmframelesswidget.h"
|
||||||
#include "qpushbutton.h"
|
#include "qpushbutton.h"
|
||||||
#include "qcheckbox.h"
|
#include "qcheckbox.h"
|
||||||
#include "framelesswidget.h"
|
|
||||||
#include "framelesswidget2.h"
|
#include "framelesswidget2.h"
|
||||||
|
|
||||||
frmFramelessWidget::frmFramelessWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmFramelessWidget)
|
frmFramelessWidget::frmFramelessWidget(QWidget *parent) : QWidget(parent), ui(new Ui::frmFramelessWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
widget1 = 0;
|
widget = 0;
|
||||||
frameless = 0;
|
frameless = 0;
|
||||||
frameless2 = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
frmFramelessWidget::~frmFramelessWidget()
|
frmFramelessWidget::~frmFramelessWidget()
|
||||||
|
@ -59,14 +57,14 @@ void frmFramelessWidget::initWidget(QWidget *w)
|
||||||
|
|
||||||
void frmFramelessWidget::on_pushButton_clicked()
|
void frmFramelessWidget::on_pushButton_clicked()
|
||||||
{
|
{
|
||||||
if (widget1 == 0) {
|
if (widget == 0) {
|
||||||
widget1 = new QWidget;
|
widget = new QWidget;
|
||||||
this->initWidget(widget1);
|
this->initWidget(widget);
|
||||||
frameless = new FramelessWidget(widget1);
|
frameless = new FramelessWidget2(widget);
|
||||||
frameless->setWidget(widget1);
|
frameless->setWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget1->show();
|
widget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmFramelessWidget::stateChanged1(int arg1)
|
void frmFramelessWidget::stateChanged1(int arg1)
|
||||||
|
@ -74,9 +72,6 @@ void frmFramelessWidget::stateChanged1(int arg1)
|
||||||
if (frameless != 0) {
|
if (frameless != 0) {
|
||||||
frameless->setMoveEnable(arg1 != 0);
|
frameless->setMoveEnable(arg1 != 0);
|
||||||
}
|
}
|
||||||
if (frameless2 != 0) {
|
|
||||||
frameless2->setMoveEnable(arg1 != 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void frmFramelessWidget::stateChanged2(int arg1)
|
void frmFramelessWidget::stateChanged2(int arg1)
|
||||||
|
@ -84,17 +79,4 @@ void frmFramelessWidget::stateChanged2(int arg1)
|
||||||
if (frameless != 0) {
|
if (frameless != 0) {
|
||||||
frameless->setResizeEnable(arg1 != 0);
|
frameless->setResizeEnable(arg1 != 0);
|
||||||
}
|
}
|
||||||
if (frameless2 != 0) {
|
|
||||||
frameless2->setResizeEnable(arg1 != 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void frmFramelessWidget::on_pushButton_2_clicked()
|
|
||||||
{
|
|
||||||
if (frameless2 == 0) {
|
|
||||||
frameless2 = new FramelessWidget2;
|
|
||||||
this->initWidget(frameless2);
|
|
||||||
}
|
|
||||||
|
|
||||||
frameless2->show();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define FRMFRAMELESSWIDGET_H
|
#define FRMFRAMELESSWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
class FramelessWidget;
|
|
||||||
class FramelessWidget2;
|
class FramelessWidget2;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -22,16 +21,14 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::frmFramelessWidget *ui;
|
Ui::frmFramelessWidget *ui;
|
||||||
QWidget *widget1;
|
QWidget *widget;
|
||||||
FramelessWidget *frameless;
|
FramelessWidget2 *frameless;
|
||||||
FramelessWidget2 *frameless2;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initWidget(QWidget *w);
|
void initWidget(QWidget *w);
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
void stateChanged1(int arg1);
|
void stateChanged1(int arg1);
|
||||||
void stateChanged2(int arg1);
|
void stateChanged2(int arg1);
|
||||||
void on_pushButton_2_clicked();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRMFRAMELESSWIDGET_H
|
#endif // FRMFRAMELESSWIDGET_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>800</width>
|
||||||
<height>300</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -26,19 +26,6 @@
|
||||||
<string>弹出</string>
|
<string>弹出</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>110</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>92</width>
|
|
||||||
<height>28</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>无边框2</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#pragma execution_character_set("utf-8")
|
#pragma execution_character_set("utf-8")
|
||||||
|
|
||||||
#include "frmframelesswidget.h"
|
#include "frmframelesswidget.h"
|
||||||
|
#include "dialog.h"
|
||||||
|
#include "widget.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
@ -27,7 +30,11 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frmFramelessWidget w;
|
frmFramelessWidget w;
|
||||||
|
//Dialog w;
|
||||||
|
//Widget w;
|
||||||
|
//MainWindow w;
|
||||||
w.setWindowTitle("无边框窗体类");
|
w.setWindowTitle("无边框窗体类");
|
||||||
|
w.resize(800, 600);
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
|
|
@ -274,14 +274,14 @@ void GifWidget::saveImage()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
//由于qt4没有RGBA8888,采用最接近RGBA8888的是ARGB32,颜色会有点偏差
|
|
||||||
QPixmap pix = QPixmap::grabWindow(0, x() + rectGif.x(), y() + rectGif.y(), rectGif.width(), rectGif.height());
|
|
||||||
QImage image = pix.toImage().convertToFormat(QImage::Format_ARGB32);
|
|
||||||
#else
|
|
||||||
QScreen *screen = QApplication::primaryScreen();
|
QScreen *screen = QApplication::primaryScreen();
|
||||||
QPixmap pix = screen->grabWindow(0, x() + rectGif.x(), y() + rectGif.y(), rectGif.width(), rectGif.height());
|
QPixmap pix = screen->grabWindow(0, x() + rectGif.x(), y() + rectGif.y(), rectGif.width(), rectGif.height());
|
||||||
QImage image = pix.toImage().convertToFormat(QImage::Format_RGBA8888);
|
QImage image = pix.toImage().convertToFormat(QImage::Format_RGBA8888);
|
||||||
|
#else
|
||||||
|
//由于qt4没有RGBA8888,采用最接近RGBA8888的是ARGB32,颜色会有点偏差
|
||||||
|
QPixmap pix = QPixmap::grabWindow(0, x() + rectGif.x(), y() + rectGif.y(), rectGif.width(), rectGif.height());
|
||||||
|
QImage image = pix.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gif.GifWriteFrame(gifWriter, image.bits(), rectGif.width(), rectGif.height(), fps);
|
gif.GifWriteFrame(gifWriter, image.bits(), rectGif.width(), rectGif.height(), fps);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define VLC_H
|
#define VLC_H
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ TcpServer1::TcpServer1(QObject *parent) : QTcpServer(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
void TcpServer1::incomingConnection(qintptr handle)
|
void TcpServer1::incomingConnection(qintptr handle)
|
||||||
#else
|
#else
|
||||||
void TcpServer1::incomingConnection(int handle)
|
void TcpServer1::incomingConnection(int handle)
|
||||||
|
@ -120,7 +120,7 @@ void TcpServer1::disconnected()
|
||||||
|
|
||||||
bool TcpServer1::start()
|
bool TcpServer1::start()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
bool ok = listen(QHostAddress::AnyIPv4, AppConfig::ListenPort1);
|
bool ok = listen(QHostAddress::AnyIPv4, AppConfig::ListenPort1);
|
||||||
#else
|
#else
|
||||||
bool ok = listen(QHostAddress::Any, AppConfig::ListenPort1);
|
bool ok = listen(QHostAddress::Any, AppConfig::ListenPort1);
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
QList<TcpClient1 *> clients;
|
QList<TcpClient1 *> clients;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
void incomingConnection(qintptr handle);
|
void incomingConnection(qintptr handle);
|
||||||
#else
|
#else
|
||||||
void incomingConnection(int handle);
|
void incomingConnection(int handle);
|
||||||
|
|
|
@ -80,7 +80,7 @@ TcpServer2::TcpServer2(QObject *parent) : QTcpServer(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
void TcpServer2::incomingConnection(qintptr handle)
|
void TcpServer2::incomingConnection(qintptr handle)
|
||||||
#else
|
#else
|
||||||
void TcpServer2::incomingConnection(int handle)
|
void TcpServer2::incomingConnection(int handle)
|
||||||
|
@ -120,7 +120,7 @@ void TcpServer2::disconnected()
|
||||||
|
|
||||||
bool TcpServer2::start()
|
bool TcpServer2::start()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
bool ok = listen(QHostAddress::AnyIPv4, AppConfig::ListenPort2);
|
bool ok = listen(QHostAddress::AnyIPv4, AppConfig::ListenPort2);
|
||||||
#else
|
#else
|
||||||
bool ok = listen(QHostAddress::Any, AppConfig::ListenPort2);
|
bool ok = listen(QHostAddress::Any, AppConfig::ListenPort2);
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
QList<TcpClient2 *> clients;
|
QList<TcpClient2 *> clients;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
void incomingConnection(qintptr handle);
|
void incomingConnection(qintptr handle);
|
||||||
#else
|
#else
|
||||||
void incomingConnection(int handle);
|
void incomingConnection(int handle);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#ifdef websocket
|
#ifdef websocket
|
||||||
#include <QtWebSockets>
|
#include <QtWebSockets>
|
||||||
|
|
|
@ -86,10 +86,10 @@ void NtpClient::readData()
|
||||||
QDateTime dateTime;
|
QDateTime dateTime;
|
||||||
uint secs = seconds - epoch.secsTo(unixStart);
|
uint secs = seconds - epoch.secsTo(unixStart);
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||||||
dateTime.setTime_t(secs);
|
|
||||||
#else
|
|
||||||
dateTime.setSecsSinceEpoch(secs);
|
dateTime.setSecsSinceEpoch(secs);
|
||||||
|
#else
|
||||||
|
dateTime.setTime_t(secs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
|
|
|
@ -218,11 +218,11 @@ void ScreenWidget::showEvent(QShowEvent *)
|
||||||
screen->setStart(point);
|
screen->setStart(point);
|
||||||
screen->setEnd(point);
|
screen->setEnd(point);
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
*fullScreen = fullScreen->grabWindow(0, 0, 0, screen->width(), screen->height());
|
|
||||||
#else
|
|
||||||
QScreen *pscreen = QApplication::primaryScreen();
|
QScreen *pscreen = QApplication::primaryScreen();
|
||||||
*fullScreen = pscreen->grabWindow(0, 0, 0, screen->width(), screen->height());
|
*fullScreen = pscreen->grabWindow(0, 0, 0, screen->width(), screen->height());
|
||||||
|
#else
|
||||||
|
*fullScreen = fullScreen->grabWindow(0, 0, 0, screen->width(), screen->height());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//设置透明度实现模糊背景
|
//设置透明度实现模糊背景
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define VLC_H
|
#define VLC_H
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue