mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:53:50 +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_Script
|
||||||
<<CSMWorld::UniversalId::Type_Region;
|
<<CSMWorld::UniversalId::Type_Region;
|
||||||
|
|
||||||
mContextMenu = createStandardContextMenu();
|
mCommentAction = new QAction (tr ("Comment Selection"), this);
|
||||||
|
connect(mCommentAction, SIGNAL (triggered()), this, SLOT (commentSelection()));
|
||||||
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);
|
CSMPrefs::Shortcut *commentShortcut = new CSMPrefs::Shortcut("script-editor-comment", this);
|
||||||
commentShortcut->associateAction(comment);
|
commentShortcut->associateAction(mCommentAction);
|
||||||
mContextMenu->addAction(comment);
|
|
||||||
|
|
||||||
QAction* uncomment = new QAction (tr ("Uncomment Selection"), this);
|
mUncommentAction = new QAction (tr ("Uncomment Selection"), this);
|
||||||
connect(uncomment, SIGNAL (triggered()), this, SLOT (uncommentSelection()));
|
connect(mUncommentAction, SIGNAL (triggered()), this, SLOT (uncommentSelection()));
|
||||||
CSMPrefs::Shortcut *uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this);
|
CSMPrefs::Shortcut *uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this);
|
||||||
uncommentShortcut->associateAction(uncomment);
|
uncommentShortcut->associateAction(mUncommentAction);
|
||||||
mContextMenu->addAction(uncomment);
|
|
||||||
|
|
||||||
mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document());
|
mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document());
|
||||||
|
|
||||||
|
@ -361,7 +357,12 @@ void CSVWorld::ScriptEdit::resizeEvent(QResizeEvent *e)
|
||||||
|
|
||||||
void CSVWorld::ScriptEdit::contextMenuEvent(QContextMenuEvent *event)
|
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)
|
void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
#include "../../model/world/universalid.hpp"
|
#include "../../model/world/universalid.hpp"
|
||||||
|
|
||||||
|
@ -54,7 +55,8 @@ namespace CSVWorld
|
||||||
QFont mDefaultFont;
|
QFont mDefaultFont;
|
||||||
QFont mMonoFont;
|
QFont mMonoFont;
|
||||||
int mTabCharCount;
|
int mTabCharCount;
|
||||||
QMenu *mContextMenu;
|
QAction *mCommentAction;
|
||||||
|
QAction *mUncommentAction;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue