Skip to content

Commit

Permalink
新增无边框方案项目
Browse files Browse the repository at this point in the history
  • Loading branch information
feiyangqingyun committed Jul 27, 2021
1 parent 63d7d2a commit 45d9850
Show file tree
Hide file tree
Showing 39 changed files with 3,487 additions and 4 deletions.
Binary file added 0snap/frameless.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions QWidgetDemo.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
#定义了ordered表示子项目按照添加的顺序来编译
CONFIG += ordered

#挨个添加子项目
SUBDIRS += lightbutton #高亮按钮控件
SUBDIRS += movewidget #通用控件移动类
SUBDIRS += flatui #模仿flatui类
Expand Down Expand Up @@ -35,7 +37,9 @@ SUBDIRS += imageswitch #图片开关控件
SUBDIRS += netserver #网络中转服务器
SUBDIRS += base64 #图片文字base64互换
SUBDIRS += smoothcurve #平滑曲线
SUBDIRS += frameless #跨平台无边框窗体

#限定windows系统加载下面的项目
win32 {
SUBDIRS += ffmpegdemo #视频流播放ffmpeg内核
SUBDIRS += vlcdemo #视频流播放vlc内核
Expand All @@ -46,8 +50,10 @@ SUBDIRS += miniblink #miniblink示例
#如果你电脑对应的Qt版本有webkit或者webengine组件可以自行打开
#SUBDIRS += echartgauge #echart仪表盘含交互支持webkit及webengine

lessThan(QT_MAJOR_VERSION, 4) {
#SUBDIRS += designer #QtDesigner4源码
#这个项目依赖QtDesigner模块,一般在arm上默认没有这个模块需要自行编译
#所以arm上如果没有QtDesigner模块不要加载下面这个子项目
lessThan(QT_MAJOR_VERSION, 5) {
SUBDIRS += designer #QtDesigner4源码
}

#qwt项目需要等官方适配了qwt组件才能适配
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
1. **可以选择打开QWidgetDemo.pro一次性编译所有的,也可以进入到目录下打开pro进行编译。**
2. **如果发现有些子项目没有加载请打开QWidgetDemo.pro仔细看里面的注释。**
3. **编译好的可执行文件在源码同级目录下的bin目录。**
4. **亲测Qt4.6到Qt6.1所有版本,亲测win、linux、mac、uos等系统。**
4. **亲测Qt4.6到Qt6.2所有版本,亲测win、linux、mac、uos等系统。**

| 编号 | 文件夹 | 描述 |
| ------ | ------ | ------ |
Expand Down Expand Up @@ -49,6 +49,7 @@
| 41 | miniblink | miniblink示例 |
| 42 | base64 | 图片文字base64互换 |
| 43 | smoothcurve | 平滑曲线 |
| 44 | frameless | 跨平台无边框窗体 |

### 二、学习群
1. **Qt交流大会群 853086607(雨田哥)**
Expand Down Expand Up @@ -99,4 +100,5 @@
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/designer.png)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/miniblink.jpg)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/base64.png)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/smoothcurve.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/smoothcurve.gif)
![avatar](https://github.com/feiyangqingyun/QWidgetDemo/raw/master/0snap/frameless.gif)
56 changes: 56 additions & 0 deletions core_common/appinit.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#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);
}
23 changes: 23 additions & 0 deletions core_common/appinit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#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
5 changes: 5 additions & 0 deletions core_common/common.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>image/fontawesome-webfont.ttf</file>
</qresource>
</RCC>
34 changes: 34 additions & 0 deletions core_common/core_common.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#指定编译产生的文件分门别类放到对应目录
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/iconhelper.h \
$$PWD/quihelper.h

SOURCES += \
$$PWD/appinit.cpp \
$$PWD/iconhelper.cpp \
$$PWD/quihelper.cpp

RESOURCES += \
$$PWD/common.qrc
6 changes: 6 additions & 0 deletions core_common/h3.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
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
}}
Loading

0 comments on commit 45d9850

Please sign in to comment.