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-04-24 10:24:29 +08:00
parent 578695edec
commit 4293eef6bc
3 changed files with 37 additions and 11 deletions

View File

@ -59,8 +59,8 @@ contains (CONFIG, QQT_SOURCE_BUILDIN) {
#you can open one or more macro to make sdk or link from build.
#link from sdk is default setting
CONFIG += link_from_sdk
#CONFIG += link_from_build
#CONFIG += link_from_sdk
CONFIG += link_from_build
#CONFIG += link_from_qt_lib_path
#especially some occations need some sure macro.

View File

@ -1 +1,17 @@
#include "qqtobjectmanager.h"
bool operator< ( QByteArray& l, QByteArray& r )
{
int cc = qstrcmp ( l, r );
if ( cc == 0 || cc > 0 )
return false;
return true;
}
bool operator== ( QByteArray& l, QByteArray& r )
{
int cc = qstrcmp ( l, r );
if ( cc == 0 )
return true;
return false;
}

View File

@ -20,10 +20,15 @@
* QQtObjectFactory,
* QQtWidgetFactory,
*/
QQTSHARED_EXPORT bool operator< ( QByteArray& l, QByteArray& r );
QQTSHARED_EXPORT bool operator== ( QByteArray& l, QByteArray& r );
template <class ObjectType>
class QQTSHARED_EXPORT __QQtObjectFactory__
{
public:
/**
* 便
* void*
@ -55,16 +60,15 @@ public:
/*
*
*/
//pline() << constructors();
pline() << constructors();
Constructor* constructor = 0;//constructors().value( ( className, 0 );
QHashIterator<QByteArray, Constructor*> itor ( constructors() );
QMapIterator<QByteArray, Constructor*> itor ( constructors() );
pline() << constructors().isDetached();
while ( itor.hasNext() ) {
itor.next();
//pline() << itor.key() << itor.value();
//pline() << ( bool ) ( className == itor.key() );
if ( ( bool ) ( className == itor.key() ) ) {
constructor = itor.value();
}
pline() << itor.key() << itor.value();
#if 0
QByteArray cc;
QByteArray dd;
@ -75,6 +79,12 @@ public:
if ( cc == dd ) //??? 不能比较吗但是必须加bool转换。
constructor = itor.value();
#endif
pline() << itor.key() << itor.value();
pline() << ( bool ) ( className == itor.key() );
if ( ( bool ) ( className == itor.key() ) ) {
constructor = itor.value();
}
}
//pline() << constructor;
@ -104,13 +114,13 @@ private:
return new T ( parent );
}
static QHash<QByteArray, Constructor*>& constructors() {
static QMap<QByteArray, Constructor*>& constructors() {
/*
*
*
* 使
*/
static QHash<QByteArray, Constructor*> instance;
static QMap<QByteArray, Constructor*> instance;
return instance;
}
};