Skip to content

Commit bb16a44

Browse files
committed
add QgsProjectionSelectionWidget to custom widgets
1 parent 07c41fd commit bb16a44

File tree

4 files changed

+151
-0
lines changed

4 files changed

+151
-0
lines changed

src/customwidgets/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
2525
qgsfieldexpressionwidgetplugin.cpp
2626
qgsfilterlineeditplugin.cpp
2727
qgsmaplayercomboboxplugin.cpp
28+
qgsprojectionselectionwidgetplugin.cpp
2829
qgsrelationeditorwidgetplugin.cpp
2930
qgsrelationreferencewidgetplugin.cpp
3031
qgsscalerangewidgetplugin.cpp
@@ -43,6 +44,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
4344
qgsfieldexpressionwidgetplugin.h
4445
qgsfilterlineeditplugin.h
4546
qgsmaplayercomboboxplugin.h
47+
qgsprojectionselectionwidgetplugin.h
4648
qgsrelationeditorwidgetplugin.h
4749
qgsrelationreferencewidgetplugin.h
4850
qgsscalerangewidgetplugin.h
@@ -69,6 +71,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
6971
qgsfieldexpressionwidgetplugin.h
7072
qgsfilterlineeditplugin.h
7173
qgsmaplayercomboboxplugin.h
74+
qgsprojectionselectionwidgetplugin.h
7275
qgsrelationeditorwidgetplugin.h
7376
qgsrelationreferencewidgetplugin.h
7477
qgsscalerangewidgetplugin.h

src/customwidgets/qgiscustomwidgets.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "qgsfieldcomboboxplugin.h"
2727
#include "qgsfieldexpressionwidgetplugin.h"
2828
#include "qgsmaplayercomboboxplugin.h"
29+
#include "qgsprojectionselectionwidgetplugin.h"
2930
#include "qgsrelationeditorwidgetplugin.h"
3031
#include "qgsrelationreferencewidgetplugin.h"
3132
#include "qgsscalerangewidgetplugin.h"
@@ -44,6 +45,7 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
4445
mWidgets.append( new QgsFieldComboBoxPlugin );
4546
mWidgets.append( new QgsFieldExpressionWidgetPlugin );
4647
mWidgets.append( new QgsMapLayerComboBoxPlugin );
48+
mWidgets.append( new QgsProjectionSelectionWidgetPlugin );
4749
mWidgets.append( new QgsRelationEditorWidgetPlugin );
4850
mWidgets.append( new QgsRelationReferenceWidgetPlugin );
4951
mWidgets.append( new QgsScaleRangeWidgetPlugin );
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/***************************************************************************
2+
qgsprojectionselectionwidgetplugin.cpp
3+
--------------------------------------
4+
Date : 05.01.2015
5+
Copyright : (C) 2015 Denis Rouzaud
6+
Email : denis.rouzaud@gmail.com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#include "qgiscustomwidgets.h"
17+
#include "qgsprojectionselectionwidget.h"
18+
#include "qgsprojectionselectionwidgetplugin.h"
19+
20+
21+
QgsProjectionSelectionWidgetPlugin::QgsProjectionSelectionWidgetPlugin( QObject *parent )
22+
: QObject( parent )
23+
, mInitialized( false )
24+
{
25+
}
26+
27+
28+
QString QgsProjectionSelectionWidgetPlugin::name() const
29+
{
30+
return "QgsProjectionSelectionWidget";
31+
}
32+
33+
QString QgsProjectionSelectionWidgetPlugin::group() const
34+
{
35+
return QgisCustomWidgets::groupName();
36+
}
37+
38+
QString QgsProjectionSelectionWidgetPlugin::includeFile() const
39+
{
40+
return "qgsprojectionselectionwidget.h";
41+
}
42+
43+
QIcon QgsProjectionSelectionWidgetPlugin::icon() const
44+
{
45+
return QIcon();
46+
}
47+
48+
bool QgsProjectionSelectionWidgetPlugin::isContainer() const
49+
{
50+
return false;
51+
}
52+
53+
QWidget *QgsProjectionSelectionWidgetPlugin::createWidget( QWidget *parent )
54+
{
55+
return new QgsProjectionSelectionWidget( parent );
56+
}
57+
58+
bool QgsProjectionSelectionWidgetPlugin::isInitialized() const
59+
{
60+
return mInitialized;
61+
}
62+
63+
void QgsProjectionSelectionWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
64+
{
65+
Q_UNUSED( core );
66+
if ( mInitialized )
67+
return;
68+
mInitialized = true;
69+
}
70+
71+
72+
QString QgsProjectionSelectionWidgetPlugin::toolTip() const
73+
{
74+
return tr( "A widget to select a generic projection system." );
75+
}
76+
77+
QString QgsProjectionSelectionWidgetPlugin::whatsThis() const
78+
{
79+
return tr( "A widget to select a generic projection system." );
80+
}
81+
82+
QString QgsProjectionSelectionWidgetPlugin::domXml() const
83+
{
84+
return QString( "<ui language=\"c++\">\n"
85+
" <widget class=\"%1\" name=\"mQgsProjectionSelectionWidget\">\n"
86+
" <property name=\"geometry\">\n"
87+
" <rect>\n"
88+
" <x>0</x>\n"
89+
" <y>0</y>\n"
90+
" <width>160</width>\n"
91+
" <height>27</height>\n"
92+
" </rect>\n"
93+
" </property>\n"
94+
" </widget>\n"
95+
"</ui>\n" )
96+
.arg( name() );
97+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/***************************************************************************
2+
qgsprojectionselectionwidgetplugin.h
3+
--------------------------------------
4+
Date : 05.01.2015
5+
Copyright : (C) 2015 Denis Rouzaud
6+
Email : denis.rouzaud@gmail.com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
16+
#ifndef QGSPROJECTIONSELECTIONWIDGETPLUGIN_H
17+
#define QGSPROJECTIONSELECTIONWIDGETPLUGIN_H
18+
19+
#include <QDesignerExportWidget>
20+
#include <QDesignerCustomWidgetInterface>
21+
22+
23+
class CUSTOMWIDGETS_EXPORT QgsProjectionSelectionWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
24+
{
25+
Q_OBJECT
26+
Q_INTERFACES( QDesignerCustomWidgetInterface )
27+
28+
public:
29+
explicit QgsProjectionSelectionWidgetPlugin( QObject *parent = 0 );
30+
31+
private:
32+
bool mInitialized;
33+
34+
// QDesignerCustomWidgetInterface interface
35+
public:
36+
QString name() const;
37+
QString group() const;
38+
QString includeFile() const;
39+
QIcon icon() const;
40+
bool isContainer() const;
41+
QWidget *createWidget( QWidget *parent );
42+
bool isInitialized() const;
43+
void initialize( QDesignerFormEditorInterface *core );
44+
QString toolTip() const;
45+
QString whatsThis() const;
46+
QString domXml() const;
47+
};
48+
49+
#endif // QGSPROJECTIONSELECTIONWIDGETPLUGIN_H

0 commit comments

Comments
 (0)