开发者

Simple GUI operation in Qt

I know this is very basic question but I am new to QT thats why asking this question.

In QT, I have a QLineE开发者_JAVA技巧dit and a QPushButton. I want to set hello to the QLineEdit on the click of QPushButton. I am able to go to the click slot of the push button.

Also how to go to paint() slot of any widget.(I am not finding the paint() in the goto slot dialog.

Thanks


why do you need to "go to paint()" slot? There is no such slot in QWidget. What do you mean by "go to click slot of the push button". If you want to change text call simply setText on line edit. Everything will be repainted


For your first question:

void Foo::on_button1_clicked()
{
    lineedit1->setText( "hello" );
}

Remember to declare on_button1_clicked as a slot in the header file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜