Skip to content
Permalink
Browse files

custom widget for relation reference widget

  • Loading branch information
3nids committed Aug 18, 2014
1 parent 8953a80 commit 4cfe24aea9925afe05d4df65a6aeddc84ab3b1d2
@@ -14,27 +14,29 @@ ENDIF (WIN32)
# Files

SET (QGIS_CUSTOMWIDGETS_SRCS
qgiscustomwidgets.cpp
qgscollapsiblegroupboxplugin.cpp
qgscolorbuttonplugin.cpp
qgscolorbuttonv2plugin.cpp
qgsdatadefinedbuttonplugin.cpp
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsscalerangewidgetplugin.cpp
qgiscustomwidgets.cpp
qgscollapsiblegroupboxplugin.cpp
qgscolorbuttonplugin.cpp
qgscolorbuttonv2plugin.cpp
qgsdatadefinedbuttonplugin.cpp
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsrelationreferencewidgetplugin.cpp
qgsscalerangewidgetplugin.cpp
)

SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgiscustomwidgets.h
qgscollapsiblegroupboxplugin.h
qgscolorbuttonplugin.h
qgscolorbuttonv2plugin.h
qgsdatadefinedbuttonplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsmaplayercomboboxplugin.h
qgsscalerangewidgetplugin.h
qgiscustomwidgets.h
qgscollapsiblegroupboxplugin.h
qgscolorbuttonplugin.h
qgscolorbuttonv2plugin.h
qgsdatadefinedbuttonplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsmaplayercomboboxplugin.h
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
)

QT4_WRAP_CPP(QGIS_CUSTOMWIDGETS_MOC_SRCS ${QGIS_CUSTOMWIDGETS_MOC_HDRS})
@@ -54,6 +56,7 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsmaplayercomboboxplugin.h
qgsrelationreferencewidgetplugin.h
qgsscalerangewidgetplugin.h
)

@@ -65,7 +68,9 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core/
${CMAKE_CURRENT_SOURCE_DIR}/../core/symbology-ng/
${CMAKE_CURRENT_SOURCE_DIR}/../gui/
${CMAKE_CURRENT_SOURCE_DIR}/../gui/editorwidgets/
# ${CMAKE_CURRENT_BINARY_DIR}/../ui (no UI file yet)
)

@@ -0,0 +1,97 @@
/***************************************************************************
qgsrelationreferencewidgetplugin.cpp
--------------------------------------
Date : 18.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 "qgsrelationreferencewidgetplugin.h"
#include "qgsrelationreferencewidget.h"


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


QString QgsRelationReferenceWidgetPlugin::name() const
{
return "QgsRelationReferenceWidget";
}

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

QString QgsRelationReferenceWidgetPlugin::includeFile() const
{
return "qgsrelationreferencewidget.h";
}

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

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

QWidget *QgsRelationReferenceWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsRelationReferenceWidget( parent );
}

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

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


QString QgsRelationReferenceWidgetPlugin::toolTip() const
{
return "Select color";
}

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

QString QgsRelationReferenceWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mColorButton\">\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() );
}
@@ -0,0 +1,48 @@
/***************************************************************************
qgsrelationreferencewidgetplugin.h
--------------------------------------
Date : 18.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 QGSRELATIONREFERENCEWIDGETPLUGIN_H
#define QGSRELATIONREFERENCEWIDGETPLUGIN_H

#include <QDesignerExportWidget>
#include <QDesignerCustomWidgetInterface>


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

public:
explicit QgsRelationReferenceWidgetPlugin( 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 // QGSRELATIONREFERENCEWIDGETPLUGIN_H

0 comments on commit 4cfe24a

Please sign in to comment.
You can’t perform that action at this time.