Skip to content

Commit 346f84a

Browse files
committed
added QgsExtentGroupBox to custom widgets
1 parent 8b2bbcd commit 346f84a

File tree

4 files changed

+150
-0
lines changed

4 files changed

+150
-0
lines changed

src/customwidgets/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
2828
qgsdatetimeeditplugin.cpp
2929
qgsdatadefinedbuttonplugin.cpp
3030
qgsdoublespinboxplugin.cpp
31+
qgsextentgroupboxplugin.cpp
3132
qgsfieldcomboboxplugin.cpp
3233
qgsfieldexpressionwidgetplugin.cpp
3334
qgsfilterlineeditplugin.cpp
@@ -48,6 +49,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
4849
qgsdatetimeeditplugin.h
4950
qgsdatadefinedbuttonplugin.h
5051
qgsdoublespinboxplugin.h
52+
qgsextentgroupboxplugin.h
5153
qgsfieldcomboboxplugin.h
5254
qgsfieldexpressionwidgetplugin.h
5355
qgsfilterlineeditplugin.h
@@ -74,6 +76,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
7476
qgsdatetimeeditplugin.h
7577
qgsdatadefinedbuttonplugin.h
7678
qgsdoublespinboxplugin.h
79+
qgsextentgroupboxplugin.h
7780
qgsfieldcomboboxplugin.h
7881
qgsfieldexpressionwidgetplugin.h
7982
qgsfilterlineeditplugin.h

src/customwidgets/qgiscustomwidgets.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "qgsdatadefinedbuttonplugin.h"
2424
#include "qgsdatetimeeditplugin.h"
2525
#include "qgsdoublespinboxplugin.h"
26+
#include "qgsextentgroupboxplugin.h"
2627
#include "qgsfieldcomboboxplugin.h"
2728
#include "qgsfieldexpressionwidgetplugin.h"
2829
#include "qgsfilterlineeditplugin.h"
@@ -44,6 +45,7 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
4445
mWidgets.append( new QgsDataDefinedButtonPlugin( this ) );
4546
mWidgets.append( new QgsDateTimeEditPlugin( this ) );
4647
mWidgets.append( new QgsDoubleSpinBoxPlugin( this ) );
48+
mWidgets.append( new QgsExtentGroupBoxPlugin( this ) );
4749
mWidgets.append( new QgsFieldComboBoxPlugin( this ) );
4850
mWidgets.append( new QgsFieldExpressionWidgetPlugin( this ) );
4951
mWidgets.append( new QgsFilterLineEditPlugin( this ) );
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/***************************************************************************
2+
qgsextentroupboxplugin.cpp
3+
--------------------------------------
4+
Date : 28.07.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 "qgsextentgroupbox.h"
18+
#include "qgsextentgroupboxplugin.h"
19+
20+
21+
QgsExtentGroupBoxPlugin::QgsExtentGroupBoxPlugin( QObject *parent )
22+
: QObject( parent )
23+
, mInitialized( false )
24+
{
25+
}
26+
27+
28+
QString QgsExtentGroupBoxPlugin::name() const
29+
{
30+
return "QgsExtentGroupBox";
31+
}
32+
33+
QString QgsExtentGroupBoxPlugin::group() const
34+
{
35+
return QgisCustomWidgets::groupName();
36+
}
37+
38+
QString QgsExtentGroupBoxPlugin::includeFile() const
39+
{
40+
return "qgsextentroupbox.h";
41+
}
42+
43+
QIcon QgsExtentGroupBoxPlugin::icon() const
44+
{
45+
return QIcon();
46+
}
47+
48+
bool QgsExtentGroupBoxPlugin::isContainer() const
49+
{
50+
return true;
51+
}
52+
53+
QWidget *QgsExtentGroupBoxPlugin::createWidget( QWidget *parent )
54+
{
55+
return new QgsExtentGroupBox( parent );
56+
}
57+
58+
bool QgsExtentGroupBoxPlugin::isInitialized() const
59+
{
60+
return mInitialized;
61+
}
62+
63+
void QgsExtentGroupBoxPlugin::initialize( QDesignerFormEditorInterface *core )
64+
{
65+
Q_UNUSED( core );
66+
if ( mInitialized )
67+
return;
68+
mInitialized = true;
69+
}
70+
71+
72+
QString QgsExtentGroupBoxPlugin::toolTip() const
73+
{
74+
return tr( "A group box to enter a map extent" );
75+
}
76+
77+
QString QgsExtentGroupBoxPlugin::whatsThis() const
78+
{
79+
return tr( "A group box to enter a map extent" );
80+
}
81+
82+
QString QgsExtentGroupBoxPlugin::domXml() const
83+
{
84+
return QString( "<ui language=\"c++\">\n"
85+
" <widget class=\"%1\" name=\"mExtentGroupBox\">\n"
86+
" <property name=\"geometry\">\n"
87+
" <rect>\n"
88+
" <x>0</x>\n"
89+
" <y>0</y>\n"
90+
" <width>300</width>\n"
91+
" <height>100</height>\n"
92+
" </rect>\n"
93+
" </property>\n"
94+
" </widget>\n"
95+
"</ui>\n" )
96+
.arg( name() );
97+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/***************************************************************************
2+
qgsextentroupboxplugin.h
3+
--------------------------------------
4+
Date : 28.07.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 QGSEXTENTGROUPBOXPLUGIN_H
17+
#define QGSEXTENTGROUPBOXPLUGIN_H
18+
19+
#include <QDesignerExportWidget>
20+
#include <QDesignerCustomWidgetInterface>
21+
22+
23+
class CUSTOMWIDGETS_EXPORT QgsExtentGroupBoxPlugin : public QObject, public QDesignerCustomWidgetInterface
24+
{
25+
Q_OBJECT
26+
Q_INTERFACES( QDesignerCustomWidgetInterface )
27+
28+
public:
29+
explicit QgsExtentGroupBoxPlugin( QObject *parent = 0 );
30+
31+
private:
32+
bool mInitialized;
33+
34+
// QDesignerCustomWidgetInterface interface
35+
public:
36+
QString name() const override;
37+
QString group() const override;
38+
QString includeFile() const override;
39+
QIcon icon() const override;
40+
bool isContainer() const override;
41+
QWidget *createWidget( QWidget *parent ) override;
42+
bool isInitialized() const override;
43+
void initialize( QDesignerFormEditorInterface *core ) override;
44+
QString toolTip() const override;
45+
QString whatsThis() const override;
46+
QString domXml() const override;
47+
};
48+
#endif // QGSEXTENTGROUPBOXPLUGIN_H

0 commit comments

Comments
 (0)