thanks a lot mate. it fixed my problem.
![]()
thanks a lot mate. it fixed my problem.
![]()
How can i get the input from the users??
i have used this code
Qt Code:
void Dialog::gettext() { ui->dislabel->setText(text); }To copy to clipboard, switch view to plain text mode
but this code pops up a dialog which i dont need.
What i want is, when i add the text in the lineedit, it should be reflected in the label, or
when i add the text in the lineedit, a variable names text has to store it.
so, you need to add QLineEdit to your form and then
this code will add a text from lineEdit to label.Qt Code:
... ...To copy to clipboard, switch view to plain text mode
Qt Code:
... connect(ui->pushButton, SIGNAL(clicked()), SLOT(getLineEditText()));//get text by clicking on a button connect(ui->lineEdit, SIGNAL(editingFinished()), SLOT(getLineEditText()));//get text by pressing enter in a lineEdit //you can also use QLineEdit::returnPressed insted of QLineEdit::editingFinished ... void MyWidget::getLineEditText() { qDebug() << ui->lineEdit->text(); }To copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
use second variant
Qt Code:
... connect(ui->pushButton, SIGNAL(clicked()), SLOT(getLineEditText()));//get text by clicking on a button connect(ui->lineEdit, SIGNAL(editingFinished()), SLOT(getLineEditText()));//get text by pressing enter in a lineEdit //you can also use QLineEdit::returnPressed insted of QLineEdit::editingFinished ... void MyWidget::getLineEditText() { ui->label->setText(myVar); }To copy to clipboard, switch view to plain text mode![]()
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
thanks mate. you have helped me alot.![]()
mate if i want o add a icon into the application, how can it be done?
I have seen .qrc files. I need to store the image in this particular file
The icon i am talking about is the one is that tiny icon that appears at the top left corner of an application.
I think that you should take closer look into Qt Exapmples & Demos and Qt Assistant. There are a lot of exapmples and explanations to all problems you posted here, and it's quite easy find answers there.
I would like to be a "Guru"
Useful hints (try them before asking):
- Use Qt Assistant
- Search the forum
If you haven't found solution yet then create new topic with smart question.
Bookmarks