本文整理汇总了C++中QAction::blockSignals方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::blockSignals方法的具体用法?C++ QAction::blockSignals怎么用?C++ QAction::blockSignals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::blockSignals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sltHandleStatusBarConfigurationChange
void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange(const QUuid &uMachineID)
{
/* Skip unrelated machine IDs: */
if (vboxGlobal().managedVMUuid() != uMachineID)
return;
/* Check whether status-bar is enabled: */
const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid());
/* Update settings action 'enable' state: */
QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings);
pActionStatusBarSettings->setEnabled(fEnabled);
/* Update switch action 'checked' state: */
QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility);
pActionStatusBarSwitch->blockSignals(true);
pActionStatusBarSwitch->setChecked(fEnabled);
pActionStatusBarSwitch->blockSignals(false);
/* Update status-bar visibility: */
statusBar()->setVisible(pActionStatusBarSwitch->isChecked());
/* Update status-bar indicators-pool: */
m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning());
/* Normalize geometry without moving: */
normalizeGeometry(false /* adjust position */);
}
示例2: sltHandleMenuBarConfigurationChange
void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange(const QUuid &uMachineID)
{
/* Skip unrelated machine IDs: */
if (vboxGlobal().managedVMUuid() != uMachineID)
return;
/* Check whether menu-bar is enabled: */
const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid());
/* Update settings action 'enable' state: */
QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings);
pActionMenuBarSettings->setEnabled(fEnabled);
/* Update switch action 'checked' state: */
QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility);
pActionMenuBarSwitch->blockSignals(true);
pActionMenuBarSwitch->setChecked(fEnabled);
pActionMenuBarSwitch->blockSignals(false);
/* Update menu-bar visibility: */
menuBar()->setVisible(pActionMenuBarSwitch->isChecked());
/* Update menu-bar: */
updateMenu();
/* Normalize geometry without moving: */
normalizeGeometry(false /* adjust position */);
}
示例3: addToPopupMenu
void QgsLegendLayerFile::addToPopupMenu( QMenu& theMenu, QAction* toggleEditingAction )
{
QgsMapLayer* lyr = layer();
// zoom to layer extent
theMenu.addAction( QgisApp::getThemeIcon( "/mActionZoomToLayer.png" ),
tr( "&Zoom to layer extent" ), legend(), SLOT( legendLayerZoom() ) );
// show in overview
QAction* showInOverviewAction = theMenu.addAction( tr( "&Show in overview" ), this, SLOT( showInOverview() ) );
showInOverviewAction->setCheckable( true );
showInOverviewAction->blockSignals( true );
showInOverviewAction->setChecked( mLyr.isInOverview() );
showInOverviewAction->blockSignals( false );
// remove from canvas
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemove.png" ),
tr( "&Remove" ), legend(), SLOT( legendLayerRemove() ) );
theMenu.addSeparator();
if ( lyr->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( lyr );
// attribute table
theMenu.addAction( tr( "&Open attribute table" ), this, SLOT( table() ) );
// editing
int cap = vlayer->dataProvider()->capabilities();
if ( cap & QgsVectorDataProvider::EditingCapabilities )
{
if ( toggleEditingAction )
{
theMenu.addAction( toggleEditingAction );
}
}
// save as shapefile
theMenu.addAction( tr( "Save as shapefile..." ), this, SLOT( saveAsShapefile() ) );
QAction* saveSelectionAction = theMenu.addAction( tr( "Save selection as shapefile..." ), this, SLOT( saveSelectionAsShapefile() ) );
if ( vlayer->selectedFeatureCount() == 0 )
{
saveSelectionAction->setEnabled( false );
}
theMenu.addSeparator();
}
else if ( lyr->type() == QgsMapLayer::RasterLayer )
{
// TODO: what was this for?
//QgsRasterLayer* rlayer = dynamic_cast<QgsRasterLayer*>(lyr);
//theMenu.addAction(tr("&Convert to..."), rlayer, SLOT(convertTo()));
}
// properties goes on bottom of menu for consistency with normal ui standards
// e.g. kde stuff
theMenu.addAction( tr( "&Properties" ), legend(), SLOT( legendLayerShowProperties() ) );
}
示例4: setShowDockStatus
void IdealController::setShowDockStatus(Qt::DockWidgetArea area, bool checked)
{
QAction* action = actionForArea(area);
if (action->isChecked() != checked) {
bool blocked = action->blockSignals(true);
action->setChecked(checked);
action->blockSignals(blocked);
}
}
示例5: clearAllChecks
void PopupMenu::clearAllChecks() const
{
QList<QAction*> list = actions();
for(int i = 0; i < list.size(); ++i)
{
QAction* act = list[i];
if(PopupMenu* menu = qobject_cast<PopupMenu*>(act->menu()))
menu->clearAllChecks(); // Recursive.
if(act->isCheckable())
{
act->blockSignals(true);
act->setChecked(false);
act->blockSignals(false);
}
}
}
示例6: eventFilter
bool eventFilter(QObject *o, QEvent *e)
{
QPanel *p = qobject_cast<QPanel*>(o);
QAction *a = qce->toggleViewAction(p);
if ( a )
{
bool sig = a->signalsBlocked();
a->blockSignals(true);
if ( a->isChecked() && e->type() == QEvent::Hide )
a->setChecked(false);
else if ( !a->isChecked() && e->type() == QEvent::Show )
a->setChecked(true);
a->blockSignals(sig);
}
return QObject::eventFilter(o, e);
}
示例7: showHelp
void MuseScore::showHelp(const QUrl& url)
{
qDebug("showHelp <%s>", qPrintable(url.toString()));
if (!_helpEngine)
return;
QAction* a = getAction("local-help");
a->blockSignals(true);
a->setChecked(true);
a->blockSignals(false);
if (!helpBrowser) {
helpBrowser = new HelpBrowser;
manualDock = new QDockWidget(tr("Manual"), 0);
manualDock->setObjectName("Manual");
manualDock->setWidget(helpBrowser);
Qt::DockWidgetArea area = Qt::RightDockWidgetArea;
addDockWidget(area, manualDock);
}
manualDock->show();
helpBrowser->setContent(url);
}
示例8: addToPopupMenu
void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
{
QgsMapLayer *lyr = layer();
QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();
QAction *saveLayerEditsAction = QgisApp::instance()->actionSaveActiveLayerEdits();
QAction *allEditsAction = QgisApp::instance()->actionAllEdits();
// zoom to layer extent
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionZoomToLayer.svg" ),
tr( "&Zoom to Layer Extent" ), legend(), SLOT( legendLayerZoom() ) );
if ( lyr->type() == QgsMapLayer::RasterLayer )
{
theMenu.addAction( tr( "&Zoom to Best Scale (100%)" ), legend(), SLOT( legendLayerZoomNative() ) );
QgsRasterLayer *rasterLayer = qobject_cast<QgsRasterLayer *>( lyr );
if ( rasterLayer && rasterLayer->rasterType() != QgsRasterLayer::Palette )
{
theMenu.addAction( tr( "&Stretch Using Current Extent" ), legend(), SLOT( legendLayerStretchUsingCurrentExtent() ) );
}
}
// show in overview
QAction* showInOverviewAction = theMenu.addAction( tr( "&Show in Overview" ), this, SLOT( showInOverview() ) );
showInOverviewAction->setCheckable( true );
showInOverviewAction->blockSignals( true );
showInOverviewAction->setChecked( mLyr.isInOverview() );
showInOverviewAction->blockSignals( false );
// remove from canvas
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.svg" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
// duplicate layer
QAction* duplicateLayersAction = theMenu.addAction( QgsApplication::getThemeIcon( "/mActionDuplicateLayer.svg" ), tr( "&Duplicate" ), QgisApp::instance(), SLOT( duplicateLayers() ) );
// set layer crs
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );
// assign layer crs to project
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );
theMenu.addSeparator();
if ( lyr->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( lyr );
// attribute table
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ),
QgisApp::instance(), SLOT( attributeTable() ) );
// allow editing
int cap = vlayer->dataProvider()->capabilities();
if ( cap & QgsVectorDataProvider::EditingCapabilities )
{
if ( toggleEditingAction )
{
theMenu.addAction( toggleEditingAction );
toggleEditingAction->setChecked( vlayer->isEditable() );
}
if ( saveLayerEditsAction && vlayer->isModified() )
{
theMenu.addAction( saveLayerEditsAction );
}
}
if ( allEditsAction->isEnabled() )
{
theMenu.addAction( allEditsAction );
}
// disable duplication of memory layers
if ( vlayer->storageType() == "Memory storage" && legend()->selectedLayers().count() == 1 )
{
duplicateLayersAction->setEnabled( false );
}
// save as vector file
theMenu.addAction( tr( "Save As..." ), QgisApp::instance(), SLOT( saveAsFile() ) );
// save selection as vector file
QAction* saveSelectionAsAction = theMenu.addAction( tr( "Save Selection As..." ), QgisApp::instance(), SLOT( saveSelectionAsVectorFile() ) );
if ( vlayer->selectedFeatureCount() == 0 )
{
saveSelectionAsAction->setEnabled( false );
}
if ( !vlayer->isEditable() && vlayer->dataProvider()->supportsSubsetString() && vlayer->vectorJoins().isEmpty() )
theMenu.addAction( tr( "&Filter..." ), QgisApp::instance(), SLOT( layerSubsetString() ) );
//show number of features in legend if requested
QAction* showNFeaturesAction = new QAction( tr( "Show Feature Count" ), &theMenu );
showNFeaturesAction->setCheckable( true );
showNFeaturesAction->setChecked( mShowFeatureCount );
QObject::connect( showNFeaturesAction, SIGNAL( toggled( bool ) ), this, SLOT( setShowFeatureCount( bool ) ) );
theMenu.addAction( showNFeaturesAction );
theMenu.addSeparator();
}