git-svn-id: svn://db.shs.com.ru/libs@586 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
1
test/qad/touch_widgets/plugin/CMakeLists.txt
Normal file
1
test/qad/touch_widgets/plugin/CMakeLists.txt
Normal file
@@ -0,0 +1 @@
|
||||
qad_plugin(touch_widgets "Gui;Widgets" "")
|
||||
21
test/qad/touch_widgets/plugin/qad_touch_widgets.cpp
Normal file
21
test/qad/touch_widgets/plugin/qad_touch_widgets.cpp
Normal 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
|
||||
23
test/qad/touch_widgets/plugin/qad_touch_widgets.h
Normal file
23
test/qad/touch_widgets/plugin/qad_touch_widgets.h
Normal 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
|
||||
90
test/qad/touch_widgets/plugin/touchbuttframeplugin.cpp
Normal file
90
test/qad/touch_widgets/plugin/touchbuttframeplugin.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "touchbuttframe.h"
|
||||
#include "touchbuttframeplugin.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
|
||||
|
||||
TouchButtFramePlugin::TouchButtFramePlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
void TouchButtFramePlugin::initialize(QDesignerFormEditorInterface * /*core*/ )
|
||||
{
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
//core->propertyEditor()->property();
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
bool TouchButtFramePlugin::isInitialized() const
|
||||
{
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
QWidget *TouchButtFramePlugin::createWidget(QWidget *parent)
|
||||
{
|
||||
TouchButtFrame * tbw = new TouchButtFrame(parent);
|
||||
QStringList l;
|
||||
l.append("First");
|
||||
l.append("Second");
|
||||
tbw->setButtons(l);
|
||||
return tbw;
|
||||
}
|
||||
|
||||
QString TouchButtFramePlugin::name() const
|
||||
{
|
||||
return QLatin1String("TouchButtFrame");
|
||||
}
|
||||
|
||||
QString TouchButtFramePlugin::group() const
|
||||
{
|
||||
return QLatin1String("Touch Widgets");
|
||||
}
|
||||
|
||||
QIcon TouchButtFramePlugin::icon() const
|
||||
{
|
||||
return QIcon(":/icons/touchbuttframe.png");
|
||||
}
|
||||
|
||||
QString TouchButtFramePlugin::toolTip() const
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
QString TouchButtFramePlugin::whatsThis() const
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
bool TouchButtFramePlugin::isContainer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString TouchButtFramePlugin::domXml() const
|
||||
{
|
||||
return QLatin1String("<ui language=\"c++\">\n"
|
||||
" <widget class=\"TouchButtFrame\" name=\"touchButtFrame\">\n"
|
||||
" <property name=\"geometry\">\n"
|
||||
" <rect>\n"
|
||||
" <x>0</x>\n"
|
||||
" <y>0</y>\n"
|
||||
" <width>100</width>\n"
|
||||
" <height>100</height>\n"
|
||||
" </rect>\n"
|
||||
" </property>\n"
|
||||
" </widget>\n"
|
||||
"</ui>\n");
|
||||
}
|
||||
|
||||
QString TouchButtFramePlugin::includeFile() const
|
||||
{
|
||||
return QLatin1String("touchbuttframe.h");
|
||||
}
|
||||
|
||||
35
test/qad/touch_widgets/plugin/touchbuttframeplugin.h
Normal file
35
test/qad/touch_widgets/plugin/touchbuttframeplugin.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef TOUCHBUTTFRAMEPLUGIN_H
|
||||
#define TOUCHBUTTFRAMEPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#if QT_VERSION >= 0x050000
|
||||
# include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||
#else
|
||||
# include <QDesignerCustomWidgetInterface>
|
||||
#endif
|
||||
|
||||
class TouchButtFramePlugin : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
TouchButtFramePlugin(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
|
||||
74
test/qad/touch_widgets/plugin/touchbuttonplugin.cpp
Normal file
74
test/qad/touch_widgets/plugin/touchbuttonplugin.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
#include "touchbutton.h"
|
||||
#include "touchbuttonplugin.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
|
||||
|
||||
TouchButtonPlugin::TouchButtonPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
void TouchButtonPlugin::initialize(QDesignerFormEditorInterface * /* core */)
|
||||
{
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
bool TouchButtonPlugin::isInitialized() const
|
||||
{
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
QWidget *TouchButtonPlugin::createWidget(QWidget *parent)
|
||||
{
|
||||
return new TouchButton(parent);
|
||||
}
|
||||
|
||||
QString TouchButtonPlugin::name() const
|
||||
{
|
||||
return QLatin1String("TouchButton");
|
||||
}
|
||||
|
||||
QString TouchButtonPlugin::group() const
|
||||
{
|
||||
return QLatin1String("Touch Widgets");
|
||||
}
|
||||
|
||||
QIcon TouchButtonPlugin::icon() const
|
||||
{
|
||||
return QIcon(":/icons/touchbutton.png");
|
||||
}
|
||||
|
||||
QString TouchButtonPlugin::toolTip() const
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
QString TouchButtonPlugin::whatsThis() const
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
bool TouchButtonPlugin::isContainer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString TouchButtonPlugin::domXml() const
|
||||
{
|
||||
return QLatin1String("<widget class=\"TouchButton\" name=\"touchButton\">\n</widget>\n");
|
||||
}
|
||||
|
||||
QString TouchButtonPlugin::includeFile() const
|
||||
{
|
||||
return QLatin1String("touchbutton.h");
|
||||
}
|
||||
|
||||
35
test/qad/touch_widgets/plugin/touchbuttonplugin.h
Normal file
35
test/qad/touch_widgets/plugin/touchbuttonplugin.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef TOUCHBUTTONPLUGIN_H
|
||||
#define TOUCHBUTTONPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#if QT_VERSION >= 0x050000
|
||||
# include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||
#else
|
||||
# include <QDesignerCustomWidgetInterface>
|
||||
#endif
|
||||
|
||||
class TouchButtonPlugin : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
TouchButtonPlugin(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 // TOUCHBUTTONPLUGIN_H
|
||||
81
test/qad/touch_widgets/plugin/touchsliderplugin.cpp
Normal file
81
test/qad/touch_widgets/plugin/touchsliderplugin.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
#include "touchslider.h"
|
||||
#include "touchsliderplugin.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
|
||||
|
||||
TouchSliderPlugin::TouchSliderPlugin(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_initialized = false;
|
||||
}
|
||||
|
||||
void TouchSliderPlugin::initialize(QDesignerFormEditorInterface * /* core */)
|
||||
{
|
||||
if (m_initialized)
|
||||
return;
|
||||
|
||||
// Add extension registrations, etc. here
|
||||
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
bool TouchSliderPlugin::isInitialized() const
|
||||
{
|
||||
return m_initialized;
|
||||
}
|
||||
|
||||
QWidget *TouchSliderPlugin::createWidget(QWidget *parent)
|
||||
{
|
||||
TouchSlider * ts = new TouchSlider(parent);
|
||||
ts->setMinimum(-5.);
|
||||
ts->setMaximum(5.);
|
||||
ts->setPrecision(0.2);
|
||||
ts->setValue(2.2);
|
||||
ts->setPrefix("Distanse");
|
||||
ts->setSuffix("meters");
|
||||
return ts;
|
||||
}
|
||||
|
||||
QString TouchSliderPlugin::name() const
|
||||
{
|
||||
return QLatin1String("TouchSlider");
|
||||
}
|
||||
|
||||
QString TouchSliderPlugin::group() const
|
||||
{
|
||||
return QLatin1String("Touch Widgets");
|
||||
}
|
||||
|
||||
QIcon TouchSliderPlugin::icon() const
|
||||
{
|
||||
return QIcon(":/icons/touchslider.png");
|
||||
}
|
||||
|
||||
QString TouchSliderPlugin::toolTip() const
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
QString TouchSliderPlugin::whatsThis() const
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
bool TouchSliderPlugin::isContainer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString TouchSliderPlugin::domXml() const
|
||||
{
|
||||
return QLatin1String("<widget class=\"TouchSlider\" name=\"touchSlider\">\n</widget>\n");
|
||||
}
|
||||
|
||||
QString TouchSliderPlugin::includeFile() const
|
||||
{
|
||||
return QLatin1String("touchslider.h");
|
||||
}
|
||||
|
||||
35
test/qad/touch_widgets/plugin/touchsliderplugin.h
Normal file
35
test/qad/touch_widgets/plugin/touchsliderplugin.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef TOUCHSLIDERPLUGIN_H
|
||||
#define TOUCHSLIDERPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#if QT_VERSION >= 0x050000
|
||||
# include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||
#else
|
||||
# include <QDesignerCustomWidgetInterface>
|
||||
#endif
|
||||
|
||||
class TouchSliderPlugin : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
TouchSliderPlugin(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
|
||||
Reference in New Issue
Block a user