本文整理汇总了C++中QListViewItem::isSelectable方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::isSelectable方法的具体用法?C++ QListViewItem::isSelectable怎么用?C++ QListViewItem::isSelectable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::isSelectable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleKeyPress
bool PropertyEditor::handleKeyPress(QKeyEvent* ev) {
const int k = ev->key();
const Qt::ButtonState s = ev->state();
//selection moving
QListViewItem *item = 0;
if ((s == NoButton && k == Key_Up) || k == Key_BackTab) {
//find prev visible
item = selectedItem() ? selectedItem()->itemAbove() : 0;
while (item && (!item->isSelectable() || !item->isVisible()))
item = item->itemAbove();
if (!item)
return true;
} else if (s == NoButton && (k == Key_Down || k == Key_Tab)) {
//find next visible
item = selectedItem() ? selectedItem()->itemBelow() : 0;
while (item && (!item->isSelectable() || !item->isVisible()))
item = item->itemBelow();
if (!item)
return true;
} else if (s == NoButton && k == Key_Home) {
if (m_currentEditor && m_currentEditor->hasFocus())
return false;
//find 1st visible
item = firstChild();
while (item && (!item->isSelectable() || !item->isVisible()))
item = item->itemBelow();
} else if (s == NoButton && k == Key_End) {
if (m_currentEditor && m_currentEditor->hasFocus())
return false;
//find last visible
item = selectedItem();
QListViewItem *lastVisible = item;
while (item) { // && (!item->isSelectable() || !item->isVisible()))
item = item->itemBelow();
if (item && item->isSelectable() && item->isVisible())
lastVisible = item;
}
item = lastVisible;
}
if (item) {
ev->accept();
ensureItemVisible(item);
setSelected(item, true);
return true;
}
return false;
}
示例2: contentsDragMoveEvent
void KonqSidebarTree::contentsDragMoveEvent( QDragMoveEvent *e )
{
QListViewItem *item = itemAt( contentsToViewport( e->pos() ) );
// Accept drops on the background, if URLs
if ( !item && m_lstDropFormats.contains("text/uri-list") )
{
m_dropItem = 0;
e->acceptAction();
if (selectedItem())
setSelected( selectedItem(), false ); // no item selected
return;
}
if (item && static_cast<KonqSidebarTreeItem*>(item)->acceptsDrops( m_lstDropFormats )) {
d->m_dropMode = SidebarTreeMode;
if ( !item->isSelectable() )
{
m_dropItem = 0;
m_autoOpenTimer->stop();
e->ignore();
return;
}
e->acceptAction();
setSelected( item, true );
if ( item != m_dropItem )
{
m_autoOpenTimer->stop();
m_dropItem = item;
m_autoOpenTimer->start( autoOpenTimeout );
}
} else {
d->m_dropMode = KListViewMode;
KListView::contentsDragMoveEvent(e);
}
}