Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ActiveQt and writable Q_Property
Forum Updated to NodeBB v4.3 + New Features

ActiveQt and writable Q_Property

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    redlars
    wrote on last edited by
    #1

    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;
    };

    @

    1 Reply Last reply
    0
    • R Offline
      R Offline
      redlars
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved