new cmake build
git-svn-id: svn://db.shs.com.ru/libs@90 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
21
qad_graphic/plugin/CMakeLists.txt
Normal file
21
qad_graphic/plugin/CMakeLists.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
project(qad_graphic_plugin)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
find_package(Qt4 REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES} "..")
|
||||
option(DEBUG "Build with -g3" 0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
|
||||
endif ()
|
||||
set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES} qad_widgets qad_utils)
|
||||
add_definitions(-DQT_PLUGIN)
|
||||
add_definitions(-DQT_NO_DEBUG)
|
||||
add_definitions(-DQT_SHARED)
|
||||
add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
|
||||
file(GLOB PMOCS "./*.h")
|
||||
file(GLOB PCPPS "./*.cpp")
|
||||
qt4_wrap_cpp(PCMOCS ${PMOCS} OPTIONS -nw)
|
||||
add_library(${PROJECT_NAME} SHARED ${PCMOCS} ${PCPPS} ${PMOCS})
|
||||
target_link_libraries(${PROJECT_NAME} ${LIBS} ${QT_QTDESIGNER_LIBRARY} qad_graphic)
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION ${QT_PLUGINS_DIR}/designer)
|
||||
69
qad_graphic/plugin/graphicplugin.cpp
Normal file
69
qad_graphic/plugin/graphicplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "graphic.h"
|
||||
#include "graphicplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
GraphicPlugin::GraphicPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void GraphicPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool GraphicPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * GraphicPlugin::createWidget(QWidget * parent) {
|
||||
return new Graphic(parent);
|
||||
}
|
||||
|
||||
|
||||
QString GraphicPlugin::name() const {
|
||||
return QLatin1String("Graphic");
|
||||
}
|
||||
|
||||
|
||||
QString GraphicPlugin::group() const {
|
||||
return QLatin1String("Display Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon GraphicPlugin::icon() const {
|
||||
return QIcon(":/icons/graphic.png");
|
||||
}
|
||||
|
||||
|
||||
QString GraphicPlugin::toolTip() const {
|
||||
return QLatin1String("");//QLatin1String("Widget for display any math graphics with grid and navigation");
|
||||
}
|
||||
|
||||
|
||||
QString GraphicPlugin::whatsThis() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
bool GraphicPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"Graphic\" name=\"graphic\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString GraphicPlugin::includeFile() const {
|
||||
return QLatin1String("graphic.h");
|
||||
}
|
||||
|
||||
31
qad_graphic/plugin/graphicplugin.h
Normal file
31
qad_graphic/plugin/graphicplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef GRAPHICPLUGIN_H
|
||||
#define GRAPHICPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class GraphicPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
GraphicPlugin(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
|
||||
14
qad_graphic/plugin/qad_graphic.cpp
Normal file
14
qad_graphic/plugin/qad_graphic.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "graphicplugin.h"
|
||||
#include "qad_graphic.h"
|
||||
|
||||
QADGraphic::QADGraphic(QObject * parent): QObject(parent)
|
||||
{
|
||||
m_widgets.append(new GraphicPlugin(this));
|
||||
}
|
||||
|
||||
|
||||
QList<QDesignerCustomWidgetInterface * > QADGraphic::customWidgets() const {
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(qad_graphic_plugin, QADGraphic)
|
||||
21
qad_graphic/plugin/qad_graphic.h
Normal file
21
qad_graphic/plugin/qad_graphic.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef QAD_GRAPHIC_H
|
||||
#define QAD_GRAPHIC_H
|
||||
|
||||
#include <QtDesigner/QtDesigner>
|
||||
#include <QtCore/qplugin.h>
|
||||
|
||||
class QADGraphic: public QObject, public QDesignerCustomWidgetCollectionInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
|
||||
|
||||
public:
|
||||
explicit QADGraphic(QObject * parent = 0);
|
||||
virtual QList<QDesignerCustomWidgetInterface * > customWidgets() const;
|
||||
|
||||
private:
|
||||
QList<QDesignerCustomWidgetInterface * > m_widgets;
|
||||
|
||||
};
|
||||
|
||||
#endif // QAD_GRAPHIC_H
|
||||
Reference in New Issue
Block a user