本文整理汇总了C++中ToggleButton::setDefaultAction方法的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton::setDefaultAction方法的具体用法?C++ ToggleButton::setDefaultAction怎么用?C++ ToggleButton::setDefaultAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToggleButton
的用法示例。
在下文中一共展示了ToggleButton::setDefaultAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void ProgressManagerPrivate::init()
{
readSettings();
m_statusBarWidgetContainer = new StatusBarWidget;
m_statusBarWidget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout(m_statusBarWidget);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
m_statusBarWidget->setLayout(layout);
m_summaryProgressWidget = new QWidget(m_statusBarWidget);
m_summaryProgressWidget->setVisible(!m_progressViewPinned);
m_summaryProgressWidget->setGraphicsEffect(m_opacityEffect);
m_summaryProgressLayout = new QHBoxLayout(m_summaryProgressWidget);
m_summaryProgressLayout->setContentsMargins(0, 0, 0, 2);
m_summaryProgressLayout->setSpacing(0);
m_summaryProgressWidget->setLayout(m_summaryProgressLayout);
m_summaryProgressBar = new ProgressBar(m_summaryProgressWidget);
m_summaryProgressBar->setMinimumWidth(70);
m_summaryProgressBar->setTitleVisible(false);
m_summaryProgressBar->setSeparatorVisible(false);
m_summaryProgressBar->setCancelEnabled(false);
m_summaryProgressLayout->addWidget(m_summaryProgressBar);
layout->addWidget(m_summaryProgressWidget);
ToggleButton *toggleButton = new ToggleButton(m_statusBarWidget);
layout->addWidget(toggleButton);
m_statusBarWidgetContainer->setWidget(m_statusBarWidget);
m_statusBarWidgetContainer->setPosition(StatusBarWidget::RightCorner);
ExtensionSystem::PluginManager::addObject(m_statusBarWidgetContainer);
m_statusBarWidget->installEventFilter(this);
QAction *toggleProgressView = new QAction(tr("Toggle Progress Details"), this);
toggleProgressView->setCheckable(true);
toggleProgressView->setChecked(m_progressViewPinned);
// we have to set an transparent icon to prevent the tool button to show text
QPixmap p(1, 1);
p.fill(Qt::transparent);
toggleProgressView->setIcon(QIcon(p));
Command *cmd = ActionManager::registerAction(toggleProgressView,
"QtCreator.ToggleProgressDetails");
cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost()
? tr("Ctrl+Shift+0")
: tr("Alt+Shift+0")));
connect(toggleProgressView, &QAction::toggled,
this, &ProgressManagerPrivate::progressDetailsToggled);
toggleButton->setDefaultAction(cmd->action());
m_progressView->setVisible(m_progressViewPinned);
initInternal();
}