1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
This commit is contained in:
tianduanrui 2018-01-20 16:27:18 +08:00
parent 8597bbd254
commit bfea0ba25d
5 changed files with 157 additions and 137 deletions

View File

@ -1,22 +1,8 @@
#-------------------------------------------------------------
#user computer path settings
#-------------------------------------------------------------
#deploy root
isEmpty(APP_DEPLOY_ROOT){
message($${TARGET} $${CONFIG_FILE})
message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri )
error( please check $$CONFIG_FILE under qqt_library.pri)
}
message($${TARGET} deploy root: $$APP_DEPLOY_ROOT)
#set app deploy pwd
APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QKIT_STD_DIR}
contains(QKIT_PRIVATE, WIN32||WIN64) {
APP_DEPLOY_PWD~=s,/,\\,g
}
APP_DEST_DIR=$${DESTDIR}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
#examplein /user/conf/path/.qmake/app_configure.pri
#APP_DEPLOY_ROOT = /where/app/wants/to/deploy/app/root
defineReplace(deploy_app_on_mac) {
#need QQT_BUILD_PWD
@ -75,7 +61,40 @@ defineReplace(deploy_app_for_android) {
return ($$command)
}
CONFIG += deploy_app
##-------------------------------------------------
##work flow
##-------------------------------------------------
#set app deploy pwd
APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QKIT_STD_DIR}
contains(QKIT_PRIVATE, WIN32||WIN64) {
APP_DEPLOY_PWD~=s,/,\\,g
}
APP_DEST_DIR=$${DESTDIR}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
#deploy root
isEmpty(APP_DEPLOY_ROOT){
message($${TARGET} $${CONFIG_FILE})
message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri )
error( please check $$CONFIG_FILE under link_qqt_library.pri)
}
message($${TARGET} deploy root: $$APP_DEPLOY_ROOT)
#如果 配置文件里 没有配置 APP_DEPLOY_ROOT 那么返回,不拷贝发布任何应用
#不会走到。
isEmpty(APP_DEPLOY_ROOT) {
message("$${TARGET} hasn't deploied any app files")
greaterThan(QT_MAJOR_VERSION, 5):return()
}
##4.8 qmake arm32 return() 函数无效
!isEmpty(APP_DEPLOY_ROOT) {
CONFIG += deploy_app
message("$${TARGET} has deploied some app files")
}
contains(CONFIG, deploy_app) {
contains(QKIT_PRIVATE, WIN32||WIN64) {
QMAKE_POST_LINK += $$deploy_app_on_win()

View File

@ -122,7 +122,7 @@ public:
/*操作符*/
/*警告:可读、可写*/
/*don't out of range*/
/*don't out of range? no, it is ok now.*/
QQtDictNode& operator [] ( int index );
const QQtDictNode& operator[] ( int index ) const;
QQtDictNode& operator [] ( const QString& key );

View File

@ -11,123 +11,6 @@
#include "qqt-local.h"
#include "qqtcore.h"
#if 0
class QQTSHARED_EXPORT QQtConstructer : public QObject
{
Q_OBJECT
public:
explicit QQtConstructer ( QObject* parent = 0 ) :
QObject ( parent ) {}
virtual ~QQtConstructer() {}
protected:
virtual QString constructorName() = 0;
};
/**
* @brief The QQtObjectConstructer class
* QQt
*/
class QQTSHARED_EXPORT QQtObjectConstructer : public QQtConstructer
{
Q_OBJECT
public:
explicit QQtObjectConstructer ( QObject* parent = 0 ) :
QQtConstructer ( parent ) {}
virtual ~QQtObjectConstructer() {}
virtual QString constructorName() { return "QObject"; }
private:
typedef QObject* ( *Constructor ) ( QObject* parent );
template<typename T>
static QObject* constructorHelper ( QObject* parent = 0 ) {
return new T ( parent );
}
static QHash<QByteArray, Constructor>& constructors() {
/*
*
*/
static QHash<QByteArray, Constructor> instance;
return instance;
}
};
/**
* @brief The QQtWidgetConstructer class
* QQt
*/
class QQTSHARED_EXPORT QQtWidgetConstructer : public QQtConstructer
{
Q_OBJECT
public:
explicit QQtWidgetConstructer ( QObject* parent = 0 ) :
QQtConstructer ( parent ) {}
virtual ~QQtWidgetConstructer() {}
virtual QString constructorName() { return "QWidget"; }
private:
typedef QWidget* ( *Constructor ) ( QWidget* parent );
template<typename T>
static QWidget* constructorHelper ( QWidget* parent = 0 ) {
return new T ( parent );
}
static QHash<QByteArray, Constructor>& constructors() {
/*
*
*/
static QHash<QByteArray, Constructor> instance;
return instance;
}
};
/**
* @brief The QQtObjectFactory class
* QQt
*/
class QQTSHARED_EXPORT QQtObjectFactory2
{
public:
private:
template<typename T>
static QQtConstructer* objectContructor() {
static QList<QQtConstructer*>* objcList = NULL;
if ( !objcList ) {
objcList = new QList<QQtConstructer*>();
//add custom contructor
objcList->push_back ( new QQtObjectConstructer() );
objcList->push_back ( new QQtWidgetConstructer() );
}
T obj;
QQtConstructer* objcc = NULL;
/*
QListIterator itor ( objcList );
while ( itor.hasNext() ) {
QQtConstructer* objc = *itor.next();
if ( obj.inherits ( objc->constructorName() ) ) {
objcc = objc;
break;
}
}
*/
return objcc;
}
};
#endif
/**
* @brief The QQtObjectFactory class
@ -294,4 +177,122 @@ private:
}
};
#if 0
class QQTSHARED_EXPORT QQtConstructer : public QObject
{
Q_OBJECT
public:
explicit QQtConstructer ( QObject* parent = 0 ) :
QObject ( parent ) {}
virtual ~QQtConstructer() {}
protected:
virtual QString constructorName() = 0;
};
/**
* @brief The QQtObjectConstructer class
* QQt
*/
class QQTSHARED_EXPORT QQtObjectConstructer : public QQtConstructer
{
Q_OBJECT
public:
explicit QQtObjectConstructer ( QObject* parent = 0 ) :
QQtConstructer ( parent ) {}
virtual ~QQtObjectConstructer() {}
virtual QString constructorName() { return "QObject"; }
private:
typedef QObject* ( *Constructor ) ( QObject* parent );
template<typename T>
static QObject* constructorHelper ( QObject* parent = 0 ) {
return new T ( parent );
}
static QHash<QByteArray, Constructor>& constructors() {
/*
*
*/
static QHash<QByteArray, Constructor> instance;
return instance;
}
};
/**
* @brief The QQtWidgetConstructer class
* QQt
*/
class QQTSHARED_EXPORT QQtWidgetConstructer : public QQtConstructer
{
Q_OBJECT
public:
explicit QQtWidgetConstructer ( QObject* parent = 0 ) :
QQtConstructer ( parent ) {}
virtual ~QQtWidgetConstructer() {}
virtual QString constructorName() { return "QWidget"; }
private:
typedef QWidget* ( *Constructor ) ( QWidget* parent );
template<typename T>
static QWidget* constructorHelper ( QWidget* parent = 0 ) {
return new T ( parent );
}
static QHash<QByteArray, Constructor>& constructors() {
/*
*
*/
static QHash<QByteArray, Constructor> instance;
return instance;
}
};
/**
* @brief The QQtObjectFactory class
* QQt
*/
class QQTSHARED_EXPORT QQtObjectFactory2
{
public:
private:
template<typename T>
static QQtConstructer* objectContructor() {
static QList<QQtConstructer*>* objcList = NULL;
if ( !objcList ) {
objcList = new QList<QQtConstructer*>();
//add custom contructor
objcList->push_back ( new QQtObjectConstructer() );
objcList->push_back ( new QQtWidgetConstructer() );
}
T obj;
QQtConstructer* objcc = NULL;
/*
QListIterator itor ( objcList );
while ( itor.hasNext() ) {
QQtConstructer* objc = *itor.next();
if ( obj.inherits ( objc->constructorName() ) ) {
objcc = objc;
break;
}
}
*/
return objcc;
}
};
#endif
#endif // QQTOBJECTFACTORY_H

View File

@ -7,7 +7,7 @@
class QQTSHARED_EXPORT QQtPrinter : public QPrinter
{
public:
QQtPrinter ( PrinterMode mode = HighResolution );
explicit QQtPrinter ( PrinterMode mode = HighResolution );
void setOutputFileName ( const QString& );
void print();