本文整理汇总了C++中QAbstractButton::setDown方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setDown方法的具体用法?C++ QAbstractButton::setDown怎么用?C++ QAbstractButton::setDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setDown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: event
//.........这里部分代码省略.........
if (event->type() == QEvent::LayoutRequest) {
QSize oldSizeHint = sizeHint();
earlyResult = QWidget::event(event) ? 1 : 0;
needUpdate = oldSizeHint != sizeHint();
}
if (needUpdate) {
OSWindowRef windowRef = qt_mac_window_for(mainWindow);
if (toolbarInUnifiedToolBar(this)
&& macWindowToolbarIsVisible(windowRef)) {
DisableScreenUpdates();
macWindowToolbarShow(this, false);
macWindowToolbarShow(this, true);
EnableScreenUpdates();
}
}
if (earlyResult != -1)
return earlyResult;
}
}
# endif // !QT_MAC_USE_COCOA
#endif // Q_WS_MAC
break;
case QEvent::ParentChange:
d->layout->checkUsePopupMenu();
#if defined(Q_WS_MAC)
if (parentWidget() && parentWidget()->isWindow())
qt_mac_updateToolBarButtonHint(parentWidget());
#endif
break;
case QEvent::MouseButtonPress: {
if (d->mousePressEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
}
case QEvent::MouseButtonRelease:
if (d->mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
case QEvent::HoverEnter:
case QEvent::HoverLeave:
// there's nothing special to do here and we don't want to update the whole widget
return true;
case QEvent::HoverMove: {
#ifndef QT_NO_CURSOR
QHoverEvent *e = static_cast<QHoverEvent*>(event);
QStyleOptionToolBar opt;
initStyleOption(&opt);
if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos()))
setCursor(Qt::SizeAllCursor);
else
unsetCursor();
#endif
break;
}
case QEvent::MouseMove:
if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
#ifdef Q_WS_WINCE
case QEvent::ContextMenu:
{
QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event);
QWidget* child = childAt(contextMenuEvent->pos());
QAbstractButton* button = qobject_cast<QAbstractButton*>(child);
if (button)
button->setDown(false);
}
break;
#endif
case QEvent::Leave:
if (d->state != 0 && d->state->dragging) {
#ifdef Q_OS_WIN
// This is a workaround for loosing the mouse on Vista.
QPoint pos = QCursor::pos();
QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
QApplication::mouseButtons(), QApplication::keyboardModifiers());
d->mouseMoveEvent(&fake);
#endif
} else {
if (!d->layout->expanded)
break;
QWidget *w = QApplication::activePopupWidget();
if (waitForPopup(this, w)) {
d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this);
break;
}
d->waitForPopupTimer.stop();
d->layout->setExpanded(false);
break;
}
default:
break;
}
return QWidget::event(event);
}
示例2: event
/*! \reimp */
bool QToolBar::event(QEvent *event)
{
Q_D(QToolBar);
switch (event->type()) {
case QEvent::Timer:
if (d->waitForPopupTimer.timerId() == static_cast<QTimerEvent*>(event)->timerId()) {
QWidget *w = QApplication::activePopupWidget();
if (!waitForPopup(this, w)) {
d->waitForPopupTimer.stop();
if (!this->underMouse())
d->layout->setExpanded(false);
}
}
break;
case QEvent::Hide:
if (!isHidden())
break;
// fallthrough intended
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
#ifdef Q_OS_OSX
enableMacToolBar(this, event->type() == QEvent::Show);
#endif
emit visibilityChanged(event->type() == QEvent::Show);
break;
case QEvent::ParentChange:
d->layout->checkUsePopupMenu();
break;
case QEvent::MouseButtonPress: {
if (d->mousePressEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
}
case QEvent::MouseButtonRelease:
if (d->mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
case QEvent::HoverEnter:
case QEvent::HoverLeave:
// there's nothing special to do here and we don't want to update the whole widget
return true;
case QEvent::HoverMove: {
#ifndef QT_NO_CURSOR
QHoverEvent *e = static_cast<QHoverEvent*>(event);
QStyleOptionToolBar opt;
initStyleOption(&opt);
if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos()))
setCursor(Qt::SizeAllCursor);
else
unsetCursor();
#endif
break;
}
case QEvent::MouseMove:
if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
#ifdef Q_OS_WINCE
case QEvent::ContextMenu:
{
QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event);
QWidget* child = childAt(contextMenuEvent->pos());
QAbstractButton* button = qobject_cast<QAbstractButton*>(child);
if (button)
button->setDown(false);
}
break;
#endif
case QEvent::Leave:
if (d->state != 0 && d->state->dragging) {
#ifdef Q_OS_WIN
// This is a workaround for loosing the mouse on Vista.
QPoint pos = QCursor::pos();
QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
QApplication::mouseButtons(), QApplication::keyboardModifiers());
d->mouseMoveEvent(&fake);
#endif
} else {
if (!d->layout->expanded)
break;
QWidget *w = QApplication::activePopupWidget();
if (waitForPopup(this, w)) {
d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this);
break;
}
d->waitForPopupTimer.stop();
d->layout->setExpanded(false);
break;
}
default:
break;
}
return QWidget::event(event);
}