code format
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
#include "qglview_designerplugin.h"
|
||||
|
||||
#include "qglviewplugin.h"
|
||||
|
||||
|
||||
QGLViewDesignerPlugin::QGLViewDesignerPlugin(QObject * parent): QObject(parent)
|
||||
{
|
||||
QGLViewDesignerPlugin::QGLViewDesignerPlugin(QObject * parent): QObject(parent) {
|
||||
m_widgets.append(new QGLViewPlugin(this));
|
||||
}
|
||||
|
||||
|
||||
QList<QDesignerCustomWidgetInterface * > QGLViewDesignerPlugin::customWidgets() const {
|
||||
QList<QDesignerCustomWidgetInterface *> QGLViewDesignerPlugin::customWidgets() const {
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
#ifndef QGLVIEW_DESIGNERPLUGIN_H
|
||||
#define QGLVIEW_DESIGNERPLUGIN_H
|
||||
|
||||
#include <QtDesigner/QtDesigner>
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtDesigner/QtDesigner>
|
||||
|
||||
|
||||
class QGLViewDesignerPlugin: public QObject, public QDesignerCustomWidgetCollectionInterface
|
||||
{
|
||||
class QGLViewDesignerPlugin
|
||||
: public QObject
|
||||
, public QDesignerCustomWidgetCollectionInterface {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "qad.qglview")
|
||||
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
|
||||
|
||||
public:
|
||||
QGLViewDesignerPlugin(QObject * parent = 0);
|
||||
virtual QList<QDesignerCustomWidgetInterface * > customWidgets() const;
|
||||
virtual QList<QDesignerCustomWidgetInterface *> customWidgets() const;
|
||||
|
||||
private:
|
||||
QList<QDesignerCustomWidgetInterface * > m_widgets;
|
||||
|
||||
QList<QDesignerCustomWidgetInterface *> m_widgets;
|
||||
};
|
||||
|
||||
#endif // QGLVIEW_DESIGNERPLUGIN_H
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "../glwidget.h"
|
||||
#include "qglviewplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
#include "../glwidget.h"
|
||||
#include "glprimitives.h"
|
||||
#include "qglview.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QGLViewPlugin::QGLViewPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
@@ -11,8 +13,7 @@ QGLViewPlugin::QGLViewPlugin(QObject * parent): QObject(parent) {
|
||||
|
||||
|
||||
void QGLViewPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
if (m_initialized) return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
@@ -30,21 +31,24 @@ QWidget * QGLViewPlugin::createWidget(QWidget * parent) {
|
||||
if (m_initialized) {
|
||||
auto axis = new GLObjectBase();
|
||||
GLObjectBase * obj;
|
||||
float al = 1.;
|
||||
obj = new GLPrimitiveLine(QVector3D(0, 0, -al), QVector3D(0, 0, al));
|
||||
obj->material().color_diffuse = Qt::darkBlue; obj->setAcceptLight(false);
|
||||
float al = 1.;
|
||||
obj = new GLPrimitiveLine(QVector3D(0, 0, -al), QVector3D(0, 0, al));
|
||||
obj->material().color_diffuse = Qt::darkBlue;
|
||||
obj->setAcceptLight(false);
|
||||
obj->setSelectable(false);
|
||||
axis->addChild(obj);
|
||||
obj = new GLPrimitiveLine(QVector3D(-al, 0, 0), QVector3D(al, 0, 0));
|
||||
obj->material().color_diffuse = Qt::darkRed; obj->setAcceptLight(false);
|
||||
obj = new GLPrimitiveLine(QVector3D(-al, 0, 0), QVector3D(al, 0, 0));
|
||||
obj->material().color_diffuse = Qt::darkRed;
|
||||
obj->setAcceptLight(false);
|
||||
obj->setSelectable(false);
|
||||
axis->addChild(obj);
|
||||
obj = new GLPrimitiveLine(QVector3D(0, -al, 0), QVector3D(0, al, 0));
|
||||
obj->material().color_diffuse = Qt::darkGreen; obj->setAcceptLight(false);
|
||||
obj = new GLPrimitiveLine(QVector3D(0, -al, 0), QVector3D(0, al, 0));
|
||||
obj->material().color_diffuse = Qt::darkGreen;
|
||||
obj->setAcceptLight(false);
|
||||
obj->setSelectable(false);
|
||||
axis->addChild(obj);
|
||||
w->view()->addObject(axis);
|
||||
auto cam_light = new Light();
|
||||
auto cam_light = new Light();
|
||||
cam_light->intensity = 0.5;
|
||||
cam_light->setName("Camera_Light");
|
||||
w->view()->camera()->addChild(cam_light);
|
||||
@@ -92,4 +96,3 @@ QString QGLViewPlugin::domXml() const {
|
||||
QString QGLViewPlugin::includeFile() const {
|
||||
return QLatin1String("glwidget.h");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||
|
||||
|
||||
class QGLViewPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
class QGLViewPlugin
|
||||
: public QObject
|
||||
, public QDesignerCustomWidgetInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
@@ -27,7 +28,6 @@ public:
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
|
||||
};
|
||||
|
||||
#endif //QGLVIEWPLUGIN_H
|
||||
#endif // QGLVIEWPLUGIN_H
|
||||
|
||||
Reference in New Issue
Block a user