Commit 17da7ae3 authored by Alexander Semke's avatar Alexander Semke
Browse files

Improved the appearance and the structure of the context menu for some worksheet entries:

* better and more compact wording
* better and more consistent icons
* better ordering for the most relevant actions
* additional grouping of action
* don't show the "convert to" action for the type of the current entry
parent e4895cee
Pipeline #62992 canceled with stage
......@@ -2,7 +2,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
SPDX-FileCopyrightText: 2012 Martin Kuettler <martin.kuettler@gmail.com>
SPDX-FileCopyrightText: 2018-2019 Alexander Semke <alexander.semke@web.de>
SPDX-FileCopyrightText: 2016-2021 Alexander Semke <alexander.semke@web.de>
*/
#include "commandentry.h"
......@@ -334,16 +334,24 @@ void CommandEntry::populateMenu(QMenu* menu, QPointF pos)
menu->addAction(i18n("Hide Results"), this, &CommandEntry::collapseResults);
}
if (m_isExecutionEnabled)
menu->addAction(i18n("Exclude from Execution"), this, &CommandEntry::excludeFromExecution);
else
menu->addAction(i18n("Add to Execution"), this, &CommandEntry::addToExecution);
menu->addMenu(m_backgroundColorMenu);
menu->addMenu(m_textColorMenu);
menu->addMenu(m_fontMenu);
QAction* enabledAction = new QAction(QIcon::fromTheme(QLatin1String("checkmark")), i18n("Enabled"));
enabledAction->setCheckable(true);
enabledAction->setChecked(m_isExecutionEnabled);
menu->addSeparator();
menu->addAction(enabledAction);
connect(enabledAction, &QAction::triggered, this, &CommandEntry::toggleEnabled);
QMenu* appearanceMenu = new QMenu(i18n("Appearance"));
appearanceMenu->setIcon(QIcon::fromTheme(QLatin1String("configure")));
appearanceMenu->addMenu(m_backgroundColorMenu);
appearanceMenu->addMenu(m_textColorMenu);
appearanceMenu->addMenu(m_fontMenu);
menu->addMenu(appearanceMenu);
menu->addSeparator();
WorksheetEntry::populateMenu(menu, pos);
menu->addSeparator();
}
void CommandEntry::moveToNextItem(int pos, qreal x)
......@@ -1538,6 +1546,14 @@ qreal CommandEntry::promptItemWidth()
return m_promptItem->width();
}
void CommandEntry::toggleEnabled() {
auto* action = static_cast<QAction*>(QObject::sender());
if (action->isChecked())
addToExecution();
else
excludeFromExecution();
}
void CommandEntry::excludeFromExecution()
{
m_isExecutionEnabled = false;
......
......@@ -2,7 +2,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
SPDX-FileCopyrightText: 2012 Martin Kuettler <martin.kuettler@gmail.com>
SPDX-FileCopyrightText: 2018 Alexander Semke <alexander.semke@web.de>
SPDX-FileCopyrightText: 2018-2021 Alexander Semke <alexander.semke@web.de>
*/
#ifndef COMMANDENTRY_H
......@@ -33,14 +33,14 @@ class CommandEntry : public WorksheetEntry
static const QString MidPrompt;
static const QString HidePrompt;
explicit CommandEntry(Worksheet* worksheet);
explicit CommandEntry(Worksheet*);
~CommandEntry() override;
enum {Type = UserType + 2};
int type() const override;
QString command();
void setExpression(Cantor::Expression* expr);
void setExpression(Cantor::Expression*);
Cantor::Expression* expression();
QString currentLine();
......@@ -49,11 +49,11 @@ class CommandEntry : public WorksheetEntry
bool isExcludedFromExecution();
bool isResultCollapsed();
void setContent(const QString& content) override;
void setContent(const QDomElement& content, const KZip& file) override;
void setContentFromJupyter(const QJsonObject& cell) override;
void setContent(const QString&) override;
void setContent(const QDomElement&, const KZip&) override;
void setContentFromJupyter(const QJsonObject&) override;
QDomElement toXml(QDomDocument& doc, KZip* archive) override;
QDomElement toXml(QDomDocument&, KZip*) override;
QJsonValue toJupyterJson() override;
QString toPlain(const QString& commandSep, const QString& commentStartingSeq, const QString& commentEndingSeq) override;
......@@ -94,8 +94,8 @@ class CommandEntry : public WorksheetEntry
void handleBacktabPress();
void updateEntry() override;
void updatePrompt(const QString& postfix = CommandEntry::Prompt);
void expressionChangedStatus(Cantor::Expression::Status status);
void showAdditionalInformationPrompt(const QString& question);
void expressionChangedStatus(Cantor::Expression::Status);
void showAdditionalInformationPrompt(const QString&);
void showCompletions();
void applySelectedCompletion();
void completedLineChanged();
......@@ -107,7 +107,7 @@ class CommandEntry : public WorksheetEntry
void moveToNextItem(int pos, qreal x);
void moveToPreviousItem(int pos, qreal x);
void populateMenu(QMenu* menu, QPointF pos) override;
void populateMenu(QMenu*, QPointF) override;
protected:
bool wantToEvaluate() override;
......@@ -117,41 +117,12 @@ class CommandEntry : public WorksheetEntry
bool informationItemHasFocus();
bool focusWithinThisItem();
QPoint getPopupPosition();
QPoint toGlobalPosition(QPointF localPos);
QPoint toGlobalPosition(QPointF);
void initMenus();
void handleExistedCompletionBox();
void makeCompletion(const QString& line, int position);
private:
enum CompletionMode {
PreliminaryCompletion,
FinalCompletion
};
private Q_SLOTS:
void invalidate();
void resultDeleted();
void clearResultItems();
void removeResultItem(int index);
void replaceResultItem(int index);
void updateCompletions();
void completeCommandTo(const QString& completion, CommandEntry::CompletionMode mode = PreliminaryCompletion);
void changeResultCollapsingAction();
void backgroundColorChanged(QAction*);
void textColorChanged(QAction*);
void fontBoldTriggered();
void fontItalicTriggered();
void fontIncreaseTriggered();
void fontDecreaseTriggered();
void fontSelectTriggered();
void resetFontTriggered();
void animatePromptItem();
void setMidPrompt();
void setHidePrompt();
private:
enum CompletionMode {PreliminaryCompletion, FinalCompletion};
static const double VerticalSpacing;
WorksheetTextItem* m_promptItem;
......@@ -183,6 +154,30 @@ class CommandEntry : public WorksheetEntry
bool m_isExecutionEnabled;
QColor m_activeExecutionTextColor;
QColor m_activeExecutionBackgroundColor;
private Q_SLOTS:
void invalidate();
void resultDeleted();
void clearResultItems();
void removeResultItem(int index);
void replaceResultItem(int index);
void updateCompletions();
void completeCommandTo(const QString& completion, CommandEntry::CompletionMode mode = PreliminaryCompletion);
void changeResultCollapsingAction();
void toggleEnabled();
void backgroundColorChanged(QAction*);
void textColorChanged(QAction*);
void fontBoldTriggered();
void fontItalicTriggered();
void fontIncreaseTriggered();
void fontDecreaseTriggered();
void fontSelectTriggered();
void resetFontTriggered();
void animatePromptItem();
void setMidPrompt();
void setHidePrompt();
};
#endif // COMMANDENTRY_H
/*
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2018 Yifei Wu <kqwyfg@gmail.com>
SPDX-FileCopyrightText: 2019-2021 Alexander Semke <alexander.semke@web.de>
*/
#include "markdownentry.h"
......@@ -49,17 +50,34 @@ rendered(false)
void MarkdownEntry::populateMenu(QMenu* menu, QPointF pos)
{
QAction* firstAction;
if (!rendered)
menu->addAction(QIcon::fromTheme(QLatin1String("viewimage")), i18n("Insert Image"), this, &MarkdownEntry::insertImage);
{
WorksheetEntry::populateMenu(menu, pos);
firstAction = menu->actions().at(1); //insert the first action for Markdown after the "Evaluate" action
QAction* action = new QAction(QIcon::fromTheme(QLatin1String("viewimage")), i18n("Insert Image"));
connect(action, &QAction::triggered, this, &MarkdownEntry::insertImage);
menu->insertAction(firstAction, action);
}
else
{
menu->addAction(QIcon::fromTheme(QLatin1String("edit-entry")), i18n("Enter Edit Mode"), this, &MarkdownEntry::enterEditMode);
menu->addSeparator();
WorksheetEntry::populateMenu(menu, pos);
firstAction = menu->actions().at(0);
QAction* action = new QAction(QIcon::fromTheme(QLatin1String("edit-entry")), i18n("Enter Edit Mode"));
connect(action, &QAction::triggered, this, &MarkdownEntry::enterEditMode);
menu->insertAction(firstAction, action);
menu->insertSeparator(firstAction);
}
if (attachedImages.size() != 0)
menu->addAction(i18n("Clear Attachments"), this, &MarkdownEntry::clearAttachments);
WorksheetEntry::populateMenu(menu, pos);
{
QAction* action = new QAction(QIcon::fromTheme(QLatin1String("edit-clear")), i18n("Clear Attachments"));
connect(action, &QAction::triggered, this, &MarkdownEntry::clearAttachments);
menu->insertAction(firstAction, action);
}
}
bool MarkdownEntry::isEmpty()
......
......@@ -2,6 +2,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
SPDX-FileCopyrightText: 2012 Martin Kuettler <martin.kuettler@gmail.com>
SPDX-FileCopyrightText: 2018-2021 Alexander Semke <alexander.semke@web.de>
*/
#include "worksheet.h"
......@@ -1845,90 +1846,109 @@ void Worksheet::populateMenu(QMenu *menu, QPointF pos)
m_lastFocusedTextItem = item;
}
if (!isRunning())
menu->addAction(QIcon::fromTheme(QLatin1String("system-run")), i18n("Evaluate Worksheet"),
this, SLOT(evaluate()), 0);
else
menu->addAction(QIcon::fromTheme(QLatin1String("process-stop")), i18n("Interrupt"), this,
SLOT(interrupt()), 0);
menu->addSeparator();
if (entry) {
QMenu* convertTo = new QMenu(menu);
QMenu* insert = new QMenu(menu);
QMenu* insertBefore = new QMenu(menu);
//"Convert To" menu
QMenu* convertTo = new QMenu(i18n("Convert To"));
convertTo->setIcon(QIcon::fromTheme(QLatin1String("gtk-convert")));
menu->addMenu(convertTo);
if (entry->type() != CommandEntry::Type)
convertTo->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command"), entry, &WorksheetEntry::convertToCommandEntry);
if (entry->type() != TextEntry::Type)
convertTo->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text"), entry, &WorksheetEntry::convertToTextEntry);
convertTo->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command Entry"), entry, &WorksheetEntry::convertToCommandEntry);
convertTo->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text Entry"), entry, &WorksheetEntry::convertToTextEntry);
#ifdef Discount_FOUND
convertTo->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown Entry"), entry, &WorksheetEntry::convertToMarkdownEntry);
if (entry->type() != MarkdownEntry::Type)
convertTo->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown"), entry, &WorksheetEntry::convertToMarkdownEntry);
#endif
#ifdef WITH_EPS
convertTo->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX Entry"), entry, &WorksheetEntry::convertToLatexEntry);
if (entry->type() != LatexEntry::Type)
convertTo->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX"), entry, &WorksheetEntry::convertToLatexEntry);
#endif
convertTo->addAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Image"), entry, &WorksheetEntry::convertToImageEntry);
convertTo->addAction(QIcon::fromTheme(QLatin1String("go-next-view-page")), i18n("Page Break"), entry, &WorksheetEntry::converToPageBreakEntry);
convertTo->addAction(QIcon(), i18n("Horizontal Line"), entry, &WorksheetEntry::convertToHorizontalRuleEntry);
convertTo->addAction(QIcon(), i18n("Hierarchy Entry"), entry, &WorksheetEntry::convertToHierarchyEntry);
if (entry->type() != ImageEntry::Type)
convertTo->addAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Image"), entry, &WorksheetEntry::convertToImageEntry);
if (entry->type() != PageBreakEntry::Type)
convertTo->addAction(QIcon::fromTheme(QLatin1String("insert-page-break")), i18n("Page Break"), entry, &WorksheetEntry::converToPageBreakEntry);
if (entry->type() != HorizontalRuleEntry::Type)
convertTo->addAction(QIcon(), i18n("Horizontal Line"), entry, &WorksheetEntry::convertToHorizontalRuleEntry);
insert->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command Entry"), entry, SLOT(insertCommandEntry()));
insert->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text Entry"), entry, SLOT(insertTextEntry()));
if (entry->type() != HierarchyEntry::Type)
convertTo->addAction(QIcon(), i18n("Hierarchy Entry"), entry, &WorksheetEntry::convertToHierarchyEntry);
//"Insert After" menu
QMenu* insert = new QMenu(i18n("Insert After"), menu);
insert->setIcon(QIcon::fromTheme(QLatin1String("edit-table-insert-row-below")));
menu->addSeparator();
menu->addMenu(insert);
insert->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command"), entry, SLOT(insertCommandEntry()));
insert->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text"), entry, SLOT(insertTextEntry()));
#ifdef Discount_FOUND
insert->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown Entry"), entry, SLOT(insertMarkdownEntry()));
insert->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown"), entry, SLOT(insertMarkdownEntry()));
#endif
#ifdef WITH_EPS
insert->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX Entry"), entry, SLOT(insertLatexEntry()));
insert->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX"), entry, SLOT(insertLatexEntry()));
#endif
insert->addAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Image"), entry, SLOT(insertImageEntry()));
insert->addAction(QIcon::fromTheme(QLatin1String("go-next-view-page")), i18n("Page Break"), entry, SLOT(insertPageBreakEntry()));
insert->addAction(QIcon::fromTheme(QLatin1String("insert-page-break")), i18n("Page Break"), entry, SLOT(insertPageBreakEntry()));
insert->addAction(QIcon(), i18n("Horizontal Line"), entry, SLOT(insertHorizontalRuleEntry()));
insert->addAction(QIcon(), i18n("Hierarchy Entry"), entry, SLOT(insertHierarchyEntry()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command Entry"), entry, SLOT(insertCommandEntryBefore()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text Entry"), entry, SLOT(insertTextEntryBefore()));
//"Insert Before" menu
QMenu* insertBefore = new QMenu(i18n("Insert Before"), menu);
insertBefore->setIcon(QIcon::fromTheme(QLatin1String("edit-table-insert-row-above")));
menu->addMenu(insertBefore);
insertBefore->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command"), entry, SLOT(insertCommandEntryBefore()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text"), entry, SLOT(insertTextEntryBefore()));
#ifdef Discount_FOUND
insertBefore->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown Entry"), entry, SLOT(insertMarkdownEntryBefore()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown"), entry, SLOT(insertMarkdownEntryBefore()));
#endif
#ifdef WITH_EPS
insertBefore->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX Entry"), entry, SLOT(insertLatexEntryBefore()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX"), entry, SLOT(insertLatexEntryBefore()));
#endif
insertBefore->addAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Image"), entry, SLOT(insertImageEntryBefore()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("go-next-view-page")), i18n("Page Break"), entry, SLOT(insertPageBreakEntryBefore()));
insertBefore->addAction(QIcon::fromTheme(QLatin1String("insert-page-break")), i18n("Page Break"), entry, SLOT(insertPageBreakEntryBefore()));
insertBefore->addAction(QIcon(), i18n("Horizontal Line"), entry, SLOT(insertHorizontalRuleEntryBefore()));
insertBefore->addAction(QIcon(), i18n("Hierarchy Entry"), entry, SLOT(insertHierarchyEntryBefore()));
convertTo->setTitle(i18n("Convert Entry To"));
convertTo->setIcon(QIcon::fromTheme(QLatin1String("gtk-convert")));
insert->setTitle(i18n("Insert Entry After"));
insert->setIcon(QIcon::fromTheme(QLatin1String("edit-table-insert-row-below")));
insertBefore->setTitle(i18n("Insert Entry Before"));
insertBefore->setIcon(QIcon::fromTheme(QLatin1String("edit-table-insert-row-above")));
menu->addMenu(convertTo);
menu->addMenu(insert);
menu->addMenu(insertBefore);
} else {
menu->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Insert Command Entry"), this, SLOT(appendCommandEntry()));
menu->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Insert Text Entry"), this, SLOT(appendTextEntry()));
QMenu* insertMenu = new QMenu(i18n("Insert"));
insertMenu->setIcon(QIcon::fromTheme(QLatin1String("insert-table-row")));
insertMenu->addAction(QIcon::fromTheme(QLatin1String("run-build")), i18n("Command"), this, SLOT(appendCommandEntry()));
insertMenu->addAction(QIcon::fromTheme(QLatin1String("draw-text")), i18n("Text"), this, SLOT(appendTextEntry()));
#ifdef Discount_FOUND
menu->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Insert Markdown Entry"), this, SLOT(appendMarkdownEntry()));
insertMenu->addAction(QIcon::fromTheme(QLatin1String("text-x-markdown")), i18n("Markdown"), this, SLOT(appendMarkdownEntry()));
#endif
#ifdef WITH_EPS
menu->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("Insert LaTeX Entry"), this, SLOT(appendLatexEntry()));
insertMenu->addAction(QIcon::fromTheme(QLatin1String("text-x-tex")), i18n("LaTeX"), this, SLOT(appendLatexEntry()));
#endif
menu->addAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Insert Image"), this, SLOT(appendImageEntry()));
menu->addAction(QIcon::fromTheme(QLatin1String("go-next-view-page")), i18n("Insert Page Break"), this, SLOT(appendPageBreakEntry()));
menu->addAction(QIcon(), i18n("Insert Horizontal Line"), this, &Worksheet::appendHorizontalRuleEntry);
menu->addAction(QIcon(), i18n("Insert Hierarchy Entry"), this, &Worksheet::appendHierarchyEntry);
insertMenu->addAction(QIcon::fromTheme(QLatin1String("image-x-generic")), i18n("Image"), this, SLOT(appendImageEntry()));
insertMenu->addAction(QIcon::fromTheme(QLatin1String("insert-page-break")), i18n("Page Break"), this, SLOT(appendPageBreakEntry()));
insertMenu->addAction(QIcon(), i18n("Horizontal Line"), this, &Worksheet::appendHorizontalRuleEntry);
insertMenu->addAction(QIcon(), i18n("Hierarchy Entry"), this, &Worksheet::appendHierarchyEntry);
menu->addMenu(insertMenu);
}
menu->addSeparator();
if (!isRunning())
menu->addAction(QIcon::fromTheme(QLatin1String("system-run")), i18n("Evaluate Worksheet"),
this, SLOT(evaluate()));
else
menu->addAction(QIcon::fromTheme(QLatin1String("process-stop")), i18n("Interrupt"), this,
SLOT(interrupt()));
}
else
{
menu->clear();
menu->addAction(QIcon::fromTheme(QLatin1String("go-up")), i18n("Move Entries Up"), this, SLOT(selectionMoveUp()), 0);
menu->addAction(QIcon::fromTheme(QLatin1String("go-down")), i18n("Move Entries Down"), this, SLOT(selectionMoveDown()), 0);
menu->addAction(QIcon::fromTheme(QLatin1String("media-playback-start")), i18n("Evaluate Entries"), this, SLOT(selectionEvaluate()), 0);
menu->addAction(QIcon::fromTheme(QLatin1String("edit-delete")), i18n("Remove Entries"), this, SLOT(selectionRemove()), 0);
menu->addAction(QIcon::fromTheme(QLatin1String("go-up")), i18n("Move Entries Up"), this, SLOT(selectionMoveUp()));
menu->addAction(QIcon::fromTheme(QLatin1String("go-down")), i18n("Move Entries Down"), this, SLOT(selectionMoveDown()));
menu->addAction(QIcon::fromTheme(QLatin1String("media-playback-start")), i18n("Evaluate Entries"), this, SLOT(selectionEvaluate()));
menu->addAction(QIcon::fromTheme(QLatin1String("edit-delete")), i18n("Remove Entries"), this, SLOT(selectionRemove()));
bool isAnyCommandEntryInSelection = false;
for (WorksheetEntry* entry : m_selectedEntries)
......
/*
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2012 Martin Kuettler <martin.kuettler@gmail.com>
SPDX-FileCopyrightText: 2016-2021 Alexander Semke <alexander.semke@web.de>
*/
#include "worksheetentry.h"
......@@ -407,13 +408,32 @@ void WorksheetEntry::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void WorksheetEntry::populateMenu(QMenu* menu, QPointF pos)
{
menu->addAction(QIcon::fromTheme(QLatin1String("go-up")), i18n("Move Up"), this, SLOT(moveToPrevious()), 0);
menu->addAction(QIcon::fromTheme(QLatin1String("go-down")), i18n("Move Down"), this, SLOT(moveToNext()), 0);
auto* firstAction = menu->actions().first();
QAction* action;
if (!worksheet()->isRunning() && wantToEvaluate())
menu->addAction(QIcon::fromTheme(QLatin1String("media-playback-start")), i18n("Evaluate Entry"), this, SLOT(evaluate()), 0);
{
action = new QAction(QIcon::fromTheme(QLatin1String("media-playback-start")), i18n("Evaluate"));
connect(action, SIGNAL(triggered()), this, SLOT(evaluate()));
menu->insertAction(firstAction, action);
menu->insertSeparator(firstAction);
}
action = new QAction(QIcon::fromTheme(QLatin1String("go-up")), i18n("Move Up"));
// connect(action, &QAction::triggered, this, &WorksheetEntry::moveToPrevious); //TODO: doesn't work
connect(action, SIGNAL(triggered()), this, SLOT(moveToPrevious()));
menu->insertAction(firstAction, action);
action = new QAction(QIcon::fromTheme(QLatin1String("go-down")), i18n("Move Down"));
// connect(action, &QAction::triggered, this, &WorksheetEntry::moveToNext); //TODO: doesn't work
connect(action, SIGNAL(triggered()), this, SLOT(moveToNext()));
menu->insertAction(firstAction, action);
menu->insertSeparator(firstAction);
action = new QAction(QIcon::fromTheme(QLatin1String("edit-delete")), i18n("Remove"));
connect(action, &QAction::triggered, this, &WorksheetEntry::startRemoving);
menu->insertAction(firstAction, action);
menu->insertSeparator(firstAction);
menu->addAction(QIcon::fromTheme(QLatin1String("edit-delete")), i18n("Remove Entry"), this, SLOT(startRemoving()), 0);
menu->addSeparator();
worksheet()->populateMenu(menu, mapToScene(pos));
}
......
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