git-svn-id: svn://db.shs.com.ru/libs@553 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -50,6 +50,11 @@ foreach(_v ${_QT_VERSIONS_})
|
|||||||
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
|
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
|
||||||
endforeach()
|
endforeach()
|
||||||
list(APPEND QT_MULTILIB_LIST qglview)
|
list(APPEND QT_MULTILIB_LIST qglview)
|
||||||
|
if (NOT DEFINED ANDROID_PLATFORM)
|
||||||
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin")
|
||||||
|
add_subdirectory(plugin)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
qt_sources(test_SRC DIR "qglview_test")
|
qt_sources(test_SRC DIR "qglview_test")
|
||||||
qt_wrap(${test_SRC} CPPS test_CPP)
|
qt_wrap(${test_SRC} CPPS test_CPP)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ GLWidget::GLWidget(QWidget *parent) : QWidget(parent)
|
|||||||
lay->setContentsMargins(0, 0, 0, 0);
|
lay->setContentsMargins(0, 0, 0, 0);
|
||||||
lay->setSpacing(0);
|
lay->setSpacing(0);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
setWindowIcon(QIcon("://icons/qglview.png"));
|
||||||
connect(view_, &QGLView::doubleClick, this, &GLWidget::viewDoubleClicked);
|
connect(view_, &QGLView::doubleClick, this, &GLWidget::viewDoubleClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
qglview/plugin/CMakeLists.txt
Normal file
12
qglview/plugin/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
project(qglview_plugin)
|
||||||
|
include_directories("..")
|
||||||
|
add_definitions(-DQT_PLUGIN)
|
||||||
|
add_definitions(-DQT_NO_DEBUG)
|
||||||
|
add_definitions(-DQT_SHARED)
|
||||||
|
add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
|
||||||
|
find_qt(${QtVersions} Core Designer Gui Widgets OpenGL)
|
||||||
|
qt_sources(SRC)
|
||||||
|
qt_wrap(${SRC} CPPS out_CPP QMS out_QM)
|
||||||
|
qt_add_library(${PROJECT_NAME} SHARED out_CPP)
|
||||||
|
qt_target_link_libraries(${PROJECT_NAME} qglview)
|
||||||
|
qt_install(TARGETS ${PROJECT_NAME} DESTINATION QtPlugins/designer)
|
||||||
14
qglview/plugin/qglview_designerplugin.cpp
Normal file
14
qglview/plugin/qglview_designerplugin.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include "qglview_designerplugin.h"
|
||||||
|
#include "qglviewplugin.h"
|
||||||
|
|
||||||
|
|
||||||
|
QGLViewDesignerPlugin::QGLViewDesignerPlugin(QObject * parent): QObject(parent)
|
||||||
|
{
|
||||||
|
m_widgets.append(new QGLViewPlugin(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QDesignerCustomWidgetInterface * > QGLViewDesignerPlugin::customWidgets() const {
|
||||||
|
return m_widgets;
|
||||||
|
}
|
||||||
|
|
||||||
22
qglview/plugin/qglview_designerplugin.h
Normal file
22
qglview/plugin/qglview_designerplugin.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef QGLVIEW_DESIGNERPLUGIN_H
|
||||||
|
#define QGLVIEW_DESIGNERPLUGIN_H
|
||||||
|
|
||||||
|
#include <QtDesigner/QtDesigner>
|
||||||
|
#include <QtCore/qplugin.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<QDesignerCustomWidgetInterface * > m_widgets;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QGLVIEW_DESIGNERPLUGIN_H
|
||||||
69
qglview/plugin/qglviewplugin.cpp
Normal file
69
qglview/plugin/qglviewplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#include "glwidget.h"
|
||||||
|
#include "qglviewplugin.h"
|
||||||
|
#include <QtCore/QtPlugin>
|
||||||
|
|
||||||
|
|
||||||
|
QGLViewPlugin::QGLViewPlugin(QObject * parent): QObject(parent) {
|
||||||
|
m_initialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QGLViewPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||||
|
if (m_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Add extension registrations, etc. here
|
||||||
|
|
||||||
|
m_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool QGLViewPlugin::isInitialized() const {
|
||||||
|
return m_initialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QWidget * QGLViewPlugin::createWidget(QWidget * parent) {
|
||||||
|
return new GLWidget(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString QGLViewPlugin::name() const {
|
||||||
|
return QLatin1String("QGLView");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString QGLViewPlugin::group() const {
|
||||||
|
return QLatin1String("Display Widgets");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QIcon QGLViewPlugin::icon() const {
|
||||||
|
return QIcon("://icons/qglview.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString QGLViewPlugin::toolTip() const {
|
||||||
|
return QLatin1String("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString QGLViewPlugin::whatsThis() const {
|
||||||
|
return QLatin1String("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool QGLViewPlugin::isContainer() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString QGLViewPlugin::domXml() const {
|
||||||
|
return QLatin1String("<widget class=\"GLWidget\" name=\"glview\">\n</widget>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString QGLViewPlugin::includeFile() const {
|
||||||
|
return QLatin1String("glwidget.h");
|
||||||
|
}
|
||||||
|
|
||||||
33
qglview/plugin/qglviewplugin.h
Normal file
33
qglview/plugin/qglviewplugin.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef QGLVIEWPLUGIN_H
|
||||||
|
#define QGLVIEWPLUGIN_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||||
|
|
||||||
|
|
||||||
|
class QGLViewPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit QGLViewPlugin(QObject * parent = 0);
|
||||||
|
|
||||||
|
bool isContainer() const;
|
||||||
|
bool isInitialized() const;
|
||||||
|
QIcon icon() const;
|
||||||
|
QString domXml() const;
|
||||||
|
QString group() const;
|
||||||
|
QString includeFile() const;
|
||||||
|
QString name() const;
|
||||||
|
QString toolTip() const;
|
||||||
|
QString whatsThis() const;
|
||||||
|
QWidget * createWidget(QWidget * parent);
|
||||||
|
void initialize(QDesignerFormEditorInterface * core);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_initialized;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //QGLVIEWPLUGIN_H
|
||||||
@@ -30,6 +30,7 @@ QGLView::QGLView(): OpenGLWindow(), fbo_selection(3) {
|
|||||||
// setFocusPolicy(Qt::WheelFocus);
|
// setFocusPolicy(Qt::WheelFocus);
|
||||||
// setScene(new QGraphicsScene());
|
// setScene(new QGraphicsScene());
|
||||||
// setInteractive(true);
|
// setInteractive(true);
|
||||||
|
setIcon(QIcon("://icons/qglview.png"));
|
||||||
timer = 0;
|
timer = 0;
|
||||||
need_init_ = is_first_draw = true;
|
need_init_ = is_first_draw = true;
|
||||||
objects_.is_root = true;
|
objects_.is_root = true;
|
||||||
|
|||||||
@@ -25,5 +25,6 @@
|
|||||||
<file>icons/node.png</file>
|
<file>icons/node.png</file>
|
||||||
<file>icons/edit-copy.png</file>
|
<file>icons/edit-copy.png</file>
|
||||||
<file>icons/edit-paste.png</file>
|
<file>icons/edit-paste.png</file>
|
||||||
|
<file>icons/qglview.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
Reference in New Issue
Block a user