[Qt-interest] qlineedit setText crash

caius ligarius caius9090 at gmail.com
Mon May 17 23:05:50 CEST 2010


Hi,

I have added a QLineEdit widget to QMainWindow. I want to update the text in
QLineEdit widget everytime a certain function gets called.
(updatePixelValue). When I try to do setText in that function the code
crashes. See code below-

void Viewer:: updatePixelValue(QPointF p)
{
    int x = p.x();
    int y = p.y();
    QString s;
    s.sprintf("x=%d y=%d",x,y);
    ui.lineEdit->setText(s);
}

Viewer: is QMainWindow
ui: is created using Qt Designer
updatePixelValue(QPointF p): x,y values here are correctly being set to some
integer numbers from "p"

The above code crashes at the last line (setText)??


Thanks,
Caius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100517/ad856b5b/attachment.html 


More information about the Qt-interest-old mailing list