本文整理汇总了C++中QMenuBar::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar::size方法的具体用法?C++ QMenuBar::size怎么用?C++ QMenuBar::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenuBar
的用法示例。
在下文中一共展示了QMenuBar::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool
MacMenu::eventFilter(QObject *o, QEvent *ev)
{
QMenuBar *menu = qobject_cast<QMenuBar*>(o);
if (!menu)
return false;
if (!usingMacMenu)
return false;
QString func;
switch (ev->type())
{
case QEvent::Resize:
// menu->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
if (menu->size() != QSize(0,0))
{
menu->setFixedSize(0,0);
menu->updateGeometry();
}
break;
case QEvent::ActionAdded:
case QEvent::ActionChanged:
case QEvent::ActionRemoved:
changeAction(menu, static_cast<QActionEvent*>(ev));
break;
// case QEvent::ParentChange:
// qDebug() << o << ev;
// return false;
case QEvent::EnabledChange:
if (static_cast<QWidget*>(o)->isEnabled())
XBAR_SEND( MSG("requestFocus") << (qlonglong)menu );
else
XBAR_SEND( MSG("releaseFocus") << (qlonglong)menu );
break;
// TODO: test whether this is the only one and show it? (e.g. what about dialogs...?!)
case QEvent::ApplicationActivate:
// if (items.count() > 1)
// break;
case QEvent::WindowActivate:
XBAR_SEND( MSG("requestFocus") << (qlonglong)menu );
break;
case QEvent::WindowDeactivate:
// if (items.count() == 1)
// break;
case QEvent::WindowBlocked:
case QEvent::ApplicationDeactivate:
XBAR_SEND( MSG("releaseFocus") << (qlonglong)menu );
break;
default:
return false;
// maybe these need to be passed through...?!
// QEvent::GrabKeyboard
// QEvent::GrabMouse
// QEvent::KeyPress
// QEvent::KeyRelease
// QEvent::UngrabKeyboard
// QEvent::UngrabMouse
// --- and what about these ---
// QEvent::MenubarUpdated
// QEvent::ParentChange
// -------------------
}
return false;
}