本文整理汇总了C++中QActionGroup::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QActionGroup::setVisible方法的具体用法?C++ QActionGroup::setVisible怎么用?C++ QActionGroup::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QActionGroup
的用法示例。
在下文中一共展示了QActionGroup::setVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QToolBar
EditToolBar::EditToolBar(QWidget* parent, int tools, const char*)
: QToolBar(tr("Edit Tools"), parent)
{
setObjectName("Edit Tools");
QActionGroup* action = new QActionGroup(parent); // Parent needed.
action->setExclusive(true);
nactions = 0;
for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) {
if ((tools & (1 << i))==0)
continue;
++nactions;
}
actions = new Action*[nactions];
bool first = true;
int n = 0;
for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) {
if ((tools & (1 << i))==0)
continue;
ToolB* t = &toolList[i];
Action* a = new Action(action, 1<<i, tr(t->tip).toLatin1().data(), true);
actions[n] = a;
//a->setIconSet(QIcon(**(t->icon)));
a->setIcon(QIcon(**(t->icon)));
a->setToolTip(tr(t->tip));
a->setWhatsThis(tr(t->ltip));
if (first) {
a->setChecked(true);
first = false;
}
++n;
}
action->setVisible(true);
//action->addTo(this);
// Note: Does not take ownership.
addActions(action->actions());
connect(action, SIGNAL(triggered(QAction*)), SLOT(toolChanged(QAction*)));
toolShortcuts[PointerTool] = SHRT_TOOL_CURSOR;
toolShortcuts[PencilTool] = SHRT_TOOL_PENCIL;
toolShortcuts[RubberTool] = SHRT_TOOL_RUBBER;
toolShortcuts[CutTool] = SHRT_TOOL_SCISSORS;
toolShortcuts[GlueTool] = SHRT_TOOL_GLUE;
toolShortcuts[RangeTool] = SHRT_TOOL_RANGE;
toolShortcuts[PanTool] = SHRT_TOOL_PAN;
toolShortcuts[ZoomTool] = SHRT_TOOL_ZOOM;
//toolShortcuts[ScoreTool] = SHRT_TOOL_
//toolShortcuts[QuantTool] = SHRT_TOOL_
toolShortcuts[DrawTool] = SHRT_TOOL_LINEDRAW;
toolShortcuts[MuteTool] = SHRT_TOOL_MUTE;
toolShortcuts[AutomationTool] = SHRT_TOOL_LINEDRAW;
toolShortcuts[CursorTool] = SHRT_TOOL_CURSOR;
}
示例2: QMainWindow
//.........这里部分代码省略.........
// Highlight this player
HighlightPlayerInTable(srcIdx);
});
// Search widget
QLineEdit* playerSearch = new QLineEdit(this);
playerSearch->setCompleter(completer);
// Main toolbar
QToolBar* toolbar = new QToolBar("Toolbar");
toolbar->addWidget(new QLabel(" Status: ", this));
toolbar->addActions(QList<QAction*>{filterDrafted, filterReplacement});
toolbar->addSeparator();
toolbar->addWidget(new QLabel(" Leagues: ", this));
toolbar->addActions(QList<QAction*>{filterAL, filterNL, filterFA});
toolbar->addSeparator();
toolbar->addWidget(new QLabel(" Positions: ", this));
toolbar->addActions(QList<QAction*>{filterStarter, filterRelief});
toolbar->addActions(QList<QAction*>{filterC, filter1B, filter2B, filterSS, filter3B, filterOF, filterCI, filterMI, filterDH, filterU});
toolbar->addWidget(spacer);
toolbar->addWidget(new QLabel("Player Search: ", this));
toolbar->addWidget(playerSearch);
toolbar->setFloatable(false);
toolbar->setMovable(false);
QMainWindow::addToolBar(toolbar);
// Helper to adjust filters
auto ToggleFilterGroups = [=](int index)
{
switch (index)
{
case uint32_t(PlayerTableTabs::Hitters):
pitchingFilters->setVisible(false);
hittingFilters->setVisible(true);
break;
case uint32_t(PlayerTableTabs::Pitchers):
pitchingFilters->setVisible(true);
hittingFilters->setVisible(false);
break;
default:
break;
}
};
// Set default filter group
ToggleFilterGroups(hitterPitcherTabs->currentIndex());
//---------------------------------------------------------------------
// Bottom Section
//---------------------------------------------------------------------
// Owner widget
QHBoxLayout* ownersLayout = new QHBoxLayout(this);
ownersLayout->setSizeConstraint(QLayout::SetNoConstraint);
// Owner models
std::vector<OwnerSortFilterProxyModel*> vecOwnerSortFilterProxyModels;
// Owner labels
QList<QLabel*>* pVecOwnerLabels;
pVecOwnerLabels = new QList<QLabel*>();
pVecOwnerLabels->append(new QLabel("--"));
for (auto i = 1u; i <= DraftSettings::Get().OwnerCount; i++) {
pVecOwnerLabels->append(new QLabel(DraftSettings::Get().OwnerNames[i]));
}