本文整理汇总了C++中QAbstractItemView::hide方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractItemView::hide方法的具体用法?C++ QAbstractItemView::hide怎么用?C++ QAbstractItemView::hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractItemView
的用法示例。
在下文中一共展示了QAbstractItemView::hide方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: complete
void QGraphicsCompleter::complete(const QRect &rect)
{
if (p_proxyPopup->scene() == 0)
p_graphicsItem->scene()->addItem(p_proxyPopup);
QAbstractItemView *popup = static_cast<QAbstractItemView *>(p_proxyPopup->widget());
if (popup->model()->rowCount() == 0)
{
popup->hide();
p_graphicsItem->setFocus();
return;
}
showPopup(rect);
}
示例2: eventFilter
bool BAutoCompletionHelper::eventFilter(QObject *object, QEvent *event)
{
if (event->type() != QEvent::KeyPress)
return false;
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() != Qt::Key_Enter && ke->key() != Qt::Key_Return)
return false;
QAbstractItemView *popup = qobject_cast<QAbstractItemView *>(object);
if (!popup || !popup->isVisible())
return false;
popup->hide();
completerActivated(popup->currentIndex());
ke->ignore();
return true;
}
示例3: keyPressEvent
void TagWidget::keyPressEvent(QKeyEvent *e)
{
switch (e->key()) {
case Qt::Key_Return:
case Qt::Key_Enter:
case Qt::Key_Tab:
/*
* Fake the QLineEdit behaviour by simply
* closing the QAbstractViewitem
*/
if (m_completer) {
QAbstractItemView *popup = m_completer->popup();
if (popup)
popup->hide();
}
}
if (e->key() == Qt::Key_Tab) { // let's pretend this is a comma instead
QKeyEvent fakeEvent(e->type(), Qt::Key_Comma, e->modifiers(), QString(","));
GroupedLineEdit::keyPressEvent(&fakeEvent);
} else {
GroupedLineEdit::keyPressEvent(e);
}
}
示例4: reparse
void TagWidget::reparse()
{
highlight();
QPair<int, int> pos = getCursorTagPosition();
QString currentText;
if (pos.first >= 0 && pos.second > 0)
currentText = text().mid(pos.first, pos.second - pos.first).trimmed();
else
currentText = "";
if (m_completer) {
m_completer->setCompletionPrefix(currentText);
if (m_completer->completionCount() == 1) {
if (m_completer->currentCompletion() == currentText) {
QAbstractItemView *popup = m_completer->popup();
if (popup)
popup->hide();
} else {
m_completer->complete();
}
} else {
m_completer->complete();
}
}
}