当前位置: 首页>>代码示例>>C++>>正文


C++ QListView::currentIndex方法代码示例

本文整理汇总了C++中QListView::currentIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ QListView::currentIndex方法的具体用法?C++ QListView::currentIndex怎么用?C++ QListView::currentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QListView的用法示例。


在下文中一共展示了QListView::currentIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QCOMPARE

void tst_QFontDialog::task256466_wrongStyle()
{
    QFontDatabase fdb;
    FriendlyFontDialog dialog;
    QListView *familyList = reinterpret_cast<QListView*>(dialog.d_func()->familyList);
    QListView *styleList = reinterpret_cast<QListView*>(dialog.d_func()->styleList);
    QListView *sizeList = reinterpret_cast<QListView*>(dialog.d_func()->sizeList);
    for (int i = 0; i < familyList->model()->rowCount(); ++i) {
        QModelIndex currentFamily = familyList->model()->index(i, 0);
        familyList->setCurrentIndex(currentFamily);
        const QFont current = dialog.currentFont(),
                    expected = fdb.font(currentFamily.data().toString(),
            styleList->currentIndex().data().toString(), sizeList->currentIndex().data().toInt());
        QCOMPARE(current.family(), expected.family());
        QCOMPARE(current.style(), expected.style());
        QCOMPARE(current.pointSizeF(), expected.pointSizeF());
    }
}
开发者ID:dewhisna,项目名称:emscripten-qt,代码行数:18,代码来源:tst_qfontdialog.cpp

示例2: eventFilter

bool LocationManagementEditHelper::eventFilter(QObject *obj, QEvent *ev)
{
	QListView *view = qobject_cast<QListView*>(obj);
	if(!view)
		return false;

	if(ev->type() == QEvent::Show) {
		last_uuid = 0;
		qDebug() << "EventFilter: " << last_uuid;
	}

	if(ev->type() == QEvent::KeyPress) {
		QKeyEvent *keyEv = (QKeyEvent*) ev;
		if(keyEv->key() == Qt::Key_Return) {
			handleActivation(view->currentIndex());
			view->hide();
			return true;
		}
	}
	return false;
}
开发者ID:superscud,项目名称:subsurface,代码行数:21,代码来源:locationinformation.cpp

示例3: mapChanged

// Type: 0 = static, 1 = mission
void HWMapContainer::mapChanged(const QModelIndex & map, int type, const QModelIndex & old)
{
    QListView * mapList;

    if (type == 0)      mapList = staticMapList;
    else if (type == 1) mapList = missionMapList;
    else                return;

    // Make sure it is a valid index
    if (!map.isValid())
    {
        if (old.isValid())
        {
            mapList->setCurrentIndex(old);
            mapList->scrollTo(old);
        }
        else
        {
            m_mapInfo.type = MapModel::Invalid;
            updatePreview();
        }

        return;
    }

    // If map changed, update list selection
    if (mapList->currentIndex() != map)
    {
        mapList->setCurrentIndex(map);
        mapList->scrollTo(map);
    }

    if (map.data(Qt::UserRole + 1).canConvert<MapModel::MapInfo>())
        setMapInfo(map.data(Qt::UserRole + 1).value<MapModel::MapInfo>());
    else
        Q_ASSERT(false); // Houston, we have a problem.

}
开发者ID:gkhara,项目名称:hw,代码行数:39,代码来源:mapContainer.cpp

示例4: deleteSelected

void EmoticonViewer::deleteSelected()
{
    QListView *view = _ui->listView;
    view->model()->removeRow(view->currentIndex().row());
}
开发者ID:Brli,项目名称:Qelly,代码行数:5,代码来源:EmoticonViewer.cpp

示例5: accept

void EmoticonViewer::accept()
{
    QListView *view = _ui->listView;
    emit hasTextToInsert(view->model()->data(view->currentIndex()).toString());
    close();
}
开发者ID:Brli,项目名称:Qelly,代码行数:6,代码来源:EmoticonViewer.cpp


注:本文中的QListView::currentIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。