本文整理汇总了C++中QMenu::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::setProperty方法的具体用法?C++ QMenu::setProperty怎么用?C++ QMenu::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::setProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
QMenu* Scene_c3t3_item::contextMenu()
{
const char* prop_name = "Menu modified by Scene_c3t3_item.";
QMenu* menu = Scene_item::contextMenu();
// Use dynamic properties:
// http://doc.qt.io/qt-5/qobject.html#property
bool menuChanged = menu->property(prop_name).toBool();
if (!menuChanged) {
QAction* actionExportFacetsInComplex =
menu->addAction(tr("Export facets in complex"));
actionExportFacetsInComplex->setObjectName("actionExportFacetsInComplex");
connect(actionExportFacetsInComplex,
SIGNAL(triggered()), this,
SLOT(export_facets_in_complex()));
QAction* actionShowSpheres =
menu->addAction(tr("Show protecting &spheres"));
actionShowSpheres->setCheckable(true);
actionShowSpheres->setObjectName("actionShowSpheres");
connect(actionShowSpheres, SIGNAL(toggled(bool)),
this, SLOT(show_spheres(bool)));
menu->setProperty(prop_name, true);
}
示例2: contextMenu
QMenu* Scene_polylines_item::contextMenu()
{
const char* prop_name = "Menu modified by Scene_polylines_item.";
QMenu* menu = Scene_item::contextMenu();
// Use dynamic properties:
// http://doc.qt.io/qt-5/qobject.html#property
bool menuChanged = menu->property(prop_name).toBool();
if(!menuChanged) {
menu->addSeparator();
// TODO: add actions to display corners
QAction* action = menu->addAction(tr("Display corners with radius..."));
connect(action, SIGNAL(triggered()),
this, SLOT(change_corner_radii()));
QAction* actionSmoothPolylines =
menu->addAction(tr("Smooth polylines"));
actionSmoothPolylines->setObjectName("actionSmoothPolylines");
connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));
menu->setProperty(prop_name, true);
}
return menu;
}
示例3: contextMenu
QMenu* Scene_polylines_item::contextMenu()
{
const char* prop_name = "Menu modified by Scene_polylines_item.";
QMenu* menu = Scene_item::contextMenu();
// Use dynamic properties:
// http://doc.qt.io/qt-5/qobject.html#property
bool menuChanged = menu->property(prop_name).toBool();
if(!menuChanged) {
menu->addSeparator();
// TODO: add actions to display corners
QAction* action = menu->addAction(tr("Display corners with radius..."));
connect(action, SIGNAL(triggered()),
this, SLOT(change_corner_radii()));
QAction* actionSmoothPolylines =
menu->addAction(tr("Smooth polylines"));
actionSmoothPolylines->setObjectName("actionSmoothPolylines");
connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth()));
QMenu *container = new QMenu(tr("Line Width"));
QWidgetAction *sliderAction = new QWidgetAction(0);
connect(d->line_Slider, &QSlider::valueChanged, this, &Scene_polylines_item::itemChanged);
sliderAction->setDefaultWidget(d->line_Slider);
container->addAction(sliderAction);
menu->addMenu(container);
menu->setProperty(prop_name, true);
}
return menu;
}
示例4: contextMenu
QMenu* Scene_combinatorial_map_item::contextMenu()
{
const char* prop_name = "Menu modified by Scene_combinatorial_map_item.";
QMenu* menu = Scene_item::contextMenu();
// Use dynamic properties:
// http://doc.qt.io/qt-5/qobject.html#property
bool menuChanged = menu->property(prop_name).toBool();
if(!menuChanged) {
QAction* actionSelectNextVolume =
menu->addAction(tr("Iterate over volumes"));
actionSelectNextVolume->setObjectName("actionSelectNextVolume");
connect(actionSelectNextVolume, SIGNAL(triggered()),this, SLOT(set_next_volume()));
exportSelectedVolume =
menu->addAction(tr("Export current volume as polyhedron"));
exportSelectedVolume->setObjectName("exportSelectedVolume");
connect(exportSelectedVolume, SIGNAL(triggered()),this, SLOT(export_current_volume_as_polyhedron()));
exportSelectedVolume->setEnabled(volume_to_display!=0);
menu->setProperty(prop_name, true);
if(is_from_corefinement()){
//Export union as polyhedron
QAction* exportUnion =
menu->addAction(tr("Export union as polyhedron"));
exportUnion->setObjectName("exportUnion");
connect(exportUnion, SIGNAL(triggered()),this, SLOT(export_union_as_polyhedron()));
//Export intersection as polyhedron
QAction* exportIntersection =
menu->addAction(tr("Export intersection as polyhedron"));
exportIntersection->setObjectName("exportIntersection");
connect(exportIntersection, SIGNAL(triggered()),this, SLOT(export_intersection_as_polyhedron()));
//Export A minus B as polyhedron
QAction* exportAMinusB =
menu->addAction(tr("Export A minus B as polyhedron"));
exportAMinusB->setObjectName("exportAMinusB");
connect(exportAMinusB, SIGNAL(triggered()),this, SLOT(export_A_minus_B_as_polyhedron()));
//Export B minus A as polyhedron
QAction* exportBMinusA =
menu->addAction(tr("Export B minus A as polyhedron"));
exportBMinusA->setObjectName("exportBMinusA");
connect(exportBMinusA, SIGNAL(triggered()),this, SLOT(export_B_minus_A_as_polyhedron()));
}
}
return menu;
}
示例5: initActions
void CBookshelfIndex::initActions()
{
// Each action has a type attached to it as a dynamic property, see actionenum.h.
// Menuitem and its subitems can have the same type.
// Actions can have also "singleItemAction" property if
// it supports only one item.
// See contextMenu() and BTIndexItem for how these properties are used later.
// Actions are added to the popup menu and also to a list for easy foreach access.
QMenu* actionMenu = 0;
QAction* action = 0;
// -------------------------Grouping --------------------------------------
actionMenu = new QMenu(tr("Grouping"), this);
actionMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::grouping::icon));
actionMenu->setProperty("indexActionType", QVariant(Grouping));
m_groupingGroup = new QActionGroup(this);
QObject::connect(m_groupingGroup, SIGNAL(triggered(QAction*)), this, SLOT(actionChangeGrouping(QAction*)) );
//TODO: set the inital checked state
action = newQAction(tr("Category/Language"), CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
action->setCheckable(true);
action->setProperty("indexActionType", QVariant(Grouping));
action->setProperty("grouping", BTModuleTreeItem::CatLangMod);
actionMenu->addAction(action);
m_groupingGroup->addAction(action);
if (m_grouping == BTModuleTreeItem::CatLangMod) action->setChecked(true);
m_actionList.append(action);
action = newQAction(tr("Category"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
action->setCheckable(true);
m_groupingGroup->addAction(action);
if (m_grouping == BTModuleTreeItem::CatMod) action->setChecked(true);
action->setProperty("indexActionType", QVariant(Grouping));
action->setProperty("grouping", BTModuleTreeItem::CatMod);
actionMenu->addAction(action);
m_actionList.append(action);
action = newQAction(tr("Language/Category"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
action->setCheckable(true);
m_groupingGroup->addAction(action);
if (m_grouping == BTModuleTreeItem::LangCatMod) action->setChecked(true);
actionMenu->addAction(action);
action->setProperty("indexActionType", QVariant(Grouping));
action->setProperty("grouping", BTModuleTreeItem::LangCatMod);
m_actionList.append(action);
action = newQAction(tr("Language"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
action->setCheckable(true);
m_groupingGroup->addAction(action);
if (m_grouping == BTModuleTreeItem::LangMod) action->setChecked(true);
actionMenu->addAction(action);
action->setProperty("indexActionType", QVariant(Grouping));
action->setProperty("grouping", BTModuleTreeItem::LangMod);
m_actionList.append(action);
action = newQAction(tr("Works only"),CResMgr::mainIndex::grouping::icon, 0, 0, 0, this);
action->setCheckable(true);
m_groupingGroup->addAction(action);
if (m_grouping == BTModuleTreeItem::Mod) action->setChecked(true);
actionMenu->addAction(action);
action->setProperty("indexActionType", QVariant(Grouping));
action->setProperty("grouping", BTModuleTreeItem::Mod);
m_actionList.append(action);
action = m_popup->addMenu(actionMenu);
action->setProperty("indexActionType", QVariant(Grouping));
m_actionList.append(action);
// ------------Hide---------------------
action = newQAction(tr("Hide/unhide works..."),CResMgr::mainIndex::search::icon, 0, this, SLOT(actionHideModules()), this);
action->setProperty("indexActionType", QVariant(HideModules));
//action->setProperty("multiItemAction", QVariant(true));
m_popup->addAction(action);
m_actionList.append(action);
// -------------------Show hidden---------------------------
action = newQAction(tr("Show hidden"),CResMgr::mainIndex::search::icon, 0, 0, 0, this);
action->setProperty("indexActionType", QVariant(ShowAllModules));
action->setCheckable(true);
QObject::connect(action, SIGNAL(toggled(bool)), this, SLOT(actionShowModules(bool)));
if (m_showHidden) action->setChecked(true); else action->setChecked(false);
m_popup->addAction(action);
m_actionList.append(action);
m_popup->addSeparator();
//------------------------------------------------------------
//----------------- Actions for items ------------------------
// -------------------------Edit module --------------------------------
actionMenu = new QMenu(tr("Edit"), this);
actionMenu->setIcon(util::filesystem::DirectoryUtil::getIcon(CResMgr::mainIndex::editModuleMenu::icon) );
// actionMenu->setDelayed(false);
actionMenu->setProperty("indexActionType", QVariant(EditModule));
//.........这里部分代码省略.........