[Interest] [interest] UITools - how to modify the GUI?

Tamás Nagy tamas.nagy.001 at gmail.com
Mon Apr 13 10:06:19 CEST 2015


Hi,

How can be path bad? textEdit is in the centralWidget.
I can access it from the "ui", but not from the loaded "ui",
that is loaded with UILoader. I tried to call refresh() on it.
I can find and access any other GUI elements with
UILoader, but I cannot modify them. What can be wrong?

 <widget class="QTextEdit" name="textEdit">
      <property name="geometry">
       <rect>
        <x>10</x>
        <y>400</y>
        <width>791</width>
        <height>141</height>
       </rect>
      </property>
      <property name="accessibleName">
       <string notr="true"/>
      </property>
     </widget>
    </widget>

 QString name = "textEdit";
           if(ui->findChild<QTextEdit*>(name, Qt::FindChildrenRecursively))
           {

                QTextEdit * textedit = ui->findChild<QTextEdit*>(name,
Qt::FindChildrenRecursively);

                if(textedit)
                    textedit->append("TEST writing...\n");
           }

Tamas


2015-04-10 16:56 GMT+02:00 Alejandro Exojo <suy at badopi.org>:
> El Friday 10 April 2015, Tamás Nagy escribió:
>> // it always returns 0, no idea why. I have a textEdit with this name:
>> textEdit. QTextEdit * textedit2 = ui->findChild<QTextEdit*>("textEdit",
>
> Try:  ui->dumpObjectTree()  to see what was actually loaded as children of
> that object, just in case there is some typo in the object name.
>
> Otherwise, try to read the file yourself (just to print to the output the
> contents, to prove is readable). It could be a simple path name error.
>
> --
> Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
> http://barnacity.net/ | http://disperso.net
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list