Qt in Education
© 2010 Nokia Corporation and its Subsidiary(-ies).
The enclosed Qt Materials are provided under the Creative Commons Attribution-Non-Commercial-Share Alike 2.5 License Agreement.
The full license text is available here: http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode.
Nokia, Qt and the Nokia and Qt logos are the registered trademarks of Nokia Corporation in Finland and other countries worldwide.
This demonstration shows the basic functionality of QtCreator and Qt. The intention is not to give a detailed understanding, but to show what Qt is capable of and what the rest of the course will be about.
Button
Property
New value
Top
Name
addButton
Text
Add...
Middle
deleteButton
Delete
Bottom
clearButton
Clear
void Widget::on_addButton_clicked()
{
QString newText = QInputDialog::getText(this, "Enter text", "Text:");
if( !newText.isEmpty() )
ui->listWidget->addItem(newText);
}
void Widget::on_deleteButton_clicked()
foreach (QListWidgetItem *item, ui->listWidget->selectedItems())
delete item;
void Widget::updateDeleteEnabled()
ui->deleteButton->setEnabled(ui->listWidget->selectedItems().count()!=0)
connect(ui->listWidget->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(updateDeleteEnabled()));
End of demonstration!
© Nokia Corporation. All rights reserved.
m_r_k