Fix property-setter for strings

AKA qt_setstringproperty().
This commit is contained in:
Jaidyn Ann 2024-02-05 18:38:42 -06:00
parent 1704d392e8
commit a8f324ca68

View File

@ -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) \
{ \
const QMetaObject *mo = w->metaObject(); \
@ -188,12 +188,12 @@ propsetter(int, int, QMetaType::Int)
propsetter(float, double, QMetaType::Double)
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();
int i = mo->indexOfProperty(prop);
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));
}