mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
add Qgs(Double)SpinBox to custom widgets
This commit is contained in:
parent
48cdd749eb
commit
054ac10830
@ -20,6 +20,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
|
||||
qgscolorbuttonv2plugin.cpp
|
||||
qgsdatetimeeditplugin.cpp
|
||||
qgsdatadefinedbuttonplugin.cpp
|
||||
qgsdoublespinboxplugin.cpp
|
||||
qgsfieldcomboboxplugin.cpp
|
||||
qgsfieldexpressionwidgetplugin.cpp
|
||||
qgsfilterlineeditplugin.cpp
|
||||
@ -27,6 +28,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
|
||||
qgsrelationeditorwidgetplugin.cpp
|
||||
qgsrelationreferencewidgetplugin.cpp
|
||||
qgsscalerangewidgetplugin.cpp
|
||||
qgsspinboxplugin.cpp
|
||||
)
|
||||
|
||||
SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
|
||||
@ -36,6 +38,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
|
||||
qgscolorbuttonv2plugin.h
|
||||
qgsdatetimeeditplugin.h
|
||||
qgsdatadefinedbuttonplugin.h
|
||||
qgsdoublespinboxplugin.h
|
||||
qgsfieldcomboboxplugin.h
|
||||
qgsfieldexpressionwidgetplugin.h
|
||||
qgsfilterlineeditplugin.h
|
||||
@ -43,6 +46,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
|
||||
qgsrelationeditorwidgetplugin.h
|
||||
qgsrelationreferencewidgetplugin.h
|
||||
qgsscalerangewidgetplugin.h
|
||||
qgsspinboxplugin.h
|
||||
)
|
||||
|
||||
QT4_WRAP_CPP(QGIS_CUSTOMWIDGETS_MOC_SRCS ${QGIS_CUSTOMWIDGETS_MOC_HDRS})
|
||||
@ -60,6 +64,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
|
||||
qgscolorbuttonv2plugin.h
|
||||
qgsdatetimeeditplugin.h
|
||||
qgsdatadefinedbuttonplugin.h
|
||||
qgsdoublespinboxplugin.h
|
||||
qgsfieldcomboboxplugin.h
|
||||
qgsfieldexpressionwidgetplugin.h
|
||||
qgsfilterlineeditplugin.h
|
||||
@ -67,6 +72,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
|
||||
qgsrelationeditorwidgetplugin.h
|
||||
qgsrelationreferencewidgetplugin.h
|
||||
qgsscalerangewidgetplugin.h
|
||||
qgsspinboxplugin.h
|
||||
)
|
||||
|
||||
# left commented as there is no UI file yet
|
||||
|
@ -21,12 +21,14 @@
|
||||
#include "qgscolorbuttonplugin.h"
|
||||
#include "qgscolorbuttonv2plugin.h"
|
||||
#include "qgsdatadefinedbuttonplugin.h"
|
||||
#include "qgsdoublespinboxplugin.h"
|
||||
#include "qgsfieldcomboboxplugin.h"
|
||||
#include "qgsfieldexpressionwidgetplugin.h"
|
||||
#include "qgsmaplayercomboboxplugin.h"
|
||||
#include "qgsrelationeditorwidgetplugin.h"
|
||||
#include "qgsrelationreferencewidgetplugin.h"
|
||||
#include "qgsscalerangewidgetplugin.h"
|
||||
#include "qgsspinboxplugin.h"
|
||||
|
||||
|
||||
QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
|
||||
@ -36,12 +38,14 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
|
||||
mWidgets.append( new QgsColorButtonPlugin );
|
||||
mWidgets.append( new QgsColorButtonV2Plugin );
|
||||
mWidgets.append( new QgsDataDefinedButtonPlugin );
|
||||
mWidgets.append( new QgsDoubleSpinBoxPlugin );
|
||||
mWidgets.append( new QgsFieldComboBoxPlugin );
|
||||
mWidgets.append( new QgsFieldExpressionWidgetPlugin );
|
||||
mWidgets.append( new QgsMapLayerComboBoxPlugin );
|
||||
mWidgets.append( new QgsRelationEditorWidgetPlugin );
|
||||
mWidgets.append( new QgsRelationReferenceWidgetPlugin );
|
||||
mWidgets.append( new QgsScaleRangeWidgetPlugin );
|
||||
mWidgets.append( new QgsSpinBoxPlugin );
|
||||
}
|
||||
|
||||
QList<QDesignerCustomWidgetInterface*> QgisCustomWidgets::customWidgets() const
|
||||
|
97
src/customwidgets/qgsdoublespinboxplugin.cpp
Normal file
97
src/customwidgets/qgsdoublespinboxplugin.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/***************************************************************************
|
||||
qgsdoublespinboxplugin.cpp
|
||||
--------------------------------------
|
||||
Date : 01.09.2014
|
||||
Copyright : (C) 2014 Denis Rouzaud
|
||||
Email : denis.rouzaud@gmail.com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgiscustomwidgets.h"
|
||||
#include "qgsdoublespinboxplugin.h"
|
||||
#include "qgsdoublespinbox.h"
|
||||
|
||||
|
||||
QgsDoubleSpinBoxPlugin::QgsDoubleSpinBoxPlugin( QObject *parent )
|
||||
: QObject( parent )
|
||||
, mInitialized( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString QgsDoubleSpinBoxPlugin::name() const
|
||||
{
|
||||
return "QgsDoubleSpinBox";
|
||||
}
|
||||
|
||||
QString QgsDoubleSpinBoxPlugin::group() const
|
||||
{
|
||||
return QgisCustomWidgets::groupName();
|
||||
}
|
||||
|
||||
QString QgsDoubleSpinBoxPlugin::includeFile() const
|
||||
{
|
||||
return "qgsdoublespinbox.h";
|
||||
}
|
||||
|
||||
QIcon QgsDoubleSpinBoxPlugin::icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
bool QgsDoubleSpinBoxPlugin::isContainer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QWidget *QgsDoubleSpinBoxPlugin::createWidget( QWidget *parent )
|
||||
{
|
||||
return new QgsDoubleSpinBox( parent );
|
||||
}
|
||||
|
||||
bool QgsDoubleSpinBoxPlugin::isInitialized() const
|
||||
{
|
||||
return mInitialized;
|
||||
}
|
||||
|
||||
void QgsDoubleSpinBoxPlugin::initialize( QDesignerFormEditorInterface *core )
|
||||
{
|
||||
Q_UNUSED( core );
|
||||
if ( mInitialized )
|
||||
return;
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
QString QgsDoubleSpinBoxPlugin::toolTip() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QString QgsDoubleSpinBoxPlugin::whatsThis() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QString QgsDoubleSpinBoxPlugin::domXml() const
|
||||
{
|
||||
return QString( "<ui language=\"c++\">\n"
|
||||
" <widget class=\"%1\" name=\"mQgsDoubleSpinBox\">\n"
|
||||
" <property name=\"geometry\">\n"
|
||||
" <rect>\n"
|
||||
" <x>0</x>\n"
|
||||
" <y>0</y>\n"
|
||||
" <width>90</width>\n"
|
||||
" <height>27</height>\n"
|
||||
" </rect>\n"
|
||||
" </property>\n"
|
||||
" </widget>\n"
|
||||
"</ui>\n" )
|
||||
.arg( name() );
|
||||
}
|
48
src/customwidgets/qgsdoublespinboxplugin.h
Normal file
48
src/customwidgets/qgsdoublespinboxplugin.h
Normal file
@ -0,0 +1,48 @@
|
||||
/***************************************************************************
|
||||
qgsdoublespinboxplugin.h
|
||||
--------------------------------------
|
||||
Date : 01.09.2014
|
||||
Copyright : (C) 2014 Denis Rouzaud
|
||||
Email : denis.rouzaud@gmail.com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSDOUBLESPINBOXPLUGIN_H
|
||||
#define QGSDOUBLESPINBOXPLUGIN_H
|
||||
|
||||
#include <QDesignerExportWidget>
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
|
||||
class CUSTOMWIDGETS_EXPORT QgsDoubleSpinBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES( QDesignerCustomWidgetInterface )
|
||||
|
||||
public:
|
||||
explicit QgsDoubleSpinBoxPlugin( QObject *parent = 0 );
|
||||
|
||||
private:
|
||||
bool mInitialized;
|
||||
|
||||
// QDesignerCustomWidgetInterface interface
|
||||
public:
|
||||
QString name() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QIcon icon() const;
|
||||
bool isContainer() const;
|
||||
QWidget *createWidget( QWidget *parent );
|
||||
bool isInitialized() const;
|
||||
void initialize( QDesignerFormEditorInterface *core );
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QString domXml() const;
|
||||
};
|
||||
#endif // QGSDOUBLESPINBOXPLUGIN_H
|
97
src/customwidgets/qgsspinboxplugin.cpp
Normal file
97
src/customwidgets/qgsspinboxplugin.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/***************************************************************************
|
||||
qgsspinboxplugin.cpp
|
||||
--------------------------------------
|
||||
Date : 01.09.2014
|
||||
Copyright : (C) 2014 Denis Rouzaud
|
||||
Email : denis.rouzaud@gmail.com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgiscustomwidgets.h"
|
||||
#include "qgsspinboxplugin.h"
|
||||
#include "qgsspinbox.h"
|
||||
|
||||
|
||||
QgsSpinBoxPlugin::QgsSpinBoxPlugin( QObject *parent )
|
||||
: QObject( parent )
|
||||
, mInitialized( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QString QgsSpinBoxPlugin::name() const
|
||||
{
|
||||
return "QgsSpinBox";
|
||||
}
|
||||
|
||||
QString QgsSpinBoxPlugin::group() const
|
||||
{
|
||||
return QgisCustomWidgets::groupName();
|
||||
}
|
||||
|
||||
QString QgsSpinBoxPlugin::includeFile() const
|
||||
{
|
||||
return "qgsspinbox.h";
|
||||
}
|
||||
|
||||
QIcon QgsSpinBoxPlugin::icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
bool QgsSpinBoxPlugin::isContainer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QWidget *QgsSpinBoxPlugin::createWidget( QWidget *parent )
|
||||
{
|
||||
return new QgsSpinBox( parent );
|
||||
}
|
||||
|
||||
bool QgsSpinBoxPlugin::isInitialized() const
|
||||
{
|
||||
return mInitialized;
|
||||
}
|
||||
|
||||
void QgsSpinBoxPlugin::initialize( QDesignerFormEditorInterface *core )
|
||||
{
|
||||
Q_UNUSED( core );
|
||||
if ( mInitialized )
|
||||
return;
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
QString QgsSpinBoxPlugin::toolTip() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QString QgsSpinBoxPlugin::whatsThis() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QString QgsSpinBoxPlugin::domXml() const
|
||||
{
|
||||
return QString( "<ui language=\"c++\">\n"
|
||||
" <widget class=\"%1\" name=\"mQgsSpinBox\">\n"
|
||||
" <property name=\"geometry\">\n"
|
||||
" <rect>\n"
|
||||
" <x>0</x>\n"
|
||||
" <y>0</y>\n"
|
||||
" <width>90</width>\n"
|
||||
" <height>27</height>\n"
|
||||
" </rect>\n"
|
||||
" </property>\n"
|
||||
" </widget>\n"
|
||||
"</ui>\n" )
|
||||
.arg( name() );
|
||||
}
|
48
src/customwidgets/qgsspinboxplugin.h
Normal file
48
src/customwidgets/qgsspinboxplugin.h
Normal file
@ -0,0 +1,48 @@
|
||||
/***************************************************************************
|
||||
qgsspinboxplugin.h
|
||||
--------------------------------------
|
||||
Date : 01.09.2014
|
||||
Copyright : (C) 2014 Denis Rouzaud
|
||||
Email : denis.rouzaud@gmail.com
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSSPINBOXPLUGIN_H
|
||||
#define QGSSPINBOXPLUGIN_H
|
||||
|
||||
#include <QDesignerExportWidget>
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
|
||||
class CUSTOMWIDGETS_EXPORT QgsSpinBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES( QDesignerCustomWidgetInterface )
|
||||
|
||||
public:
|
||||
explicit QgsSpinBoxPlugin( QObject *parent = 0 );
|
||||
|
||||
private:
|
||||
bool mInitialized;
|
||||
|
||||
// QDesignerCustomWidgetInterface interface
|
||||
public:
|
||||
QString name() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QIcon icon() const;
|
||||
bool isContainer() const;
|
||||
QWidget *createWidget( QWidget *parent );
|
||||
bool isInitialized() const;
|
||||
void initialize( QDesignerFormEditorInterface *core );
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QString domXml() const;
|
||||
};
|
||||
#endif // QGSSPINBOXPLUGIN_H
|
Loading…
x
Reference in New Issue
Block a user