ActiveQt and writable Q_Property
-
Developing an activeqt component that is hosted in a DOTNET 2.0 VS2005 app.
When starting the application the setStatusString is called by QAxServerBase::Load(IStream)
setting the string to "Private third default text". This means that the textbox contains "Private third default text" instead of the expected "abc_Private third default text TODO" which is specified in the constructor.By commenting out the logic inside the setStatusString method I receive the expected "abc_Private third default text TODO" string.
#1. Why does QAxServerBase::Load call my property? It seems to be related to the property being writable.
#2. Where does QAxServerBase::Load get the text string it uses? I have searched both source file structure and registry and I cannot find the string "Private third default text" anywhere.
Is the string embedded in the binary file (dll in this case)?Here is the source code for the widget in question.
@
class MyWidget : public QWidget
{
Q_OBJECT
Q_CLASSINFO("ClassID", "{D3AE74DD-FB3E-4e3f-95FE-CBC11C78E0E0}")
Q_CLASSINFO("InterfaceID", "{E05DBDB2-7628-4275-BC7C-E847E81423F5}")
Q_CLASSINFO("EventsID", "{F7BF220F-F142-4f67-9577-6EC3A602C9FF}")
Q_PROPERTY(QString statusString READ statusString WRITE setStatusString)public:
MyWidget(QWidget *parent = 0) : QWidget(parent)
{
QFormLayout * layout = new QFormLayout();
m_line = new QLineEdit("abc_Private third default text TODO");
layout->addRow(m_line);
this->setLayout(layout);
}void setStatusString(QString str) { m_line->setText(str); } QString statusString() { return m_line->text(); }
private:
QLineEdit * m_line;
};@
-
It turns out that when loading an ActiveQt widget into an .NET forms in the designer view the content of the Q_PROPERTY is copied by visual studio and store in the .NET executable. If the default value of the Q_PROPERTY changes at a later stage, the .NET copy is not updated unless the component is reloaded into VS2005.
Does anyone know how to prevent the .NET application from make a copy of the content of the Q_Property? I have tried to set DESIGNABLE, SCRIPTABLE and STORED all to false without it solving the problem. And yes, I have read the docs.