[Qt-interest] small Problem regarding setting a string as label

Stephen Jackson spjackson42 at gmail.com
Thu Apr 23 08:01:57 CEST 2009


On 23/04/09, Nouman Khalid wrote:
> Hi all
>
> i'm trying a small Qt example to get the directory path by clicking a button
> and setting that path as a text label
>
> i'm getting following error message
>
> > request for member ‘setText’ in
> ‘((Form1*)this)->Form1::textLabel1’, which is of non-class
> type ‘QLabel*’
> > make: *** [.obj/form1.o] Error 1
> >
>
> while compiling following program
>
> > void Form1::open_win()
> > {
> >  QString s = QFileDialog::getExistingDirectory(
> >                     "/home",
> >                     this,
> >                     "get existing directory",
> >                     "Choose a directory",
> >                     TRUE );
> >  textLabel1.setText(s);
> >
> > }
> >
>

The error message tells you that textLabel1 is a pointer not an object, so

    textLabel1->setText(s);

Regards,

Stephen Jackson




More information about the Qt-interest-old mailing list