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


C++ QListViewItem::isVisible方法代码示例

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


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

示例1: while

QListViewItem * ListViewDnd::itemAt( QPoint pos )
{
    QListView * src = (QListView *) this->src;
    int headerHeight = (int)(src->header()->height());
    pos.ry() -= headerHeight;
    QListViewItem * result = src->itemAt( pos );

    if ( result && ( pos.ry() < (src->itemPos(result) + result->height()/2) ) )
	result = result->itemAbove();

    // Wind back if has parent, and we're in flat mode
    while ( result && result->parent() && (dMode & Flat) )
	result = result->parent();

    // Wind back if has parent, and we're in flat mode
    while ( result && !result->isVisible() && result->parent() )
	result = result->parent();

    if ( !result && src->firstChild() && (pos.y() > src->itemRect(src->firstChild()).bottom()) ) {
	result = src->lastItem();
	if ( !result->isVisible() )
	    // Handle special case where last item is actually hidden
	    result = result->itemAbove();
    }

    return result;
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:27,代码来源:listviewdnd.cpp

示例2: 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;
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:56,代码来源:propertyeditor.cpp

示例3: deleteAllCookies

void KCookiesManagement::deleteAllCookies()
{
    if(dlg->kListViewSearchLine->text().isEmpty())
    {
        reset();
        m_bDeleteAll = true;
    }
    else
    {
        QListViewItem *item = dlg->lvCookies->firstChild();

        while(item)
        {
            if(item->isVisible())
            {
                deleteCookie(item);
                item = dlg->lvCookies->currentItem();
            }
            else
                item = item->nextSibling();
        }

        const int count = dlg->lvCookies->childCount();
        m_bDeleteAll = (count == 0);
        dlg->pbDeleteAll->setEnabled(count);

        const bool hasSelectedItem = dlg->lvCookies->selectedItem();
        dlg->pbDelete->setEnabled(hasSelectedItem);
        dlg->pbPolicy->setEnabled(hasSelectedItem);
    }

    emit changed(true);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:33,代码来源:kcookiesmanagement.cpp

示例4: slotReturnPressed

void Window::slotReturnPressed() {
	QListViewItem* item = mView->selectedItem();
	if (item && item->isVisible()) {
		switchToWindow(item);
	} else {
		QString cmd = mLineEdit->text();
		run(cmd);
	}
}
开发者ID:agateau,项目名称:switcha,代码行数:9,代码来源:window.cpp

示例5: updateSearch

	void updateSearch(const QString& text) {
		KListViewSearchLine::updateSearch(text);

		KListView* view = listView();
		QListViewItem* item = view->selectedItem();
		if (item && item->isVisible()) {
			return;
		}

		QListViewItemIterator iterator(view, QListViewItemIterator::Visible);
		item = iterator.current();
		if (item) {
			view->setSelected(item, true);
		}
	}
开发者ID:agateau,项目名称:switcha,代码行数:15,代码来源:window.cpp

示例6: sort

void popupPublic::sort()
{
        bool reselect=false;
        QListViewItem *current = keysList->firstChild();
        if (current==NULL)
                return;

	if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())){
                if (current->isSelected()) {
                        current->setSelected(false);
                        reselect=true;
                }
                current->setVisible(false);
		}

        while ( current->nextSibling() ) {
                current = current->nextSibling();
                if ((untrustedList.find(current->text(2))!=untrustedList.end()) && (!current->text(2).isEmpty())) {
                if (current->isSelected()) {
                        current->setSelected(false);
                        reselect=true;
                }
                current->setVisible(false);
		}
        }

	if (reselect || !keysList->currentItem()->isVisible()) {
                QListViewItem *firstvisible;
                firstvisible=keysList->firstChild();
                while (firstvisible->isVisible()!=true) {
                        firstvisible=firstvisible->nextSibling();
                        if (firstvisible==NULL)
                                return;
                }
                keysList->setSelected(firstvisible,true);
		keysList->setCurrentItem(firstvisible);
		keysList->ensureItemVisible(firstvisible);
        }
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:39,代码来源:popuppublic.cpp

示例7: slotSearch

/**
 * Hides all descendant that do not meet the given search criteria.
 * This slot is connected to the search() signal of the QueryResultsMenu
 * object.
 * The search is incremental: only visible items are checked, so that a new
 * search goes over the results of the previous one.
 * @param	pParent	The parent item whose child are searched
 * @param	re		The pattern to search
 * @param	nCol	The list column to search in
 */
void TreeWidget::slotSearch(QListViewItem* pParent, const QRegExp& re, 
	int nCol)
{
	QListViewItem* pItem;
	
	// Get the first child
	if (pParent != NULL)
		pItem = pParent->firstChild();
	else
		pItem = firstChild();
	
	// Iterate over all child items
	while (pItem != NULL) {
		// Filter visible items only
		if (pItem->isVisible() && re.search(pItem->text(nCol)) == -1)
			pItem->setVisible(false);
		
		// Search child items recursively
		slotSearch(pItem, re, nCol);
		
		pItem = pItem->nextSibling();
	}
}
开发者ID:fredollinger,项目名称:kscope,代码行数:33,代码来源:treewidget.cpp


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