mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-21 08:28:44 +00:00
Moved the Expression Editor to it's right place.
This commit is contained in:
parent
7b5bed2442
commit
12be42506f
8 changed files with 73 additions and 21 deletions
|
@ -140,6 +140,13 @@ void ExpressionEditor::contextMenuEvent( QContextMenuEvent *e )
|
|||
menu.exec( e->globalPos() );
|
||||
}
|
||||
|
||||
void ExpressionEditor::closeEvent( QCloseEvent *e )
|
||||
{
|
||||
QMainWindow::closeEvent( e );
|
||||
|
||||
Q_EMIT closing();
|
||||
}
|
||||
|
||||
void ExpressionEditor::onDeleteSelection()
|
||||
{
|
||||
QList< QGraphicsItem* > l = m_scene->selectedItems();
|
||||
|
@ -324,7 +331,7 @@ void ExpressionEditor::onSave()
|
|||
m_result = m_pvt->m_root->build();
|
||||
}
|
||||
|
||||
hide();
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,8 +37,12 @@ public:
|
|||
void load();
|
||||
QString result() const{ return m_result; }
|
||||
|
||||
Q_SIGNALS:
|
||||
void closing();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent( QContextMenuEvent *e );
|
||||
void closeEvent( QCloseEvent *e );
|
||||
|
||||
private Q_SLOTS:
|
||||
void onDeleteSelection();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
<ui version="4.0">
|
||||
<class>ExpressionEditor</class>
|
||||
<widget class="QMainWindow" name="ExpressionEditor">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
|
|
@ -46,8 +46,6 @@
|
|||
#include "add_widget_widget.h"
|
||||
#include "texture_chooser.h"
|
||||
|
||||
#include "expression_editor.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
QString _lastDir;
|
||||
|
@ -74,8 +72,6 @@ namespace GUIEditor
|
|||
widgetInfoTree = new CWidgetInfoTree;
|
||||
|
||||
tc = new TextureChooser();
|
||||
ee = new ExpressionEditor();
|
||||
ee->load();
|
||||
|
||||
createMenus();
|
||||
readSettings();
|
||||
|
@ -124,8 +120,6 @@ namespace GUIEditor
|
|||
|
||||
delete tc;
|
||||
tc = NULL;
|
||||
delete ee;
|
||||
ee = NULL;
|
||||
|
||||
delete messageProcessor;
|
||||
messageProcessor = NULL;
|
||||
|
@ -371,11 +365,6 @@ namespace GUIEditor
|
|||
tc->exec();
|
||||
}
|
||||
|
||||
void GUIEditorWindow::onEEClicked()
|
||||
{
|
||||
ee->show();
|
||||
}
|
||||
|
||||
void GUIEditorWindow::createMenus()
|
||||
{
|
||||
Core::MenuManager *mm = Core::ICore::instance()->menuManager();
|
||||
|
@ -426,10 +415,6 @@ namespace GUIEditor
|
|||
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onTCClicked() ) );
|
||||
m->addAction( a );
|
||||
|
||||
a = new QAction( "Expression Editor", this );
|
||||
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onEEClicked() ) );
|
||||
m->addAction( a );
|
||||
|
||||
menu = m;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ class QtTreePropertyBrowser;
|
|||
class QMenu;
|
||||
|
||||
class TextureChooser;
|
||||
class ExpressionEditor;
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
|
@ -69,8 +68,6 @@ private Q_SLOTS:
|
|||
void onAddWidgetClicked();
|
||||
void onTreeChanged();
|
||||
void onTCClicked();
|
||||
void onEEClicked();
|
||||
|
||||
|
||||
protected:
|
||||
void hideEvent( QHideEvent *evnt );
|
||||
|
@ -105,7 +102,6 @@ private:
|
|||
QMenu *menu;
|
||||
|
||||
TextureChooser *tc;
|
||||
ExpressionEditor *ee;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -18,20 +18,49 @@
|
|||
#include "link_editor.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
#include "expression_editor.h"
|
||||
#include <QMenu>
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
class LinkEditorPvt
|
||||
{
|
||||
public:
|
||||
|
||||
LinkEditorPvt()
|
||||
{
|
||||
ee = new ExpressionEditor();
|
||||
ee->load();
|
||||
}
|
||||
|
||||
~LinkEditorPvt()
|
||||
{
|
||||
delete ee;
|
||||
ee = NULL;
|
||||
}
|
||||
|
||||
ExpressionEditor *ee;
|
||||
};
|
||||
|
||||
|
||||
LinkEditor::LinkEditor( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setup();
|
||||
|
||||
m_pvt = new LinkEditorPvt();
|
||||
|
||||
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKButtonClicked() ) );
|
||||
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
|
||||
connect( expressionEdit, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( onTextEditContextMenu( const QPoint& ) ) );
|
||||
connect( m_pvt->ee, SIGNAL( closing() ), this, SLOT( onEEClosing() ) );
|
||||
}
|
||||
|
||||
LinkEditor::~LinkEditor()
|
||||
{
|
||||
delete m_pvt;
|
||||
m_pvt = NULL;
|
||||
}
|
||||
|
||||
void LinkEditor::setup()
|
||||
|
@ -89,4 +118,23 @@ namespace GUIEditor
|
|||
|
||||
hide();
|
||||
}
|
||||
|
||||
void LinkEditor::onTextEditContextMenu( const QPoint &pos )
|
||||
{
|
||||
QMenu *menu = expressionEdit->createStandardContextMenu();
|
||||
QAction *a = menu->addAction( "Expression Editor" );
|
||||
connect( a, SIGNAL( triggered() ), this, SLOT( onEE() ) );
|
||||
|
||||
menu->exec( mapToGlobal( pos ) );
|
||||
}
|
||||
|
||||
void LinkEditor::onEE()
|
||||
{
|
||||
m_pvt->ee->show();
|
||||
}
|
||||
|
||||
void LinkEditor::onEEClosing()
|
||||
{
|
||||
expressionEdit->setPlainText( m_pvt->ee->result() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace GUIEditor
|
||||
{
|
||||
class LinkEditorPvt;
|
||||
|
||||
class LinkEditor : public QWidget, public Ui::LinkEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -35,12 +37,16 @@ namespace GUIEditor
|
|||
|
||||
Q_SIGNALS:
|
||||
void okClicked();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onOKButtonClicked();
|
||||
void onTextEditContextMenu( const QPoint &pos );
|
||||
void onEE();
|
||||
void onEEClosing();
|
||||
|
||||
private:
|
||||
uint32 currentLinkId;
|
||||
LinkEditorPvt *m_pvt;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="expressionEdit">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string/>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue