From 84cadc10f4a32a752426f106d75db9078f160c10 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 28 Sep 2013 11:06:56 +0200 Subject: [PATCH] added scene toolbar buttons (still not doing anything) --- apps/opencs/CMakeLists.txt | 2 +- apps/opencs/view/world/scenesubview.cpp | 5 +++++ apps/opencs/view/world/scenetool.cpp | 9 +++++++++ apps/opencs/view/world/scenetool.hpp | 19 +++++++++++++++++++ apps/opencs/view/world/scenetoolbar.cpp | 17 ++++++++++++++++- apps/opencs/view/world/scenetoolbar.hpp | 8 +++++++- 6 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 apps/opencs/view/world/scenetool.cpp create mode 100644 apps/opencs/view/world/scenetool.hpp diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index 2fbceac962..2bb31be9f4 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -59,7 +59,7 @@ opencs_hdrs_noqt (view/doc opencs_units (view/world table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator - cellcreator referenceablecreator referencecreator scenesubview scenetoolbar + cellcreator referenceablecreator referencecreator scenesubview scenetoolbar scenetool ) opencs_units_noqt (view/world diff --git a/apps/opencs/view/world/scenesubview.cpp b/apps/opencs/view/world/scenesubview.cpp index bb77fec2ee..3b15326abe 100644 --- a/apps/opencs/view/world/scenesubview.cpp +++ b/apps/opencs/view/world/scenesubview.cpp @@ -12,6 +12,7 @@ #include "tablebottombox.hpp" #include "creator.hpp" #include "scenetoolbar.hpp" +#include "scenetool.hpp" CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) : SubView (id) @@ -29,6 +30,10 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D layout2->setContentsMargins (QMargins (0, 0, 0, 0)); SceneToolbar *toolbar = new SceneToolbar (this); +toolbar->addTool (new SceneTool (this)); // test +toolbar->addTool (new SceneTool (this)); +toolbar->addTool (new SceneTool (this)); +toolbar->addTool (new SceneTool (this)); layout2->addWidget (toolbar, 0); /// \todo replace with rendering widget diff --git a/apps/opencs/view/world/scenetool.cpp b/apps/opencs/view/world/scenetool.cpp new file mode 100644 index 0000000000..12743c52c1 --- /dev/null +++ b/apps/opencs/view/world/scenetool.cpp @@ -0,0 +1,9 @@ + +#include "scenetool.hpp" + +CSVWorld::SceneTool::SceneTool (QWidget *parent) : QPushButton (parent) +{ + setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed)); + setFixedSize (48, 48); + +} \ No newline at end of file diff --git a/apps/opencs/view/world/scenetool.hpp b/apps/opencs/view/world/scenetool.hpp new file mode 100644 index 0000000000..ae440b579f --- /dev/null +++ b/apps/opencs/view/world/scenetool.hpp @@ -0,0 +1,19 @@ +#ifndef CSV_WORLD_SCENETOOL_H +#define CSV_WORLD_SCENETOOL_H + +#include + +namespace CSVWorld +{ + class SceneTool : public QPushButton + { + Q_OBJECT + + public: + + SceneTool (QWidget *parent = 0); + + }; +} + +#endif diff --git a/apps/opencs/view/world/scenetoolbar.cpp b/apps/opencs/view/world/scenetoolbar.cpp index 6ced03a9f7..7c716b5fce 100644 --- a/apps/opencs/view/world/scenetoolbar.cpp +++ b/apps/opencs/view/world/scenetoolbar.cpp @@ -1,8 +1,23 @@ #include "scenetoolbar.hpp" +#include + +#include "scenetool.hpp" + CSVWorld::SceneToolbar::SceneToolbar (QWidget *parent) : QWidget (parent) { - setFixedWidth (52); + setFixedWidth (48); + mLayout = new QVBoxLayout (this); + mLayout->setAlignment (Qt::AlignTop); + + mLayout->setContentsMargins (QMargins (0, 0, 0, 0)); + + setLayout (mLayout); } + +void CSVWorld::SceneToolbar::addTool (SceneTool *tool) +{ + mLayout->addWidget (tool, 0, Qt::AlignTop); +} \ No newline at end of file diff --git a/apps/opencs/view/world/scenetoolbar.hpp b/apps/opencs/view/world/scenetoolbar.hpp index 2fb288100a..00631c360c 100644 --- a/apps/opencs/view/world/scenetoolbar.hpp +++ b/apps/opencs/view/world/scenetoolbar.hpp @@ -3,17 +3,23 @@ #include +class QVBoxLayout; + namespace CSVWorld { + class SceneTool; + class SceneToolbar : public QWidget { Q_OBJECT + QVBoxLayout *mLayout; + public: SceneToolbar (QWidget *parent); - + void addTool (SceneTool *tool); }; }