new cmake build
git-svn-id: svn://db.shs.com.ru/libs@90 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
20
qad_utils/plugin/CMakeLists.txt
Normal file
20
qad_utils/plugin/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
project(qad_utils_plugin)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
find_package(Qt4 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} qad_widgets)
|
||||
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_utils)
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION ${QT_PLUGINS_DIR}/designer)
|
||||
14
qad_utils/plugin/qad_utils.cpp
Normal file
14
qad_utils/plugin/qad_utils.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "qpiconfigplugin.h"
|
||||
#include "qad_utils.h"
|
||||
|
||||
QADUtils::QADUtils(QObject * parent): QObject(parent)
|
||||
{
|
||||
m_widgets.append(new QPIConfigPlugin(this));
|
||||
}
|
||||
|
||||
|
||||
QList<QDesignerCustomWidgetInterface * > QADUtils::customWidgets() const {
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(qad_utils_plugin, QADUtils)
|
||||
21
qad_utils/plugin/qad_utils.h
Normal file
21
qad_utils/plugin/qad_utils.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef QAD_UTILS_H
|
||||
#define QAD_UTILS_H
|
||||
|
||||
#include <QtDesigner/QtDesigner>
|
||||
#include <QtCore/qplugin.h>
|
||||
|
||||
class QADUtils: public QObject, public QDesignerCustomWidgetCollectionInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
|
||||
|
||||
public:
|
||||
explicit QADUtils(QObject * parent = 0);
|
||||
virtual QList<QDesignerCustomWidgetInterface * > customWidgets() const;
|
||||
|
||||
private:
|
||||
QList<QDesignerCustomWidgetInterface * > m_widgets;
|
||||
|
||||
};
|
||||
|
||||
#endif // QAD_UTILS_H
|
||||
69
qad_utils/plugin/qpiconfigplugin.cpp
Normal file
69
qad_utils/plugin/qpiconfigplugin.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include "qpiconfigwidget.h"
|
||||
#include "qpiconfigplugin.h"
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
|
||||
QPIConfigPlugin::QPIConfigPlugin(QObject * parent): QObject(parent) {
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
void QPIConfigPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigPlugin::isInitialized() const {
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget * QPIConfigPlugin::createWidget(QWidget * parent) {
|
||||
return new QPIConfigWidget(parent, 0, false);
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::name() const {
|
||||
return QLatin1String("QPIConfigWidget");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::group() const {
|
||||
return QLatin1String("Editor Widgets");
|
||||
}
|
||||
|
||||
|
||||
QIcon QPIConfigPlugin::icon() const {
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::toolTip() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::whatsThis() const {
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
|
||||
bool QPIConfigPlugin::isContainer() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::domXml() const {
|
||||
return QLatin1String("<widget class=\"QPIConfigWidget\" name=\"piConfigWidget\">\n</widget>\n");
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfigPlugin::includeFile() const {
|
||||
return QLatin1String("qpiconfigwidget.h");
|
||||
}
|
||||
|
||||
31
qad_utils/plugin/qpiconfigplugin.h
Normal file
31
qad_utils/plugin/qpiconfigplugin.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef QPICONFIGPLUGIN_H
|
||||
#define QPICONFIGPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
class QPIConfigPlugin: public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QPIConfigPlugin(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 // QPICONFIGPLUGIN_H
|
||||
Reference in New Issue
Block a user