예제 #1
0
void MainWindow::bodyclicked(int bodyIndex)
{
    indexSelected = bodyIndex;
    QListView * objectList = findChild<QListView*>(QString("objectList"));
    if(indexSelected == -1) //used clicked on empty space
    {
        objectList->clearSelection();
    }
    else
    {
       QModelIndex qIndex = objectListSource->index(indexSelected);
       objectList->setCurrentIndex(qIndex);
    }
}
예제 #2
0
파일: MainWindow.cpp 프로젝트: fer-rum/q2d
/**
 * @brief MainWindow::setDocumentModel
 *
 * Will be called whe a new q2d::Project is created, to link the projects
 * document model with the appropriate list view in the UI.
 * @param model
 */
void
MainWindow::slot_setDocumentModel(QStandardItemModel* model) {

    // close all tabs related to the old model
    m_ui->schematicsTabWidget->clear();

    QListView* documentView = m_ui->documentListView;

    documentView->clearSelection();
    QAbstractItemModel* oldModel = documentView->model();

    m_ui->documentListView->setModel(model);

    if (oldModel != nullptr) {
        oldModel->disconnect();
        oldModel->deleteLater();
    }
}
예제 #3
0
void FileDialog::clearSelection()
{
    QListView *view = findChild<QListView*>();
	Q_ASSERT( view );
	view->clearSelection();
}