forked from feiyangqingyun/QWidgetDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63d7d2a
commit 45d9850
Showing
39 changed files
with
3,487 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}} |
Oops, something went wrong.