Skip to content

Commit 482fa44

Browse files
3nidsm-kuhn
authored andcommittedAug 27, 2014
[custom widgets] add relation reference
1 parent c243c58 commit 482fa44

File tree

5 files changed

+157
-3
lines changed

5 files changed

+157
-3
lines changed
 

‎src/customwidgets/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
2222
qgsfieldcomboboxplugin.cpp
2323
qgsfieldexpressionwidgetplugin.cpp
2424
qgsmaplayercomboboxplugin.cpp
25+
qgsrelationeditorwidgetplugin.cpp
2526
qgsrelationreferencewidgetplugin.cpp
2627
qgsscalerangewidgetplugin.cpp
2728
)
@@ -35,6 +36,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
3536
qgsfieldcomboboxplugin.h
3637
qgsfieldexpressionwidgetplugin.h
3738
qgsmaplayercomboboxplugin.h
39+
qgsrelationeditorwidgetplugin.h
3840
qgsrelationreferencewidgetplugin.h
3941
qgsscalerangewidgetplugin.h
4042
)
@@ -56,6 +58,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
5658
qgsfieldcomboboxplugin.h
5759
qgsfieldexpressionwidgetplugin.h
5860
qgsmaplayercomboboxplugin.h
61+
qgsrelationeditorwidgetplugin.h
5962
qgsrelationreferencewidgetplugin.h
6063
qgsscalerangewidgetplugin.h
6164
)
@@ -70,8 +73,9 @@ INCLUDE_DIRECTORIES(
7073
${CMAKE_CURRENT_SOURCE_DIR}/../core/
7174
${CMAKE_CURRENT_SOURCE_DIR}/../core/symbology-ng/
7275
${CMAKE_CURRENT_SOURCE_DIR}/../gui/
76+
${CMAKE_CURRENT_SOURCE_DIR}/../gui/attributetable/
7377
${CMAKE_CURRENT_SOURCE_DIR}/../gui/editorwidgets/
74-
# ${CMAKE_CURRENT_BINARY_DIR}/../ui (no UI file yet)
78+
${CMAKE_CURRENT_BINARY_DIR}/../ui/
7579
${GEOS_INCLUDE_DIR}
7680
)
7781

@@ -92,8 +96,7 @@ SET_TARGET_PROPERTIES(qgis_customwidgets PROPERTIES
9296
)
9397

9498
# make sure that UI files will be processed first
95-
# left commented as there is no UI file yet
96-
# ADD_DEPENDENCIES(qgis_customwidgets ui)
99+
ADD_DEPENDENCIES(qgis_customwidgets ui)
97100

98101
TARGET_LINK_LIBRARIES(qgis_customwidgets qgis_gui)
99102

‎src/customwidgets/qgiscustomwidgets.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "qgsfieldcomboboxplugin.h"
2525
#include "qgsfieldexpressionwidgetplugin.h"
2626
#include "qgsmaplayercomboboxplugin.h"
27+
#include "qgsrelationeditorwidgetplugin.h"
2728
#include "qgsrelationreferencewidgetplugin.h"
2829
#include "qgsscalerangewidgetplugin.h"
2930

@@ -38,6 +39,7 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
3839
mWidgets.append( new QgsFieldComboBoxPlugin );
3940
mWidgets.append( new QgsFieldExpressionWidgetPlugin );
4041
mWidgets.append( new QgsMapLayerComboBoxPlugin );
42+
mWidgets.append( new QgsRelationEditorWidgetPlugin );
4143
mWidgets.append( new QgsRelationReferenceWidgetPlugin );
4244
mWidgets.append( new QgsScaleRangeWidgetPlugin );
4345
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/***************************************************************************
2+
qgsrelationeditorwidgetplugin.cpp
3+
--------------------------------------
4+
Date : 20.08.2014
5+
Copyright : (C) 2014 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 "qgsrelationeditorwidget.h"
18+
#include "qgsrelationeditorwidgetplugin.h"
19+
20+
21+
QgsRelationEditorWidgetPlugin::QgsRelationEditorWidgetPlugin( QObject *parent )
22+
: QObject( parent )
23+
, mInitialized( false )
24+
{
25+
}
26+
27+
28+
QString QgsRelationEditorWidgetPlugin::name() const
29+
{
30+
return "QgsRelationEditorWidget";
31+
}
32+
33+
QString QgsRelationEditorWidgetPlugin::group() const
34+
{
35+
return QgisCustomWidgets::groupName();
36+
}
37+
38+
QString QgsRelationEditorWidgetPlugin::includeFile() const
39+
{
40+
return "qgsrelationeditorwidget.h";
41+
}
42+
43+
QIcon QgsRelationEditorWidgetPlugin::icon() const
44+
{
45+
return QIcon();
46+
}
47+
48+
bool QgsRelationEditorWidgetPlugin::isContainer() const
49+
{
50+
return false;
51+
}
52+
53+
QWidget *QgsRelationEditorWidgetPlugin::createWidget( QWidget *parent )
54+
{
55+
return new QgsRelationEditorWidget( parent );
56+
}
57+
58+
bool QgsRelationEditorWidgetPlugin::isInitialized() const
59+
{
60+
return mInitialized;
61+
}
62+
63+
void QgsRelationEditorWidgetPlugin::initialize( QDesignerFormEditorInterface *core )
64+
{
65+
Q_UNUSED( core );
66+
if ( mInitialized )
67+
return;
68+
mInitialized = true;
69+
}
70+
71+
72+
QString QgsRelationEditorWidgetPlugin::toolTip() const
73+
{
74+
return tr( "Relation editor" );
75+
}
76+
77+
QString QgsRelationEditorWidgetPlugin::whatsThis() const
78+
{
79+
return "";
80+
}
81+
82+
QString QgsRelationEditorWidgetPlugin::domXml() const
83+
{
84+
return QString( "<ui language=\"c++\">\n"
85+
" <widget class=\"%1\" name=\"mRelationEditor\">\n"
86+
" <property name=\"qgisRelation\" >\n"
87+
" <string notr=\"true\"></string>\n"
88+
" </property>\n"
89+
" <property name=\"geometry\">\n"
90+
" <rect>\n"
91+
" <x>0</x>\n"
92+
" <y>0</y>\n"
93+
" <width>27</width>\n"
94+
" <height>27</height>\n"
95+
" </rect>\n"
96+
" </property>\n"
97+
" </widget>\n"
98+
"</ui>\n" )
99+
.arg( name() );
100+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/***************************************************************************
2+
qgsrelationeditorwidgetplugin.h
3+
--------------------------------------
4+
Date : 20.08.2014
5+
Copyright : (C) 2014 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 QGSRELATIONEDITORWIDGETPLUGIN_H
17+
#define QGSRELATIONEDITORWIDGETPLUGIN_H
18+
19+
#include <QDesignerExportWidget>
20+
#include <QDesignerCustomWidgetInterface>
21+
22+
23+
class CUSTOMWIDGETS_EXPORT QgsRelationEditorWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
24+
{
25+
Q_OBJECT
26+
Q_INTERFACES( QDesignerCustomWidgetInterface )
27+
28+
public:
29+
explicit QgsRelationEditorWidgetPlugin( 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+
#endif // QGSRELATIONEDITORWIDGETPLUGIN_H

‎src/gui/attributetable/qgsdualview.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class QgsMapLayerAction;
4242
class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBase
4343
{
4444
Q_OBJECT
45+
Q_ENUMS(ViewMode)
4546

4647
public:
4748

0 commit comments

Comments
 (0)
Please sign in to comment.