本文整理汇总了C++中QToolButton::installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::installEventFilter方法的具体用法?C++ QToolButton::installEventFilter怎么用?C++ QToolButton::installEventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::installEventFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
void
UnicornVolumeSlider::installFilters()
{
QToolButton* muteButton = findChild<QToolButton*>();
if( muteButton )
muteButton->installEventFilter( this );
QSlider* volumeSlider = findChild<QSlider*>();
if( volumeSlider )
{
volumeSlider->setOrientation( Qt::Vertical );
volumeSlider->installEventFilter( this );
connect( volumeSlider, SIGNAL(valueChanged(int)), SLOT(onVolumeValueChanged(int)));
}
setFixedWidth( 30 );
layout()->setContentsMargins( 0, 10, 0, 10);
setAutoFillBackground( false );
}
示例2: addTitle
QAction* KMenu::addTitle(const QIcon &icon, const QString &text, QAction* before)
{
QAction *buttonAction = new QAction(this);
QFont font = buttonAction->font();
font.setBold(true);
buttonAction->setFont(font);
buttonAction->setText(text);
buttonAction->setIcon(icon);
QWidgetAction *action = new QWidgetAction(this);
action->setObjectName(KMENU_TITLE);
QToolButton *titleButton = new QToolButton(this);
titleButton->installEventFilter(d); // prevent clicks on the title of the menu
titleButton->setDefaultAction(buttonAction);
titleButton->setDown(true); // prevent hover style changes in some styles
titleButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
action->setDefaultWidget(titleButton);
insertAction(before, action);
return action;
}
示例3: SIGNAL
QToolButton * ToolBar::createPushButton(QAction *before, ToolBarAction &action)
{
if (!Actions::instance()->contains(action.actionName))
return nullptr;
MainWindow *kaduMainWindow = qobject_cast<MainWindow *>(parentWidget());
if (!kaduMainWindow)
return nullptr;
auto actionByName = Actions::instance()->value(action.actionName);
if (!actionByName)
return nullptr;
if (!kaduMainWindow->supportsActionType(actionByName->type()))
return nullptr;
action.action = Actions::instance()->createAction(action.actionName, kaduMainWindow->actionContext(), kaduMainWindow);
insertAction(before, action.action);
QToolButton *button = qobject_cast<QToolButton *>(widgetForAction(action.action));
action.widget = button;
if (button)
{
connect(button, SIGNAL(pressed()), this, SLOT(widgetPressed()));
button->installEventFilter(watcher);
button->setToolButtonStyle(action.style);
if (action.action->menu() && Actions::instance()->contains(action.actionName))
{
ActionDescription *actionDescription = Actions::instance()->value(action.actionName);
if (actionDescription)
button->setPopupMode(actionDescription->buttonPopupMode());
}
}
return button;
}