[Interest] Find UI elements by name and get type of UI element

Daniel França daniel.franca at gmail.com
Thu Apr 2 16:48:13 CEST 2015


The variable that will receive the return only get the child if it can be
casted to it: http://doc.qt.io/qt-5/qobject.html#findChild
So you can call it with the button, numeric up/down, etc.
Or you can try cast it after call the method.

http://doc.qt.io/qt-5/qobject.html#findChild

Em qui, 2 de abr de 2015 às 16:42, Tamás Nagy <tamas.nagy.001 at gmail.com>
escreveu:

> Hi,
>
> I have a Qt Creator UI. There are buttons and other things on it.
>
> I read a list from a file with widget names, and there are booleans: 0
> - not toggled, 1 - toggled,
> or other widget specific parameters.
>
> I would like to update my UI, based on this list.
>
>
> QWidget widget = ui->centralWidget->findChild(qName,
> Qt::FindChildrenRecursively);
>
> // get type of widget, but how?
>
> I can get the widget, but how to decide it's type?
> If it is a button or a numeric up/down (to set upper and lower limits)...?
>
> Tamas
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150402/31c77cbc/attachment.html>


More information about the Interest mailing list