mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
Fix existing context menu in script editor
This commit is contained in:
parent
3d1e640388
commit
6063d8e31b
2 changed files with 17 additions and 14 deletions
|
@ -88,19 +88,15 @@ CSVWorld::ScriptEdit::ScriptEdit(
|
|||
<<CSMWorld::UniversalId::Type_Script
|
||||
<<CSMWorld::UniversalId::Type_Region;
|
||||
|
||||
mContextMenu = createStandardContextMenu();
|
||||
mCommentAction = new QAction (tr ("Comment Selection"), this);
|
||||
connect(mCommentAction, SIGNAL (triggered()), this, SLOT (commentSelection()));
|
||||
CSMPrefs::Shortcut *commentShortcut = new CSMPrefs::Shortcut("script-editor-comment", this);
|
||||
commentShortcut->associateAction(mCommentAction);
|
||||
|
||||
QAction* comment = new QAction (tr ("Comment Selection"), this);
|
||||
connect(comment, SIGNAL (triggered()), this, SLOT (commentSelection()));
|
||||
CSMPrefs::Shortcut* commentShortcut = new CSMPrefs::Shortcut("script-editor-comment", this);
|
||||
commentShortcut->associateAction(comment);
|
||||
mContextMenu->addAction(comment);
|
||||
|
||||
QAction* uncomment = new QAction (tr ("Uncomment Selection"), this);
|
||||
connect(uncomment, SIGNAL (triggered()), this, SLOT (uncommentSelection()));
|
||||
CSMPrefs::Shortcut* uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this);
|
||||
uncommentShortcut->associateAction(uncomment);
|
||||
mContextMenu->addAction(uncomment);
|
||||
mUncommentAction = new QAction (tr ("Uncomment Selection"), this);
|
||||
connect(mUncommentAction, SIGNAL (triggered()), this, SLOT (uncommentSelection()));
|
||||
CSMPrefs::Shortcut *uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this);
|
||||
uncommentShortcut->associateAction(mUncommentAction);
|
||||
|
||||
mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document());
|
||||
|
||||
|
@ -361,7 +357,12 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e)
|
|||
|
||||
void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
mContextMenu->exec(event->globalPos());
|
||||
QMenu *menu = createStandardContextMenu();
|
||||
menu->addAction(mCommentAction);
|
||||
menu->addAction(mUncommentAction);
|
||||
|
||||
menu->exec(event->globalPos());
|
||||
delete menu;
|
||||
}
|
||||
|
||||
void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <QVector>
|
||||
#include <QTimer>
|
||||
#include <QFont>
|
||||
#include <QAction>
|
||||
|
||||
#include "../../model/world/universalid.hpp"
|
||||
|
||||
|
@ -54,7 +55,8 @@ namespace CSVWorld
|
|||
QFont mDefaultFont;
|
||||
QFont mMonoFont;
|
||||
int mTabCharCount;
|
||||
QMenu *mContextMenu;
|
||||
QAction *mCommentAction;
|
||||
QAction *mUncommentAction;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in a new issue