Commit 1f5b2bbd authored by Boudewijn Rempt's avatar Boudewijn Rempt

Set the default shortcuts on the action collection, not the action

Even though KActionCollection seems perfectly capable of taking
corrective action, _and_ the warning is dangerous, because just
setting the shortcut on the action _after_ adding the action to
the collection doesn't trigger the warning (but, I guess, the
bug to which the warning refers).
parent dc0bd7f8
......@@ -50,13 +50,13 @@ ImageSize::ImageSize(QObject *parent, const QVariantList &)
KisAction *action = new KisAction(i18n("Scale Image To New Size..."), this);
action->setActivationFlags(KisAction::ACTIVE_NODE);
addAction("imagesize", action);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_I));
action->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_I));
connect(action, SIGNAL(triggered()), this, SLOT(slotImageSize()));
action = new KisAction(i18n("Resize Canvas..."), this);
action->setActivationFlags(KisAction::ACTIVE_NODE);
addAction("canvassize", action);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_C));
action->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_C));
connect(action, SIGNAL(triggered()), this, SLOT(slotCanvasSize()));
action = new KisAction(i18n("Scale &Layer to new Size..."), this);
......
......@@ -70,7 +70,7 @@ ModifySelection::ModifySelection(QObject *parent, const QVariantList &)
action->setActivationConditions(KisAction::SELECTION_EDITABLE);
action->setOperationID("featherselection");
addAction("featherselection", action);
action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F6));
action->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F6));
addUIFactory(new KisOperationUIWidgetFactory<WdgFeatherSelection>("featherselection"));
addOperation(new FeatherSelectionOperation);
......
......@@ -2061,7 +2061,7 @@ void KisMainWindow::createActions()
d->closeAll = new KisAction(i18nc("@action:inmenu", "Close All"));
d->closeAll->setActivationFlags(KisAction::ACTIVE_IMAGE);
d->closeAll->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W));
d->closeAll->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_W));
actionManager->addAction("file_close_all", d->closeAll);
connect(d->closeAll, SIGNAL(triggered()), this, SLOT(slotFileCloseAll()));
......
......@@ -155,7 +155,7 @@ void KisPart::Private::loadActions()
action->setToolTip(toolTip);
action->setStatusTip(statusTip);
action->setIconText(iconText);
action->setShortcut(shortcut);
action->setDefaultShortcut(shortcut);
action->setCheckable(isCheckable);
if (!actionCollection->action(name)) {
......
......@@ -657,13 +657,13 @@ KisUndoAdapter * KisViewManager::undoAdapter()
void KisViewManager::createActions()
{
d->saveIncremental = new KisAction(i18n("Save Incremental &Version"), this);
d->saveIncremental->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
d->saveIncremental->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
d->saveIncremental->setActivationFlags(KisAction::ACTIVE_IMAGE);
actionManager()->addAction("save_incremental_version", d->saveIncremental);
connect(d->saveIncremental, SIGNAL(triggered()), this, SLOT(slotSaveIncremental()));
d->saveIncrementalBackup = new KisAction(i18n("Save Incremental Backup"), this);
d->saveIncrementalBackup->setShortcut(Qt::Key_F4);
d->saveIncrementalBackup->setDefaultShortcut(Qt::Key_F4);
d->saveIncrementalBackup->setActivationFlags(KisAction::ACTIVE_IMAGE);
actionManager()->addAction("save_incremental_backup", d->saveIncrementalBackup);
connect(d->saveIncrementalBackup, SIGNAL(triggered()), this, SLOT(slotSaveIncrementalBackup()));
......@@ -675,7 +675,7 @@ void KisViewManager::createActions()
KisAction *tabletDebugger = new KisAction(i18n("Toggle Tablet Debugger"), this);
actionManager()->addAction("tablet_debugger", tabletDebugger );
tabletDebugger->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
tabletDebugger->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
connect(tabletDebugger, SIGNAL(triggered()), this, SLOT(toggleTabletLogger()));
d->createTemplate = new KisAction( i18n( "&Create Template From Image..." ), this);
......@@ -697,18 +697,18 @@ void KisViewManager::createActions()
d->rotateCanvasRight = new KisAction(i18n("Rotate Canvas Right"), this);
actionManager()->addAction("rotate_canvas_right", d->rotateCanvasRight);
d->rotateCanvasRight->setActivationFlags(KisAction::ACTIVE_IMAGE);
d->rotateCanvasRight->setShortcut(QKeySequence("Ctrl+]"));
d->rotateCanvasRight->setDefaultShortcut(QKeySequence("Ctrl+]"));
d->rotateCanvasLeft = new KisAction(i18n("Rotate Canvas Left"), this);
actionManager()->addAction("rotate_canvas_left", d->rotateCanvasLeft);
d->rotateCanvasLeft->setActivationFlags(KisAction::ACTIVE_IMAGE);
d->rotateCanvasLeft->setShortcut(QKeySequence("Ctrl+["));
d->rotateCanvasLeft->setDefaultShortcut(QKeySequence("Ctrl+["));
d->wrapAroundAction = new KisAction(i18n("Wrap Around Mode"), this);
d->wrapAroundAction->setCheckable(true);
d->wrapAroundAction->setActivationFlags(KisAction::ACTIVE_IMAGE);
actionManager()->addAction("wrap_around_mode", d->wrapAroundAction);
d->wrapAroundAction->setShortcut(QKeySequence(Qt::Key_W));
d->wrapAroundAction->setDefaultShortcut(QKeySequence(Qt::Key_W));
KisAction *tAction = new KisAction(i18n("Show Status Bar"), this);
tAction->setCheckable(true);
......@@ -732,7 +732,7 @@ void KisViewManager::createActions()
//Workaround, by default has the same shortcut as mirrorCanvas
KisAction *a = dynamic_cast<KisAction*>(actionCollection()->action("format_italic"));
if (a) {
a->setShortcut(QKeySequence());
a->setDefaultShortcut(QKeySequence());
a->setActivationConditions(KisAction::SELECTION_EDITABLE);
}
......@@ -760,7 +760,7 @@ void KisViewManager::createActions()
d->zoomTo100pct = new KisAction(i18n("Reset zoom"), this);
d->zoomTo100pct->setActivationFlags(KisAction::ACTIVE_IMAGE);
actionManager()->addAction("zoom_to_100pct", d->zoomTo100pct);
d->zoomTo100pct->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_0 ) );
d->zoomTo100pct->setDefaultShortcut( QKeySequence( Qt::CTRL + Qt::Key_0 ) );
d->zoomIn = actionManager()->createStandardAction(KStandardAction::ZoomIn, 0, "");
d->zoomOut = actionManager()->createStandardAction(KStandardAction::ZoomOut, 0, "");
......
......@@ -52,13 +52,13 @@ void KisGridManager::setup(KisActionManager* actionManager)
m_toggleGrid = new KisAction(KisIconUtils::loadIcon("view-grid"), i18n("Show Grid"), 0);
m_toggleGrid->setCheckable(true);
m_toggleGrid->setActivationFlags(KisAction::ACTIVE_NODE);
m_toggleGrid->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Apostrophe));
m_toggleGrid->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Apostrophe));
actionManager->addAction("view_grid", m_toggleGrid);
m_toggleSnapToGrid = new KisAction(i18n("Snap To Grid"), this);
m_toggleSnapToGrid->setCheckable(true);
m_toggleSnapToGrid->setActivationFlags(KisAction::ACTIVE_NODE);
m_toggleSnapToGrid->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Semicolon));
m_toggleSnapToGrid->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Semicolon));
//actionManager->addAction("view_snap_to_grid", m_toggleSnapToGrid);
connect(m_toggleSnapToGrid, SIGNAL(triggered()), this, SLOT(toggleSnapToGrid()));
}
......
......@@ -31,6 +31,7 @@ public:
QStringList excludedNodeTypes;
QString operationID;
KisActionManager* actionManager;
QKeySequence defaultShortcut;
};
KisAction::KisAction(QObject* parent)
......@@ -62,6 +63,16 @@ KisAction::~KisAction()
delete d;
}
void KisAction::setDefaultShortcut(const QKeySequence &shortcut)
{
d->defaultShortcut = shortcut;
}
QKeySequence KisAction::defaultShortcut() const
{
return d->defaultShortcut;
}
void KisAction::setActivationFlags(KisAction::ActivationFlags flags)
{
d->flags = flags;
......
......@@ -62,6 +62,9 @@ public:
KisAction(const QIcon& icon, const QString& text, QObject* parent = 0);
virtual ~KisAction();
void setDefaultShortcut(const QKeySequence & shortcut);
QKeySequence defaultShortcut() const;
void setActivationFlags(ActivationFlags flags);
ActivationFlags activationFlags();
......
......@@ -76,6 +76,7 @@ void KisActionManager::addAction(const QString& name, KisAction* action)
d->viewManager->actionCollection()->addAction(name, action);
action->setObjectName(name);
action->setParent(d->viewManager->actionCollection());
d->viewManager->actionCollection()->setDefaultShortcut(action, action->defaultShortcut());
d->actions.append(action);
action->setActionManager(this);
}
......@@ -235,7 +236,7 @@ KisAction *KisActionManager::createStandardAction(KStandardAction::StandardActio
const QList<QKeySequence> defaultShortcuts = standardAction->property("defaultShortcuts").value<QList<QKeySequence> >();
const QKeySequence defaultShortcut = defaultShortcuts.isEmpty() ? QKeySequence() : defaultShortcuts.at(0);
action->setShortcut(standardAction->shortcut());
action->setDefaultShortcut(standardAction->shortcut());
#ifdef Q_OS_WIN
if (actionType == KStandardAction::SaveAs && defaultShortcuts.isEmpty()) {
action->setShortcut(QKeySequence("CTRL+SHIFT+S"));
......
......@@ -51,22 +51,22 @@ KisCanvasControlsManager::~KisCanvasControlsManager()
void KisCanvasControlsManager::setup(KisActionManager *actionManager)
{
KisAction *lighterColor = new KisAction(i18n("Make brush color lighter"));
lighterColor->setShortcut(Qt::Key_L);
lighterColor->setDefaultShortcut(Qt::Key_L);
actionManager->addAction("make_brush_color_lighter", lighterColor);
connect(lighterColor, SIGNAL(triggered()), SLOT(makeColorLighter()));
KisAction *darkerColor = new KisAction(i18n("Make brush color darker"));
darkerColor->setShortcut(Qt::Key_K);
darkerColor->setDefaultShortcut(Qt::Key_K);
actionManager->addAction("make_brush_color_darker", darkerColor);
connect(darkerColor, SIGNAL(triggered()), SLOT(makeColorDarker()));
KisAction *increaseOpacity = new KisAction(i18n("Increase opacity"));
increaseOpacity->setShortcut(Qt::Key_O);
increaseOpacity->setDefaultShortcut(Qt::Key_O);
actionManager->addAction("increase_opacity", increaseOpacity);
connect(increaseOpacity, SIGNAL(triggered()), SLOT(increaseOpacity()));
KisAction *decreaseOpacity = new KisAction(i18n("Decrease opacity"));
decreaseOpacity->setShortcut(Qt::Key_I);
decreaseOpacity->setDefaultShortcut(Qt::Key_I);
actionManager->addAction("decrease_opacity", decreaseOpacity);
connect(decreaseOpacity, SIGNAL(triggered()), SLOT(decreaseOpacity()));
}
......
......@@ -97,7 +97,7 @@ void KisFilterManager::setup(KActionCollection * ac, KisActionManager *actionMan
// Setup reapply action
d->reapplyAction = new KisAction(i18n("Apply Filter Again"), this);
d->reapplyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
d->reapplyAction->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_F));
d->actionManager->addAction("filter_apply_again", d->reapplyAction);
d->reapplyAction->setEnabled(false);
......@@ -134,7 +134,7 @@ void KisFilterManager::insertFilter(const QString & filterName)
}
KisAction *action = new KisAction(filter->menuEntry(), this);
action->setShortcut(filter->shortcut());
action->setDefaultShortcut(filter->shortcut());
action->setActivationFlags(KisAction::ACTIVE_DEVICE);
d->actionManager->addAction(QString("krita_filter_%1").arg(filterName), action);
......
......@@ -296,13 +296,13 @@ void KisLayerManager::setup(KisActionManager* actionManager)
m_imageFlatten = new KisAction(i18n("&Flatten image"), this);
m_imageFlatten->setActivationFlags(KisAction::ACTIVE_LAYER);
actionManager->addAction("flatten_image", m_imageFlatten);
m_imageFlatten->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E));
m_imageFlatten->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E));
connect(m_imageFlatten, SIGNAL(triggered()), this, SLOT(flattenImage()));
m_imageMergeLayer = new KisAction(i18n("&Merge with Layer Below"), this);
m_imageMergeLayer->setActivationFlags(KisAction::ACTIVE_LAYER);
actionManager->addAction("merge_layer", m_imageMergeLayer);
m_imageMergeLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
m_imageMergeLayer->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
connect(m_imageMergeLayer, SIGNAL(triggered()), this, SLOT(mergeLayer()));
m_flattenLayer = new KisAction(i18n("&Flatten Layer"), this);
......@@ -313,7 +313,7 @@ void KisLayerManager::setup(KisActionManager* actionManager)
KisAction * action = new KisAction(i18n("Rename current layer"), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
actionManager->addAction("RenameCurrentLayer", action);
action->setShortcut(QKeySequence(Qt::Key_F2));
action->setDefaultShortcut(QKeySequence(Qt::Key_F2));
connect(action, SIGNAL(triggered()), this, SLOT(layerProperties()));
m_rasterizeLayer = new KisAction(i18n("Rasterize Layer"), this);
......
......@@ -45,9 +45,10 @@ void KisMirrorManager::setup(KActionCollection * collection)
{
m_mirrorCanvas = new KToggleAction(i18n("Mirror View"), this);
m_mirrorCanvas->setChecked(false);
m_mirrorCanvas->setShortcut(QKeySequence(Qt::Key_M));
//m_mirrorCanvas->setShortcut(QKeySequence(Qt::Key_M));
collection->addAction("mirror_canvas", m_mirrorCanvas);
collection->setDefaultShortcut(m_mirrorCanvas, QKeySequence(Qt::Key_M));
updateAction();
}
......
......@@ -256,13 +256,13 @@ void KisNodeManager::setup(KActionCollection * actionCollection, KisActionManage
action = new KisAction(i18n("Activate next layer"), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
action->setShortcut(QKeySequence(Qt::Key_PageUp));
action->setDefaultShortcut(QKeySequence(Qt::Key_PageUp));
actionManager->addAction("activateNextLayer", action);
connect(action, SIGNAL(triggered()), this, SLOT(activateNextNode()));
action = new KisAction(i18n("Activate previous layer"), this);
action->setActivationFlags(KisAction::ACTIVE_LAYER);
action->setShortcut(QKeySequence(Qt::Key_PageDown));
action->setDefaultShortcut(QKeySequence(Qt::Key_PageDown));
actionManager->addAction("activatePreviousLayer", action);
connect(action, SIGNAL(triggered()), this, SLOT(activatePreviousNode()));
......@@ -273,7 +273,7 @@ void KisNodeManager::setup(KActionCollection * actionCollection, KisActionManage
action = new KisAction(KisIconUtils::loadIcon("edit-copy"), i18n("&Duplicate Layer or Mask"), this);
action->setActivationFlags(KisAction::ACTIVE_NODE);
action->setShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_J));
action->setDefaultShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_J));
actionManager->addAction("duplicatelayer", action);
connect(action, SIGNAL(triggered()), this, SLOT(duplicateActiveNode()));
......
......@@ -78,6 +78,7 @@
#include "widgets/kis_widget_chooser.h"
#include "tool/kis_tool.h"
#include "kis_signals_blocker.h"
#include "kis_action_manager.h"
typedef KoResourceServerSimpleConstruction<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServer;
typedef KoResourceServerAdapter<KisPaintOpPreset, SharedPointerStoragePolicy<KisPaintOpPresetSP> > KisPaintOpPresetResourceServerAdapter;
......@@ -138,7 +139,7 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
KisAction* eraseAction = new KisAction(i18n("Set eraser mode"), m_eraseModeButton);
eraseAction->setActivationFlags(KisAction::ACTIVE_DEVICE);
eraseAction->setIcon(KisIconUtils::loadIcon("draw-eraser"));
eraseAction->setShortcut(Qt::Key_E);
eraseAction->setDefaultShortcut(Qt::Key_E);
eraseAction->setCheckable(true);
m_eraseModeButton->setDefaultAction(eraseAction);
m_viewManager->actionCollection()->addAction("erase_action", eraseAction);
......@@ -246,8 +247,8 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
m_cmbCompositeOp = new KisCompositeOpComboBox();
m_cmbCompositeOp->setFixedHeight(iconsize);
foreach(QAction * a, m_cmbCompositeOp->blendmodeActions()) {
m_viewManager->actionCollection()->addAction(a->text(), a);
foreach(KisAction * a, m_cmbCompositeOp->blendmodeActions()) {
m_viewManager->actionManager()->addAction(a->text(), a);
}
m_workspaceWidget = new KisPopupButton(this);
......@@ -313,39 +314,40 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
action = new QWidgetAction(this);
action->setText(i18n("Next Favourite Preset"));
view->actionCollection()->addAction("next_favorite_preset", action);
action->setShortcut(QKeySequence(Qt::Key_Comma));
view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Comma));
connect(action, SIGNAL(triggered()), this, SLOT(slotNextFavoritePreset()));
action = new QWidgetAction(this);
action->setText(i18n("Previous Favourite Preset"));
view->actionCollection()->addAction("previous_favorite_preset", action);
action->setShortcut(QKeySequence(Qt::Key_Period));
view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Period));
connect(action, SIGNAL(triggered()), this, SLOT(slotPreviousFavoritePreset()));
action = new QWidgetAction(this);
action->setText(i18n("Switch to Previous Preset"));
view->actionCollection()->addAction("previous_preset", action);
action->setShortcut(QKeySequence(Qt::Key_Slash));
view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Slash));
connect(action, SIGNAL(triggered()), this, SLOT(slotSwitchToPreviousPreset()));
if (!cfg.toolOptionsInDocker()) {
action = new QWidgetAction(this);
action->setText(i18n("Show Tool Options"));
view->actionCollection()->addAction("show_tool_options", action);
action->setShortcut(Qt::Key_Backslash);
view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_Backslash));
connect(action, SIGNAL(triggered()), m_toolOptionsPopupButton, SLOT(showPopupWidget()));
}
action = new QWidgetAction(this);
action->setText(i18n("Show Brush Editor"));
view->actionCollection()->addAction("show_brush_editor", action);
action->setShortcut(Qt::Key_F5);
view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_F5));
connect(action, SIGNAL(triggered()), m_brushEditorPopupButton, SLOT(showPopupWidget()));
action = new QWidgetAction(this);
action->setText(i18n("Show Brush Presets"));
view->actionCollection()->addAction("show_brush_presets", action);
action->setShortcut(Qt::Key_F6);
view->actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::Key_F6));
connect(action, SIGNAL(triggered()), m_presetSelectorPopupButton, SLOT(showPopupWidget()));
QWidget* mirrorActions = new QWidget(this);
......
......@@ -137,7 +137,7 @@ void KisSelectionManager::setup(KisActionManager* actionManager)
m_pasteNew = new KisAction(i18n("Paste into &New Image"), this);
actionManager->addAction("paste_new", m_pasteNew);
m_pasteNew->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N));
m_pasteNew->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N));
connect(m_pasteNew, SIGNAL(triggered()), this, SLOT(pasteNew()));
m_pasteAt = new KisAction(i18n("Paste at cursor"), this);
......@@ -147,29 +147,29 @@ void KisSelectionManager::setup(KisActionManager* actionManager)
m_copyMerged = new KisAction(i18n("Copy merged"), this);
m_copyMerged->setActivationFlags(KisAction::PIXELS_SELECTED);
actionManager->addAction("copy_merged", m_copyMerged);
m_copyMerged->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
m_copyMerged->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
connect(m_copyMerged, SIGNAL(triggered()), this, SLOT(copyMerged()));
m_selectAll = new KisAction(KisIconUtils::loadIcon("select-all"), i18n("Select &All"), this);
actionManager->addAction("select_all", m_selectAll);
m_selectAll->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
m_selectAll->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
connect(m_selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
m_deselect = new KisAction(KisIconUtils::loadIcon("select-clear"), i18n("Deselect"), this);
m_deselect->setActivationFlags(KisAction::PIXELS_SELECTED | KisAction::SHAPES_SELECTED);
actionManager->addAction("deselect", m_deselect);
m_deselect->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
m_deselect->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
connect(m_deselect, SIGNAL(triggered()), this, SLOT(deselect()));
m_clear = new KisAction(KisIconUtils::loadIcon("select-clear"), i18n("Clear"), this);
m_clear->setActivationFlags(KisAction::ACTIVE_IMAGE);
actionManager->addAction("clear", m_clear);
m_clear->setShortcut(QKeySequence((Qt::Key_Delete)));
m_clear->setDefaultShortcut(QKeySequence((Qt::Key_Delete)));
connect(m_clear, SIGNAL(triggered()), SLOT(clear()));
m_reselect = new KisAction(i18n("&Reselect"), this);
actionManager->addAction("reselect", m_reselect);
m_reselect->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D));
m_reselect->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D));
connect(m_reselect, SIGNAL(triggered()), this, SLOT(reselect()));
m_invert = new KisAction(i18n("&Invert Selection"), this);
......@@ -179,35 +179,35 @@ void KisSelectionManager::setup(KisActionManager* actionManager)
m_invert->setToolTip("foo");
actionManager->addAction("invert", m_invert);
m_invert->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
m_invert->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
actionManager->registerOperation(new KisInvertSelectionOperaton);
m_copyToNewLayer = new KisAction(i18n("Copy Selection to New Layer"), this);
m_copyToNewLayer->setActivationFlags(KisAction::PIXELS_SELECTED);
actionManager->addAction("copy_selection_to_new_layer", m_copyToNewLayer);
m_copyToNewLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_J));
m_copyToNewLayer->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_J));
connect(m_copyToNewLayer, SIGNAL(triggered()), this, SLOT(copySelectionToNewLayer()));
m_cutToNewLayer = new KisAction(i18n("Cut Selection to New Layer"), this);
m_cutToNewLayer->setActivationFlags(KisAction::PIXELS_SELECTED);
m_cutToNewLayer->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
actionManager->addAction("cut_selection_to_new_layer", m_cutToNewLayer);
m_cutToNewLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_J));
m_cutToNewLayer->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_J));
connect(m_cutToNewLayer, SIGNAL(triggered()), this, SLOT(cutToNewLayer()));
m_fillForegroundColor = new KisAction(i18n("Fill with Foreground Color"), this);
m_fillForegroundColor->setActivationFlags(KisAction::ACTIVE_DEVICE);
m_fillForegroundColor->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
actionManager->addAction("fill_selection_foreground_color", m_fillForegroundColor);
m_fillForegroundColor->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Backspace));
m_fillForegroundColor->setDefaultShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Backspace));
connect(m_fillForegroundColor, SIGNAL(triggered()), this, SLOT(fillForegroundColor()));
m_fillBackgroundColor = new KisAction(i18n("Fill with Background Color"), this);
m_fillBackgroundColor->setActivationFlags(KisAction::ACTIVE_DEVICE);
m_fillBackgroundColor->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
actionManager->addAction("fill_selection_background_color", m_fillBackgroundColor);
m_fillBackgroundColor->setShortcut(QKeySequence(Qt::Key_Backspace));
m_fillBackgroundColor->setDefaultShortcut(QKeySequence(Qt::Key_Backspace));
connect(m_fillBackgroundColor, SIGNAL(triggered()), this, SLOT(fillBackgroundColor()));
m_fillPattern = new KisAction(i18n("Fill with Pattern"), this);
......@@ -220,14 +220,14 @@ void KisSelectionManager::setup(KisActionManager* actionManager)
m_fillForegroundColorOpacity->setActivationFlags(KisAction::ACTIVE_DEVICE);
m_fillForegroundColorOpacity->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
actionManager->addAction("fill_selection_foreground_color_opacity", m_fillForegroundColorOpacity);
m_fillForegroundColorOpacity->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Backspace));
m_fillForegroundColorOpacity->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Backspace));
connect(m_fillForegroundColorOpacity, SIGNAL(triggered()), this, SLOT(fillForegroundColorOpacity()));
m_fillBackgroundColorOpacity = new KisAction(i18n("Fill with Background Color (Opacity)"), this);
m_fillBackgroundColorOpacity->setActivationFlags(KisAction::ACTIVE_DEVICE);
m_fillBackgroundColorOpacity->setActivationConditions(KisAction::ACTIVE_NODE_EDITABLE);
actionManager->addAction("fill_selection_background_color_opacity", m_fillBackgroundColorOpacity);
m_fillBackgroundColorOpacity->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Backspace));
m_fillBackgroundColorOpacity->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_Backspace));
connect(m_fillBackgroundColorOpacity, SIGNAL(triggered()), this, SLOT(fillBackgroundColorOpacity()));
m_fillPatternOpacity = new KisAction(i18n("Fill with Pattern (Opacity)"), this);
......@@ -246,7 +246,7 @@ void KisSelectionManager::setup(KisActionManager* actionManager)
m_toggleDisplaySelection->setActivationFlags(KisAction::ACTIVE_NODE);
actionManager->addAction("toggle_display_selection", m_toggleDisplaySelection);
m_toggleDisplaySelection->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
m_toggleDisplaySelection->setDefaultShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
connect(m_toggleDisplaySelection, SIGNAL(triggered()), this, SLOT(toggleDisplaySelection()));
m_toggleDisplaySelection->setChecked(true);
......
This diff is collapsed.
......@@ -26,11 +26,10 @@
#include <kritaui_export.h>
#include "kis_categorized_list_view.h"
class QAction;
class KoID;
class KoColorSpace;
class KisSortedCompositeOpListModel;
class KisAction;
class KRITAUI_EXPORT KisCompositeOpListWidget: public KisCategorizedListView
{
......@@ -58,7 +57,7 @@ public:
void selectCompositeOp(const KoID &op);
KoID selectedCompositeOp() const;
QList<QAction *> blendmodeActions();
QList<KisAction *> blendmodeActions() const;
private Q_SLOTS:
void slotCategoryToggled(const QModelIndex& index, bool toggled);
......@@ -98,7 +97,7 @@ private:
KisSortedCompositeOpListModel *m_model;
KisCategorizedListView *m_view;
bool m_allowToHidePopup;
QList<QAction *> m_actions;
QList<KisAction *> m_actions;
};
#endif // KIS_COMPOSITEOP_WIDGETS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment