[Qt-creator] QRadioButton in QT Designer

Daniel Molkentin daniel.molkentin at nokia.com
Wed Jun 3 19:51:27 CEST 2009


ext Patric schrieb:
> I'm creating a form with QT Designer and there is a QRadioButton in it. 
> But I have noticed that when I click on that radio button, in the right 
> bottom of the designer there is a hierarchy, i.e. 
> QObject>QWidget>QAbstractButton and no 
> QObject>QWidget>QAbstractButton>QRadioButton, like for the push button 
> for example. For the push button it is 
> QObject>QWidget>QAbstractButton>QPushButton.

This is because QRadioButton doesn't add any new properties but exists 
merely because it has a different representation (the radio button with 
the text alongside). By omitting the inheritance step, the property 
editor reflects this. The property editor does _not_ show a widgets full 
hirachy. It only groups them by inheritance to make it easier to find 
properties and to consider alternative widgets inheriting from the same 
base class (both is probably more useful for expirienced users).


> I'm using QUiLoader and I'm making a class that should have a pointer to 
> that radio button. And I'm not sure if I should declare this pointer 
> like "QAbstractButton" or "QRadioButton".

Unless you plan tricky stuff, use QRadioButton, it makes your code more 
readable (i.e. you know what kind button in the ui is being referred to).

Daniel
-- 
Daniel Molkentin, Software Engineer,
Nokia Qt Software, www.qtsoftware.com
Rudower Chaussee 13, DE-12489 Berlin



More information about the Qt-creator-old mailing list