Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void MainWindow::insertItem (  )  [private, slot]

[6]

[6]

[7]

[7]

[8]

[8]

Definition at line 92 of file mainwindow.cpp.

References QItemSelectionModel::currentIndex(), QInputDialog::getText(), QString::isNull(), QModelIndex::isValid(), and QModelIndex::row().

{
    if (!selectionModel->currentIndex().isValid())
        return;

    QString itemText = QInputDialog::getText(this, tr("Insert Item"),
        tr("Input text for the new item:"));

    if (itemText.isNull())
        return;

    int row = selectionModel->currentIndex().row();

    if (model->insertRows(row, 1))
        model->setData(model->index(row, 0), itemText, Qt::EditRole);
}


Generated by  Doxygen 1.6.0   Back to index