本文整理汇总了C++中QAction::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::isVisible方法的具体用法?C++ QAction::isVisible怎么用?C++ QAction::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::isVisible方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isVisible
bool QActionProto::isVisible() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->isVisible();
return false;
}
示例2:
QMap<QAction*, QtilitiesCategory> Qtilities::CoreGui::ActionProvider::actionMap(IActionProvider::ActionFilterFlags action_filter, const QtilitiesCategory& category_filter) const {
// Loop through all actions and inspect them:
QMap<QAction*, QtilitiesCategory> filtered_map;
for (int i = 0; i < d->actions.count(); i++) {
QAction* action = d->actions.keys().at(i);
bool add_action = true;
// Check the category:
if (d->actions.values().at(i) != category_filter && !category_filter.isEmpty())
add_action = false;
// Check for IActionProvider::FilterDisabled
if (action_filter & IActionProvider::FilterDisabled && add_action) {
if (!action->isEnabled())
add_action = false;
}
// Check for IActionProvider::FilterHidden
if (action_filter & IActionProvider::FilterHidden && add_action) {
if (!action->isVisible())
add_action = false;
}
if (add_action)
filtered_map[d->actions.keys().at(i)] = d->actions.values().at(i);
}
return filtered_map;
}
示例3: isEnabled
// Set the state of the menu items
bool selectMenu::isEnabled( imageContextMenu::imageContextMenuOptions option )
{
QAction* action = getAction( option );
if( action )
{
return action->isVisible();
}
else
{
return false;
}
}
示例4: QLabel
ModeStripe::ModeStripe(QAction &modeAction, const QString &text, QWidget *parent)
: QLabel((" <b>%1</b> - " + tr("press %2 or click here to switch to %3"))
.arg(text, modeAction.shortcut().toString(), modeAction.property("modeName").toString()), parent)
, mAction(modeAction)
{
setFrameShape(QFrame::NoFrame);
setFrameShadow(QFrame::Plain);
setLineWidth(0);
addAction(&modeAction);
connect(&modeAction, &QAction::changed, this, [&modeAction, this]() {
setVisible(modeAction.isVisible() && !modeAction.isChecked());
});
}
示例5: qSort
QList<QAction*> Qtilities::CoreGui::ActionProvider::actions(IActionProvider::ActionFilterFlags action_filter, const QtilitiesCategory& category_filter) const {
// Loop through all actions and inspect them:
QMap<QString, QAction*> filtered_map;
for (int i = 0; i < d->actions.count(); i++) {
QAction* action = d->actions.keys().at(i);
if (!action)
continue;
bool add_action = true;
// Check the category:
if (category_filter != QtilitiesCategory("Hello World!")) {
if ((d->actions.values().at(i) != category_filter))
add_action = false;
}
// Check for IActionProvider::FilterDisabled:
if (action_filter & IActionProvider::FilterDisabled && add_action) {
if (!action->isEnabled())
add_action = false;
}
// Check for IActionProvider::FilterHidden:
if (action_filter & IActionProvider::FilterHidden && add_action) {
if (!action->isVisible())
add_action = false;
}
if (add_action) {
filtered_map[action->text()] = action;
}
}
// We need to sort the list here by the action names:
QStringList name_list = filtered_map.keys();
qSort(name_list.begin(), name_list.end());
// Build final list in sorted order and return it:
QList<QAction*> final_list;
for (int i = 0; i < name_list.count(); i++)
final_list << filtered_map[name_list.at(i)];
return final_list;
}
示例6: paintEvent
void WidgetMenuBarMapEditor::paintEvent(QPaintEvent *e) {
QPainter p(this);
// Draw the items
for (int i = 0; i < actions().size(); ++i) {
QAction *action = actions().at(i);
QRect adjustedActionRect = this->actionGeometry(action);
// Fill by the magic color the selected item
if (action->property("selection") == true) {
if (m_selection)
p.fillRect(adjustedActionRect, colorBackgroundSelected);
else
p.fillRect(adjustedActionRect, colorBackgroundRightSelected);
}
// Draw all the other stuff (text, special background..)
if (adjustedActionRect.isEmpty() || !action->isVisible())
continue;
if(!e->rect().intersects(adjustedActionRect))
continue;
QStyleOptionMenuItem opt;
initStyleOption(&opt, action);
opt.rect = adjustedActionRect;
// Drawing separator and disabled with darker color
if (opt.icon.isNull()) {
if (action->text() == "|" || !action->isEnabled())
p.setPen(QColor(100, 100, 100));
else
p.setPen(Qt::white);
p.drawText(adjustedActionRect, action->text(),
QTextOption(Qt::AlignCenter));
opt.text = "";
}
style()->drawControl(QStyle::CE_MenuBarItem, &opt, &p, this);
}
}
示例7: visiblePropagation
void tst_QActionGroup::visiblePropagation()
{
QActionGroup testActionGroup( 0 );
QAction* childAction = new QAction( &testActionGroup );
QAction* anotherChildAction = new QAction( &testActionGroup );
QAction* freeAction = new QAction(0);
QVERIFY( testActionGroup.isVisible() );
QVERIFY( childAction->isVisible() );
testActionGroup.setVisible( false );
QVERIFY( !testActionGroup.isVisible() );
QVERIFY( !childAction->isVisible() );
QVERIFY( !anotherChildAction->isVisible() );
anotherChildAction->setVisible(false);
testActionGroup.setVisible( true );
QVERIFY( testActionGroup.isVisible() );
QVERIFY( childAction->isVisible() );
QVERIFY( !anotherChildAction->isVisible() );
testActionGroup.setVisible( false );
QAction *lastChildAction = new QAction(&testActionGroup);
QVERIFY(!lastChildAction->isVisible());
testActionGroup.setVisible( true );
QVERIFY(lastChildAction->isVisible());
freeAction->setVisible(false);
testActionGroup.addAction(freeAction);
QVERIFY(!freeAction->isVisible());
delete freeAction;
}
示例8: isDisplayed
// Return true if the markup is to be displayed.
bool markupDisplayMenu::isDisplayed( imageContextMenu::imageContextMenuOptions option )
{
QAction* action = getAction( option );
if( action )
{
// If the action is visible, return its state
if( action->isVisible() )
{
return action->isChecked();
}
// If the action is not visiible, ignore its state and return false as the markup is not even enabled (it is not intended to be used)
else
{
return false;
}
}
// Sanity check. Action should always be available
else
{
return false;
}
}
示例9: isHidden
bool QRToolBar::isHidden(int id) const {
eAssert(id < (int) numButtons(), ("index (%d) out of bounds (0..%d) for QRToolBar::isCheckable!",
id, numButtons()-1));
QAction *action = getAction(id);
return !action->isVisible();
}