Plixil
25th July 2010, 15:46
Is there a way to have custom widget properties shown in Qt Creator ( in this section http://imgur.com/TJx6F.png ) just using promotion? I find that the plugin method is quite tedious and promotion is so easy, I'd love to get them from just promoting.
If the only way to get these properties into Qt Creator is with plugins, is this the correct way of exposing the price and name variables?
class ServiceButton : public QPushButton
{
Q_OBJECT
Q_PROPERTY( QString m_sServiceName READ getServiceName WRITE setServiceName DESIGNABLE true );
Q_PROPERTY( float m_fPrice READ getPrice WRITE setPrice DESIGNABLE true );
public:
ServiceButton(QWidget *parent = 0);
public slots:
QString getServiceName();
void setServiceName( QString s );
float getPrice();
void setPrice( float f );
protected:
QString m_sServiceName;
float m_fPrice;
};
Thanks :)
P.S. is there any Qt type of float like "QDecimal", "QFloat" or whatever?
If the only way to get these properties into Qt Creator is with plugins, is this the correct way of exposing the price and name variables?
class ServiceButton : public QPushButton
{
Q_OBJECT
Q_PROPERTY( QString m_sServiceName READ getServiceName WRITE setServiceName DESIGNABLE true );
Q_PROPERTY( float m_fPrice READ getPrice WRITE setPrice DESIGNABLE true );
public:
ServiceButton(QWidget *parent = 0);
public slots:
QString getServiceName();
void setServiceName( QString s );
float getPrice();
void setPrice( float f );
protected:
QString m_sServiceName;
float m_fPrice;
};
Thanks :)
P.S. is there any Qt type of float like "QDecimal", "QFloat" or whatever?