Trolltech Home | QSA-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

QSA-interest Archive, August 2006
Error trying to access a widget in QSA


Message 1 in thread

I am trying to add all widgets of a form to QSA so they are accessible from
scripts.

I use the following code to add the widgets to QSA:
//*w is my "parent"-widget
QList<QWidget *> list = w->findChildren<QWidget *>();
for (int i = 0; i < list.size(); ++i) {
  if (!list.at(i)->objectName().isEmpty()) {
    qsa.addObject( list.at(i) );
    }
  }
}

I can access almost all widgets from my QSA-script. The problem is if the
widget is owned by another widget. For example a QGroupBox.
If I type "Application.myGroupBox.", all widgets show up in the popup that
QSA Workbench offers. But when I run the code QSA complains about
"Error. Trying to access undefined member 'cmdCopy'"

Why? And how should I do instead?

I am using:
QT 4.1.0
QSA 1.2.0

To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx


Message 2 in thread

Micke Prag wrote:
> I am trying to add all widgets of a form to QSA so they are accessible from
> scripts.
> 
> I use the following code to add the widgets to QSA:
> //*w is my "parent"-widget
> QList<QWidget *> list = w->findChildren<QWidget *>();
> for (int i = 0; i < list.size(); ++i) {
>   if (!list.at(i)->objectName().isEmpty()) {
>     qsa.addObject( list.at(i) );
>     }
>   }
> }
> 
> I can access almost all widgets from my QSA-script. The problem is if the
> widget is owned by another widget. For example a QGroupBox.
> If I type "Application.myGroupBox.", all widgets show up in the popup that
> QSA Workbench offers. But when I run the code QSA complains about
> "Error. Trying to access undefined member 'cmdCopy'"
> 
> Why? And how should I do instead?

Hi Micke,

This was a bug in QSA 1.2.0. If you upgrade to 1.2.1 it will be fixed.

-
Gunnar

To unsubscribe - send "unsubscribe" in the subject to qsa-interest-request@xxxxxxxxxxxxx