本文整理汇总了C++中QAbstractItemView::setSelectionBehavior方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractItemView::setSelectionBehavior方法的具体用法?C++ QAbstractItemView::setSelectionBehavior怎么用?C++ QAbstractItemView::setSelectionBehavior使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractItemView
的用法示例。
在下文中一共展示了QAbstractItemView::setSelectionBehavior方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QListView
/*!
Return a new viewType.
*/
QAbstractItemView *ViewsToTest::createView(const QString &viewType)
{
QAbstractItemView *view = 0;
if (viewType == "QListView_ScrollPerItem") {
view = new QListView();
view->setObjectName("QListView");
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
} else if (viewType == "QListView_ScrollPerPixel") {
view = new QListView();
view->setObjectName("QListView");
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
} else if (viewType == "QHeaderViewHorizontal") {
view = new QHeaderView(Qt::Horizontal);
view->setObjectName("QHeaderView");
} else if (viewType == "QHeaderViewVertical") {
view = new QHeaderView(Qt::Vertical);
view->setObjectName("QHeaderView");
} else if (viewType == "QTableView_ScrollPerItem") {
view = new QTableView();
view->setObjectName("QTableView");
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
} else if (viewType == "QTableView_ScrollPerPixel") {
view = new QTableView();
view->setObjectName("QTableView");
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
} else if (viewType == "QTableViewNoGrid") {
QTableView *table = new QTableView();
table->setObjectName("QTableView");
table->setShowGrid(false);
view = table;
} else if (viewType == "QTreeView_ScrollPerItem") {
view = new QTreeView();
view->setObjectName("QTreeView");
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
view->setSelectionBehavior(QAbstractItemView::SelectItems);
} else if (viewType == "QTreeView_ScrollPerPixel") {
view = new QTreeView();
view->setObjectName("QTreeView");
view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
view->setSelectionBehavior(QAbstractItemView::SelectItems);
}
Q_ASSERT(view);
return view;
}