[Qt-interest] sizeof QRadiobutton

Sean Harmer sean.harmer at maps-technology.com
Tue Mar 3 14:05:50 CET 2009


On Tuesday 03 March 2009 11:47:03 Frank Lutz wrote:
> Hi,
> I have a dynamic array with Radiobuttons:
>
> QRadiobutton* btn[];
>
> than;
> btn[i] = new QRadiobutton("xyz)");
>
>
> but if i want to count:
> int x = sizeof(btn);
> i get 0.
>
> Can you tell me how I get the sizeof btn, please?
Instead of

QRadiobutton* btn[];

use

QList<QRadioButton*> btn;
for ( int i = 0; i < buttonCount; ++i )
{
    QRadioButton* button = new QRadioButton( this );
    btn.append( button );
}

int x = btn.size(); // Should be equal to buttonCount

Sean




More information about the Qt-interest-old mailing list