Skip to content
Permalink
Browse files

add QgsFeaturePickerWidget to custom widgets (#36119)

  • Loading branch information
3nids committed May 1, 2020
1 parent e85c656 commit bf04b0ca98a6442a259e84f43e967f60b64620ab
@@ -34,12 +34,12 @@ for i in "${EXT[@]}"
do
DESTFILE=$DIR/../src/customwidgets/${CLASSLOWER}plugin.$i
cp "$DIR"/customwidget."$i".template "$DESTFILE"
${GP}sed -i s/%DATE%/${TODAY}/g ${DESTFILE}
${GP}sed -i s/%YEAR%/${YEAR}/g ${DESTFILE}
${GP}sed -i s/%AUTHOR%/${AUTHOR}/g ${DESTFILE}
${GP}sed -i s/%EMAIL%/${EMAIL}/g ${DESTFILE}
${GP}sed -i s/%CLASSUPPERCASE%/${CLASSUPPER}/g ${DESTFILE}
${GP}sed -i s/%CLASSLOWERCASE%/${CLASSLOWER}/g ${DESTFILE}
${GP}sed -i s/%CLASSMIXEDCASE%/${CLASSNAME}/g ${DESTFILE}
${GP}sed -i s/%CLASSWITHOUTQGS%/${CLASSWITHOUTQGS}/g ${DESTFILE}
${GP}sed -i "s/%DATE%/${TODAY}/g" ${DESTFILE}
${GP}sed -i "s/%YEAR%/${YEAR}/g" ${DESTFILE}
${GP}sed -i "s/%AUTHOR%/${AUTHOR}/g" ${DESTFILE}
${GP}sed -i "s/%EMAIL%/${EMAIL}/g" ${DESTFILE}
${GP}sed -i "s/%CLASSUPPERCASE%/${CLASSUPPER}/g" ${DESTFILE}
${GP}sed -i "s/%CLASSLOWERCASE%/${CLASSLOWER}/g" ${DESTFILE}
${GP}sed -i "s/%CLASSMIXEDCASE%/${CLASSNAME}/g" ${DESTFILE}
${GP}sed -i "s/%CLASSWITHOUTQGS%/${CLASSWITHOUTQGS}/g" ${DESTFILE}
done
@@ -23,6 +23,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsextentgroupboxplugin.cpp
qgsexternalresourcewidgetplugin.cpp
qgsfeaturelistcomboboxplugin.cpp
qgsfeaturepickerwidgetplugin.cpp
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsfilewidgetplugin.cpp
@@ -56,6 +57,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsextentgroupboxplugin.h
qgsexternalresourcewidgetplugin.h
qgsfeaturelistcomboboxplugin.h
qgsfeaturepickerwidgetplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilewidgetplugin.h
@@ -27,6 +27,7 @@
#include "qgsextentgroupboxplugin.h"
#include "qgsexternalresourcewidgetplugin.h"
#include "qgsfeaturelistcomboboxplugin.h"
#include "qgsfeaturepickerwidgetplugin.h"
#include "qgsfieldcomboboxplugin.h"
#include "qgsfieldexpressionwidgetplugin.h"
#include "qgsfilewidgetplugin.h"
@@ -60,6 +61,7 @@ QgisCustomWidgets::QgisCustomWidgets( QObject *parent )
mWidgets.append( new QgsExtentGroupBoxPlugin( this ) );
mWidgets.append( new QgsExternalResourceWidgetPlugin( this ) );
mWidgets.append( new QgsFeatureListComboBoxPlugin( this ) );
mWidgets.append( new QgsFeaturePickerWidgetPlugin( this ) );
mWidgets.append( new QgsFieldComboBoxPlugin( this ) );
mWidgets.append( new QgsFieldExpressionWidgetPlugin( this ) );
mWidgets.append( new QgsFileWidgetPlugin( this ) );
@@ -0,0 +1,96 @@
/***************************************************************************
qgsfeaturepickerwidgetplugin.cpp
--------------------------------------
Date : 01.05.2020
Copyright : (C) 2020 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 "qgsfeaturepickerwidgetplugin.h"
#include "qgsfeaturepickerwidget.h"


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

QString QgsFeaturePickerWidgetPlugin::name() const
{
return "QgsFeaturePickerWidget";
}

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

QString QgsFeaturePickerWidgetPlugin::includeFile() const
{
return "qgsfeaturepickerwidget.h";
}

QIcon QgsFeaturePickerWidgetPlugin::icon() const
{
return QIcon( ":/images/icons/qgis-icon-60x60.png" );
}

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

QWidget *QgsFeaturePickerWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsFeaturePickerWidget( parent );
}

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

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


QString QgsFeaturePickerWidgetPlugin::toolTip() const
{
return "";
}

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

QString QgsFeaturePickerWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mFeaturePickerWidget\">\n"
" <property name=\"geometry\">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>90</width>\n"
" <height>27</height>\n"
" </rect>\n"
" </property>\n"
" </widget>\n"
"</ui>\n" )
.arg( name() );
}
@@ -0,0 +1,51 @@
/***************************************************************************
qgsfeaturepickerwidgetplugin.h
--------------------------------------
Date : 01.05.2020
Copyright : (C) 2020 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 QGSFEATUREPICKERWIDGETPLUGIN_H
#define QGSFEATUREPICKERWIDGETPLUGIN_H


#include <QtGlobal>
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include <QtUiPlugin/QDesignerExportWidget>
#include "qgis_customwidgets.h"


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

public:
explicit QgsFeaturePickerWidgetPlugin( QObject *parent = nullptr );

private:
bool mInitialized;

// QDesignerCustomWidgetInterface interface
public:
QString name() const override;
QString group() const override;
QString includeFile() const override;
QIcon icon() const override;
bool isContainer() const override;
QWidget *createWidget( QWidget *parent ) override;
bool isInitialized() const override;
void initialize( QDesignerFormEditorInterface *core ) override;
QString toolTip() const override;
QString whatsThis() const override;
QString domXml() const override;
};
#endif // QGSFEATUREPICKERWIDGETPLUGIN_H

0 comments on commit bf04b0c

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