Skip to content

Commit

Permalink
[custom widgets] add relation reference
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and m-kuhn committed Aug 27, 2014
1 parent c243c58 commit 482fa44
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/customwidgets/CMakeLists.txt
Expand Up @@ -22,6 +22,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsrelationeditorwidgetplugin.cpp
qgsrelationreferencewidgetplugin.cpp
qgsscalerangewidgetplugin.cpp
)
Expand All @@ -35,6 +36,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsmaplayercomboboxplugin.h
qgsrelationeditorwidgetplugin.h
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
)
Expand All @@ -56,6 +58,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsmaplayercomboboxplugin.h
qgsrelationeditorwidgetplugin.h
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
)
Expand All @@ -70,8 +73,9 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../core/
${CMAKE_CURRENT_SOURCE_DIR}/../core/symbology-ng/
${CMAKE_CURRENT_SOURCE_DIR}/../gui/
${CMAKE_CURRENT_SOURCE_DIR}/../gui/attributetable/
${CMAKE_CURRENT_SOURCE_DIR}/../gui/editorwidgets/
# ${CMAKE_CURRENT_BINARY_DIR}/../ui (no UI file yet)
${CMAKE_CURRENT_BINARY_DIR}/../ui/
${GEOS_INCLUDE_DIR}
)

Expand All @@ -92,8 +96,7 @@ SET_TARGET_PROPERTIES(qgis_customwidgets PROPERTIES
)

# make sure that UI files will be processed first
# left commented as there is no UI file yet
# ADD_DEPENDENCIES(qgis_customwidgets ui)
ADD_DEPENDENCIES(qgis_customwidgets ui)

TARGET_LINK_LIBRARIES(qgis_customwidgets qgis_gui)

Expand Down
2 changes: 2 additions & 0 deletions src/customwidgets/qgiscustomwidgets.cpp
Expand Up @@ -24,6 +24,7 @@
#include "qgsfieldcomboboxplugin.h"
#include "qgsfieldexpressionwidgetplugin.h"
#include "qgsmaplayercomboboxplugin.h"
#include "qgsrelationeditorwidgetplugin.h"
#include "qgsrelationreferencewidgetplugin.h"
#include "qgsscalerangewidgetplugin.h"

Expand All @@ -38,6 +39,7 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
mWidgets.append( new QgsFieldComboBoxPlugin );
mWidgets.append( new QgsFieldExpressionWidgetPlugin );
mWidgets.append( new QgsMapLayerComboBoxPlugin );
mWidgets.append( new QgsRelationEditorWidgetPlugin );
mWidgets.append( new QgsRelationReferenceWidgetPlugin );
mWidgets.append( new QgsScaleRangeWidgetPlugin );
}
Expand Down
100 changes: 100 additions & 0 deletions src/customwidgets/qgsrelationeditorwidgetplugin.cpp
@@ -0,0 +1,100 @@
/***************************************************************************
qgsrelationeditorwidgetplugin.cpp
--------------------------------------
Date : 20.08.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 "qgsrelationeditorwidget.h"
#include "qgsrelationeditorwidgetplugin.h"


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


QString QgsRelationEditorWidgetPlugin::name() const
{
return "QgsRelationEditorWidget";
}

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

QString QgsRelationEditorWidgetPlugin::includeFile() const
{
return "qgsrelationeditorwidget.h";
}

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

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

QWidget *QgsRelationEditorWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsRelationEditorWidget( parent );
}

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

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


QString QgsRelationEditorWidgetPlugin::toolTip() const
{
return tr( "Relation editor" );
}

QString QgsRelationEditorWidgetPlugin::whatsThis() const
{
return "";
}

QString QgsRelationEditorWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mRelationEditor\">\n"
" <property name=\"qgisRelation\" >\n"
" <string notr=\"true\"></string>\n"
" </property>\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>27</width>\n"
" <height>27</height>\n"
" </rect>\n"
" </property>\n"
" </widget>\n"
"</ui>\n" )
.arg( name() );
}
48 changes: 48 additions & 0 deletions src/customwidgets/qgsrelationeditorwidgetplugin.h
@@ -0,0 +1,48 @@
/***************************************************************************
qgsrelationeditorwidgetplugin.h
--------------------------------------
Date : 20.08.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 QGSRELATIONEDITORWIDGETPLUGIN_H
#define QGSRELATIONEDITORWIDGETPLUGIN_H

#include <QDesignerExportWidget>
#include <QDesignerCustomWidgetInterface>


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

public:
explicit QgsRelationEditorWidgetPlugin( 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 // QGSRELATIONEDITORWIDGETPLUGIN_H
1 change: 1 addition & 0 deletions src/gui/attributetable/qgsdualview.h
Expand Up @@ -42,6 +42,7 @@ class QgsMapLayerAction;
class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBase
{
Q_OBJECT
Q_ENUMS(ViewMode)

public:

Expand Down

0 comments on commit 482fa44

Please sign in to comment.