git-svn-id: svn://db.shs.com.ru/libs@468 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2018-12-12 11:01:32 +00:00
parent 6260046885
commit 765c314bbf
9 changed files with 83 additions and 80 deletions

View File

@@ -9,17 +9,13 @@ macro(sdk_install _DIR _TARGET _H_FILES _QM_FILES)
qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_LIB})
qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_BIN})
qt_install(TARGETS ${_TARGET} DESTINATION QtBin)
if(NOT "x${_QM_FILES}" STREQUAL "x")
qt_install(FILES ${_QM_FILES} DESTINATION QtLang)
endif()
qt_install(FILES ${_QM_FILES} DESTINATION QtLang)
else()
if (NOT "x${_H_FILES}" STREQUAL "x")
install(FILES ${_H_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${_DIR})
endif()
qt_install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
if(NOT "x${_QM_FILES}" STREQUAL "x")
qt_install(FILES ${_QM_FILES} DESTINATION QtLang)
endif()
qt_install(FILES ${_QM_FILES} DESTINATION QtLang)
endif()
#message(STATUS "Install ${_TARGET} to system \"${CMAKE_INSTALL_PREFIX}\"")
else()

View File

@@ -56,7 +56,7 @@ macro(qad_install _TARGET _H_FILES _QM_FILES)
qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_LIB})
qt_install(TARGETS ${_TARGET} DESTINATION ${MINGW_BIN})
qt_install(TARGETS ${_TARGET} DESTINATION QtBin)
qt_install(FILES ${_QM_FILES} DESTINATION QtLang)
qt_install(FILES "${_QM_FILES}" DESTINATION QtLang)
else()
if(NOT _H_FILES STREQUAL "")
install(FILES ${_H_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/qad)

View File

@@ -296,6 +296,7 @@ macro(qt_wrap)
qt4_wrap_ui(CUIS${_v} ${UI_LIST})
qt4_add_resources(CRES${_v} ${RES_LIST})
if (WAS_QM_ARG)
set(${QM${_v}_VAR} "")
qt4_add_translation(${QM${_v}_VAR} ${TS_LIST})
endif()
else()
@@ -304,6 +305,7 @@ macro(qt_wrap)
qt5_wrap_ui(CUIS${_v} ${UI_LIST})
qt5_add_resources(CRES${_v} ${RES_LIST})
if (WAS_QM_ARG)
set(${QM${_v}_VAR} "")
qt5_add_translation(${QM${_v}_VAR} ${TS_LIST})
endif()
else()
@@ -442,6 +444,7 @@ macro(qt_install)
set(_IS_FILES 0)
set(_IS_DEST 0)
set(_IS_LANG 0)
set(_INVALID 0)
foreach(_i ${ARGN})
if ("x${_i}" STREQUAL "xQtLang")
set(_IS_LANG 1)
@@ -460,7 +463,8 @@ macro(qt_install)
set(_IS_FILES 0)
if (_IS_LANG)
if (("x${${_i}_Qt${_v}}" STREQUAL "x") OR ("x${_i}" STREQUAL "xDESTINATION"))
return()
#return()
set(_INVALID 1)
else()
set(_INST_LIST ${_INST_LIST} ${${_i}_Qt${_v}})
endif()
@@ -503,10 +507,12 @@ macro(qt_install)
endif()
endif()
endforeach()
if (NOT ("x${_prev_inst}" STREQUAL "x${_INST_LIST}"))
#message("install: ${_INST_LIST}")
install(${_INST_LIST})
set(_prev_inst "${_INST_LIST}")
if (NOT _INVALID)
if (NOT ("x${_prev_inst}" STREQUAL "x${_INST_LIST}"))
#message("install: ${_INST_LIST}")
install(${_INST_LIST})
set(_prev_inst "${_INST_LIST}")
endif()
endif()
endif()
endforeach()

View File

@@ -0,0 +1,21 @@
#include "qad_touch_widgets.h"
#include "touchsliderplugin.h"
#include "touchbuttframeplugin.h"
#include "touchbuttonplugin.h"
QADTouchWidgets::QADTouchWidgets(QObject * parent): QObject(parent) {
m_widgets.append(new TouchSliderPlugin(this));
m_widgets.append(new TouchButtFramePlugin(this));
m_widgets.append(new TouchButtonPlugin(this));
}
QList<QDesignerCustomWidgetInterface*> QADTouchWidgets::customWidgets() const {
return m_widgets;
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(qad_touch_widgets_plugin, QADTouchWidgets)
#endif

View File

@@ -0,0 +1,23 @@
#ifndef QAD_TOUCH_WIDGETS_H
#define QAD_TOUCH_WIDGETS_H
#include <QtDesigner/QtDesigner>
#include <QtCore/qplugin.h>
class QADTouchWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "qad.touch_widgets")
#endif
public:
explicit QADTouchWidgets(QObject *parent = 0);
virtual QList<QDesignerCustomWidgetInterface * > customWidgets() const;
private:
QList<QDesignerCustomWidgetInterface * > m_widgets;
};
#endif // QAD_TOUCH_WIDGETS_H

View File

@@ -1,22 +0,0 @@
#include "touch_widgets.h"
#include "touchsliderplugin.h"
#include "touchbuttframeplugin.h"
#include "touchbuttonplugin.h"
TW::TW(QObject *parent)
: QObject(parent)
{
m_widgets.append(new TouchSliderPlugin(this));
m_widgets.append(new TouchButtFramePlugin(this));
m_widgets.append(new TouchButtonPlugin(this));
}
QList<QDesignerCustomWidgetInterface*> TW::customWidgets() const
{
return m_widgets;
}
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(twplugin, TW)
#endif

View File

@@ -1,23 +0,0 @@
#ifndef TW_H
#define TW_H
#include <QtDesigner/QtDesigner>
#include <QtCore/qplugin.h>
class TW : public QObject, public QDesignerCustomWidgetCollectionInterface
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "qad.touch_widgets")
#endif
public:
explicit TW(QObject *parent = 0);
virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;
private:
QList<QDesignerCustomWidgetInterface*> m_widgets;
};
#endif

View File

@@ -10,6 +10,30 @@
bool __QADTypesRegistrator__::_inited = false;
__QADTypesRegistrator__::__QADTypesRegistrator__() {
if (_inited) return;
_inited = true;
qRegisterMetaType<QAD::Enumerator>("QAD::Enumerator");
qRegisterMetaTypeStreamOperators<QAD::Enumerator>("QAD::Enumerator");
qRegisterMetaType<QAD::Enum>("QAD::Enum");
qRegisterMetaTypeStreamOperators<QAD::Enum>("QAD::Enum");
qRegisterMetaType<QAD::File>("QAD::File");
qRegisterMetaTypeStreamOperators<QAD::File>("QAD::File");
qRegisterMetaType<QAD::Dir>("QAD::Dir");
qRegisterMetaTypeStreamOperators<QAD::Dir>("QAD::Dir");
#if QT_VERSION >= 0x050200
QMetaType::registerConverter<QAD::Enum, int>(&QAD::Enum::selectedValue);
QMetaType::registerConverter<QAD::Enum, QString>(&QAD::Enum::selectedName);
QMetaType::registerConverter<QAD::File, QString>(&QAD::File::toString);
QMetaType::registerConverter<QAD::Dir, QString>(&QAD::Dir::toString);
#endif
}
__QADTypesRegistrator__ __registrator__;
int QAD::Enum::selectedValue() const {
foreach (const Enumerator & e, enum_list)

View File

@@ -77,32 +77,10 @@ inline QDebug operator <<(QDebug s, const QAD::Dir & v) {s.nospace() << v.dir; r
class __QADTypesRegistrator__ {
public:
__QADTypesRegistrator__() {
if (_inited) return;
_inited = true;
qRegisterMetaType<QAD::Enumerator>("QAD::Enumerator");
qRegisterMetaTypeStreamOperators<QAD::Enumerator>("QAD::Enumerator");
qRegisterMetaType<QAD::Enum>("QAD::Enum");
qRegisterMetaTypeStreamOperators<QAD::Enum>("QAD::Enum");
qRegisterMetaType<QAD::File>("QAD::File");
qRegisterMetaTypeStreamOperators<QAD::File>("QAD::File");
qRegisterMetaType<QAD::Dir>("QAD::Dir");
qRegisterMetaTypeStreamOperators<QAD::Dir>("QAD::Dir");
#if QT_VERSION >= 0x050200
QMetaType::registerConverter<QAD::Enum, int>(&QAD::Enum::selectedValue);
QMetaType::registerConverter<QAD::Enum, QString>(&QAD::Enum::selectedName);
QMetaType::registerConverter<QAD::File, QString>(&QAD::File::toString);
QMetaType::registerConverter<QAD::Dir, QString>(&QAD::Dir::toString);
#endif
}
__QADTypesRegistrator__();
static bool _inited;
};
static __QADTypesRegistrator__ __registrator__;
inline qreal quantize(qreal x, qreal q = 10.f) {return qRound(x / q) * q;}
inline QPointF quantize(QPointF x, qreal q = 10.f) {return QPointF(quantize(x.x(), q), quantize(x.y(), q));}