[Qt-interest] A error about QLabel::setText(const QString &) ?

Stefano Rosellini s.rosellini at iv-srl.it
Fri Feb 27 16:35:25 CET 2009


Your 'label_*'  variable seems to be not set.
Maybe you have defined them with
<<
  QLineEdit *label_11=new QLineEdit();
 >>
in your constructor instead of
<<
  label_11=new QLineEdit();
 >>
?

Stefano Rosellini
Informatica Valdinievole


Kermit Mei ha scritto:
> Hello! In my widget I defined the following method, and all the label_** in
> it is the type of QLabel.
>
>
> void ResultWidget::setInfo(const QString &str11,const QString &str12,
>               const QString &str21,const QString &str22,
>               const QString &str31,const QString &str32) {
>   label_11->setText(str11);
>   label_12->setText(str12);
>
>   label_21->setText(str21);
>   label_22->setText(str22);
>
>   label_31->setText(str31);
>   label_32->setText(str32);
>
> }
>
> After make the project, everything goes well, but when I run it, the program
> broke down here. The gdb output is:
>
> Program received signal SIGSEGV, Segmentation fault.
> QLabel::setText (this=0x0, text=@0xbfc70874) at widgets/qlabel.h:155
> 155    widgets/qlabel.h: No such file or directory.
>     in widgets/qlabel.h
>
>
> And the stack of the program are:
> (gdb) bt
> #0  QLabel::setText (this=0x0, text=@0xbfc70874) at widgets/qlabel.h:155
> #1  0xb7f28e7f in ResultWidget::setInfo (this=0x80c7368, str11=@0xbfc70874,
>     str12=@0xbfc70870, str21=@0xbfc7086c, str22=@0xbfc70868,
>     str31=@0xbfc70864, str32=@0xbfc70860)
>     at /home/kermit/Project/QFreeRecite/src/gui/ResultWidget.cpp:20
> ... ...
>
> I don't know why this takes errors. All the arguments I put into the arglist
> is standard QString type.
>
> What may cause it?
>
> Thanks.
> Kermit Mei
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   



More information about the Qt-interest-old mailing list