diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt index e9350bbf2..4d2aebd0b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt @@ -18,6 +18,7 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR action_editor.h link_editor.h proc_editor.h + property_browser_ctrl.h ) SET(OVQT_PLUGIN_GUI_EDITOR_UIS @@ -49,7 +50,7 @@ ADD_LIBRARY(ovqt_plugin_gui_editor MODULE ${SRC} ${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_ADD_RUNTIME_FLAGS(ovqt_plugin_gui_editor) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp index 672df715a..094d780be 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp @@ -27,6 +27,7 @@ #include #include #include +#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser" #include "widget_properties.h" #include "widget_properties_parser.h" @@ -61,6 +62,15 @@ namespace GUIEditor WidgetHierarchy *ha = new WidgetHierarchy; dock->setWidget( ha ); 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() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h index 0418a12e5..25f454fb4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h @@ -22,6 +22,7 @@ #include #include #include "widget_info.h" +#include "property_browser_ctrl.h" namespace GUIEditor { @@ -66,6 +67,8 @@ private: CWidgetProperties *widgetProps; LinkEditor *linkEditor; ProcEditor *procEditor; + + CPropBrowserCtrl browserCtrl; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp new file mode 100644 index 000000000..3a8dafd99 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp @@ -0,0 +1,65 @@ +// Object Viewer Qt GUI Editor plugin +// 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 . + + +#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 ); + } +} \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.h new file mode 100644 index 000000000..f8549205a --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.h @@ -0,0 +1,48 @@ +// Object Viewer Qt GUI Editor plugin +// 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 . + + +#ifndef PROP_BROWSER_CTRL +#define PROP_BROWSER_CTRL + +#include + +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