Fix property-setter for strings
AKA qt_setstringproperty().
This commit is contained in:
parent
1704d392e8
commit
a8f324ca68
6
main.cpp
6
main.cpp
|
@ -173,7 +173,7 @@ int qt_message(char *caption, char *text, QWidget *parent, char *b0, char *b1, c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define propsetter(name, type, metatype) \
|
#define propsetter(name, type, metatype) \
|
||||||
___bool qt_set ## name ## property(QWidget *w, char *prop, type val) \
|
___bool qt_set ## name ## property(QWidget *w, char *prop, type val) \
|
||||||
{ \
|
{ \
|
||||||
const QMetaObject *mo = w->metaObject(); \
|
const QMetaObject *mo = w->metaObject(); \
|
||||||
|
@ -188,12 +188,12 @@ propsetter(int, int, QMetaType::Int)
|
||||||
propsetter(float, double, QMetaType::Double)
|
propsetter(float, double, QMetaType::Double)
|
||||||
propsetter(char, char, QMetaType::Char)
|
propsetter(char, char, QMetaType::Char)
|
||||||
|
|
||||||
___bool qt_setstringproperty(QWidget *w, char *prop, const char* val)
|
___bool qt_setstringproperty(QWidget *w, char *prop, char* val)
|
||||||
{
|
{
|
||||||
const QMetaObject *mo = w->metaObject();
|
const QMetaObject *mo = w->metaObject();
|
||||||
int i = mo->indexOfProperty(prop);
|
int i = mo->indexOfProperty(prop);
|
||||||
if(i == -1) return 0;
|
if(i == -1) return 0;
|
||||||
else return mo->property(i).write(w, QVariant(val));
|
else return mo->property(i).write(w, QVariant((const char*)val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue