ADDED: #1471 Qt property browser, for browsing and editing the selected widget's properties ( this is an empty shell as well for now )

This commit is contained in:
dfighter1985 2012-07-07 05:01:32 +02:00
parent aa352b2f30
commit c641c67c8e
5 changed files with 128 additions and 1 deletions

View file

@ -18,6 +18,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR
action_editor.h action_editor.h
link_editor.h link_editor.h
proc_editor.h proc_editor.h
property_browser_ctrl.h
) )
SET(OVQT_PLUGIN_GUI_EDITOR_UIS SET(OVQT_PLUGIN_GUI_EDITOR_UIS
@ -49,7 +50,7 @@ ADD_LIBRARY(ovqt_plugin_gui_editor MODULE ${SRC}
${OVQT_PLUGIN_GUI_EDITOR_RC_SRCS} ${OVQT_PLUGIN_GUI_EDITOR_RC_SRCS}
) )
TARGET_LINK_LIBRARIES(ovqt_plugin_gui_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) TARGET_LINK_LIBRARIES(ovqt_plugin_gui_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} qt_property_browser)
NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor") NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_gui_editor) NL_ADD_RUNTIME_FLAGS(ovqt_plugin_gui_editor)

View file

@ -27,6 +27,7 @@
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#include <QDockWidget> #include <QDockWidget>
#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser"
#include "widget_properties.h" #include "widget_properties.h"
#include "widget_properties_parser.h" #include "widget_properties_parser.h"
@ -61,6 +62,15 @@ namespace GUIEditor
WidgetHierarchy *ha = new WidgetHierarchy; WidgetHierarchy *ha = new WidgetHierarchy;
dock->setWidget( ha ); dock->setWidget( ha );
addDockWidget( Qt::LeftDockWidgetArea, dock ); addDockWidget( Qt::LeftDockWidgetArea, dock );
dock = new QDockWidget( "Widget Properties", this );
dock->setAllowedAreas( Qt::RightDockWidgetArea );
QtTreePropertyBrowser *tb = new QtTreePropertyBrowser;
browserCtrl.setBrowser( tb );
browserCtrl.setup();
dock->setWidget( tb );
addDockWidget( Qt::RightDockWidgetArea, dock );
} }
GUIEditorWindow::~GUIEditorWindow() GUIEditorWindow::~GUIEditorWindow()

View file

@ -22,6 +22,7 @@
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QFile> #include <QFile>
#include "widget_info.h" #include "widget_info.h"
#include "property_browser_ctrl.h"
namespace GUIEditor namespace GUIEditor
{ {
@ -66,6 +67,8 @@ private:
CWidgetProperties *widgetProps; CWidgetProperties *widgetProps;
LinkEditor *linkEditor; LinkEditor *linkEditor;
ProcEditor *procEditor; ProcEditor *procEditor;
CPropBrowserCtrl browserCtrl;
}; };
} }

View file

@ -0,0 +1,65 @@
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "property_browser_ctrl.h"
#include "../../3rdparty/qtpropertybrowser/QtVariantPropertyManager"
#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser"
namespace GUIEditor
{
CPropBrowserCtrl::CPropBrowserCtrl()
{
browser = NULL;
propertyMgr = new QtVariantPropertyManager;
}
CPropBrowserCtrl::~CPropBrowserCtrl()
{
delete propertyMgr;
propertyMgr = NULL;
browser = NULL;
}
void CPropBrowserCtrl::setBrowser( QtTreePropertyBrowser *b )
{
browser = b;
}
void CPropBrowserCtrl::setup()
{
if( browser == NULL )
return;
QtVariantProperty *p;
p = propertyMgr->addProperty( QVariant::String, "Id" );
p->setValue( "ExampleId" );
browser->addProperty( p );
p = propertyMgr->addProperty( QVariant::Bool, "Active" );
p->setValue( true );
browser->addProperty( p );
p = propertyMgr->addProperty( QVariant::String, "on_enter" );
p->setValue( "on_enter_handler" );
browser->addProperty( p );
p = propertyMgr->addProperty( QVariant::String, "on_enter_params" );
p->setValue( "someparams" );
browser->addProperty( p );
}
}

View file

@ -0,0 +1,48 @@
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PROP_BROWSER_CTRL
#define PROP_BROWSER_CTRL
#include <QObject>
class QtTreePropertyBrowser;
class QtVariantPropertyManager;
namespace GUIEditor
{
/// This class controls the Widget property browser widget.
/// It receives signals from the widget that draws/manages the Nel GUI widgets, and handles them.
class CPropBrowserCtrl : public QObject
{
Q_OBJECT
public:
CPropBrowserCtrl();
~CPropBrowserCtrl();
void setBrowser( QtTreePropertyBrowser *b );
void setup();
private:
QtTreePropertyBrowser *browser;
QtVariantPropertyManager *propertyMgr;
};
}
#endif