-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* This file is part of PlasmaShop. | ||
* | ||
* PlasmaShop is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PlasmaShop 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PlasmaShop. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "QSceneNode_Preview.h" | ||
|
||
#include <PRP/plSceneNode.h> | ||
#include <PRP/Object/plSceneObject.h> | ||
#include <QToolBar> | ||
#include <QGridLayout> | ||
|
||
QSceneNode_Preview::QSceneNode_Preview(plCreatable* pCre, QWidget* parent) | ||
: QCreatable(pCre, kPreviewSceneNode, parent) | ||
{ | ||
plSceneNode* obj = plSceneNode::Convert(fCreatable); | ||
fRender = new QPlasmaRender(this); | ||
bool centered = false; | ||
for (const auto& soKey : obj->getSceneObjects()) { | ||
if (soKey->getType() == kSceneObject) { | ||
fRender->addObject(soKey); | ||
if (!centered) { | ||
fRender->center(soKey, false); | ||
centered = true; | ||
} | ||
} | ||
} | ||
fRender->build(QPlasmaRender::kNavModel, QPlasmaRender::kDrawTextured); | ||
QSizePolicy renderPolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); | ||
fRender->setSizePolicy(renderPolicy); | ||
|
||
QToolBar* viewToolbar = new QToolBar(tr("View"), this); | ||
viewToolbar->setFloatable(false); | ||
QActionGroup* viewActions = fRender->createViewActions(); | ||
viewToolbar->addActions(viewActions->actions()); | ||
|
||
QGridLayout* layout = new QGridLayout(this); | ||
layout->setContentsMargins(0, 0, 0, 0); | ||
layout->setVerticalSpacing(0); | ||
layout->addWidget(viewToolbar, 0, 0); | ||
layout->addWidget(fRender, 1, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* This file is part of PlasmaShop. | ||
* | ||
* PlasmaShop is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* PlasmaShop 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 General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with PlasmaShop. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _QSCENENODE_PREVIEW_H | ||
#define _QSCENENODE_PREVIEW_H | ||
|
||
#include "PRP/QCreatable.h" | ||
#include "QPlasmaRender.h" | ||
|
||
class QSceneNode_Preview : public QCreatable | ||
{ | ||
Q_OBJECT | ||
|
||
protected: | ||
QPlasmaRender* fRender; | ||
|
||
public: | ||
QSceneNode_Preview(plCreatable* pCre, QWidget* parent = NULL); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters