Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can i change a form with Qgraphicsproxywidget ?



  • Hi at all,

    I have used a Qgraphicproxywidget to add a form into a scene, but the problem is how can i have access to the gui form and how can i edit the elements during the runtime.

    My code is this one :

    proxy = new CustomProxy(0, Qt::Widget);
    proxy->setWidget(new Form);
    scene->addItem(proxy); 
    

    And the Form is a Qt designer form Class. I have a pushbutton and a QLabel, and i want to put some live data on the QLabel from a databank. How can i have access to this Gui form ?


  • Lifetime Qt Champion

    Hi,

    Keep a pointer to the Form you set on the proxy, then connect what you need to update its label.

    Hope it helps



  • @SGaist

    Thank you, could you be more clear, could you give me an example ?


  • Lifetime Qt Champion

    proxy = new CustomProxy(0, Qt::Widget);
    Form *newForm = new Form;
    proxy->setWidget(newForm);
    scene->addItem(proxy);
    newForm->doSomethingCool();
    

Log in to reply