Skip to content
Permalink
Browse files
add QgsProjectionSelectionWidget to custom widgets
  • Loading branch information
3nids committed Jan 5, 2015
1 parent 07c41fd commit bb16a44461bd8d53c065763af424d89bd5744f16
@@ -25,6 +25,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsfieldexpressionwidgetplugin.cpp
qgsfilterlineeditplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsprojectionselectionwidgetplugin.cpp
qgsrelationeditorwidgetplugin.cpp
qgsrelationreferencewidgetplugin.cpp
qgsscalerangewidgetplugin.cpp
@@ -43,6 +44,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsfieldexpressionwidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsprojectionselectionwidgetplugin.h
qgsrelationeditorwidgetplugin.h
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
@@ -69,6 +71,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
qgsfieldexpressionwidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsprojectionselectionwidgetplugin.h
qgsrelationeditorwidgetplugin.h
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
@@ -26,6 +26,7 @@
#include "qgsfieldcomboboxplugin.h"
#include "qgsfieldexpressionwidgetplugin.h"
#include "qgsmaplayercomboboxplugin.h"
#include "qgsprojectionselectionwidgetplugin.h"
#include "qgsrelationeditorwidgetplugin.h"
#include "qgsrelationreferencewidgetplugin.h"
#include "qgsscalerangewidgetplugin.h"
@@ -44,6 +45,7 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
mWidgets.append( new QgsFieldComboBoxPlugin );
mWidgets.append( new QgsFieldExpressionWidgetPlugin );
mWidgets.append( new QgsMapLayerComboBoxPlugin );
mWidgets.append( new QgsProjectionSelectionWidgetPlugin );
mWidgets.append( new QgsRelationEditorWidgetPlugin );
mWidgets.append( new QgsRelationReferenceWidgetPlugin );
mWidgets.append( new QgsScaleRangeWidgetPlugin );
@@ -0,0 +1,97 @@
/***************************************************************************
qgsprojectionselectionwidgetplugin.cpp
--------------------------------------
Date : 05.01.2015
Copyright : (C) 2015 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 "qgsprojectionselectionwidget.h"
#include "qgsprojectionselectionwidgetplugin.h"


QgsProjectionSelectionWidgetPlugin::QgsProjectionSelectionWidgetPlugin( QObject *parent )
: QObject( parent )
, mInitialized( false )
{
}


QString QgsProjectionSelectionWidgetPlugin::name() const
{
return "QgsProjectionSelectionWidget";
}

QString QgsProjectionSelectionWidgetPlugin::group() const
{
return QgisCustomWidgets::groupName();
}

QString QgsProjectionSelectionWidgetPlugin::includeFile() const
{
return "qgsprojectionselectionwidget.h";
}

QIcon QgsProjectionSelectionWidgetPlugin::icon() const
{
return QIcon();
}

bool QgsProjectionSelectionWidgetPlugin::isContainer() const
{
return false;
}

QWidget *QgsProjectionSelectionWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsProjectionSelectionWidget( parent );
}

bool QgsProjectionSelectionWidgetPlugin::isInitialized() const
{
return mInitialized;
}

void QgsProjectionSelectionWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
{
Q_UNUSED( core );
if ( mInitialized )
return;
mInitialized = true;
}


QString QgsProjectionSelectionWidgetPlugin::toolTip() const
{
return tr( "A widget to select a generic projection system." );
}

QString QgsProjectionSelectionWidgetPlugin::whatsThis() const
{
return tr( "A widget to select a generic projection system." );
}

QString QgsProjectionSelectionWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mQgsProjectionSelectionWidget\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>160</width>\n"
" <height>27</height>\n"
" </rect>\n"
" </property>\n"
" </widget>\n"
"</ui>\n" )
.arg( name() );
}
@@ -0,0 +1,49 @@
/***************************************************************************
qgsprojectionselectionwidgetplugin.h
--------------------------------------
Date : 05.01.2015
Copyright : (C) 2015 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 QGSPROJECTIONSELECTIONWIDGETPLUGIN_H
#define QGSPROJECTIONSELECTIONWIDGETPLUGIN_H

#include <QDesignerExportWidget>
#include <QDesignerCustomWidgetInterface>


class CUSTOMWIDGETS_EXPORT QgsProjectionSelectionWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
{
Q_OBJECT
Q_INTERFACES( QDesignerCustomWidgetInterface )

public:
explicit QgsProjectionSelectionWidgetPlugin( 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 // QGSPROJECTIONSELECTIONWIDGETPLUGIN_H

0 comments on commit bb16a44

Please sign in to comment.