Skip to content
Permalink
Browse files

add custom widgets for QgsExternalResourceWidget and QgsFilePickerWidget

  • Loading branch information
3nids committed Jan 13, 2016
1 parent 3ce6454 commit 586b6072455a4119d463c10dac6ef6f42d196f9f
@@ -31,8 +31,10 @@ SET (QGIS_CUSTOMWIDGETS_SRCS
qgsdoublespinboxplugin.cpp
qgsexpressionbuilderwidgetplugin.cpp
qgsextentgroupboxplugin.cpp
qgsexternalresourcewidgetplugin.cpp
qgsfieldcomboboxplugin.cpp
qgsfieldexpressionwidgetplugin.cpp
qgsfilepickerwidgetplugin.cpp
qgsfilterlineeditplugin.cpp
qgsmaplayercomboboxplugin.cpp
qgsprojectionselectionwidgetplugin.cpp
@@ -53,8 +55,10 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS
qgsdoublespinboxplugin.h
qgsexpressionbuilderwidgetplugin.h
qgsextentgroupboxplugin.h
qgsexternalresourcewidgetplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilepickerwidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsprojectionselectionwidgetplugin.h
@@ -81,8 +85,10 @@ SET(QGIS_CUSTOMWIDGETS_HDRS
qgsdoublespinboxplugin.h
qgsexpressionbuilderwidgetplugin.h
qgsextentgroupboxplugin.h
qgsexternalresourcewidgetplugin.h
qgsfieldcomboboxplugin.h
qgsfieldexpressionwidgetplugin.h
qgsfilepickerwidgetplugin.h
qgsfilterlineeditplugin.h
qgsmaplayercomboboxplugin.h
qgsprojectionselectionwidgetplugin.h
@@ -0,0 +1,96 @@
/***************************************************************************
qgsexternalresourcewidgetplugin.cpp
--------------------------------------
Date : 13.01.2016
Copyright : (C) 2016 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 "qgsexternalresourcewidgetplugin.h"
#include "qgsexternalresourcewidget.h"


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

QString QgsExternalResourceWidgetPlugin::name() const
{
return "QgsExternalResourceWidget";
}

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

QString QgsExternalResourceWidgetPlugin::includeFile() const
{
return "qgsexternalresourcewidget.h";
}

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

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

QWidget *QgsExternalResourceWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsExternalResourceWidget( parent );
}

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

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


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

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

QString QgsExternalResourceWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mQgsExternalResourceWidget\">\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,55 @@
/***************************************************************************
qgsexternalresourcewidgetplugin.h
--------------------------------------
Date : 13.01.2016
Copyright : (C) 2016 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 QGSEXTERNALRESOURCEWIDGETPLUGIN_H
#define QGSEXTERNALRESOURCEWIDGETPLUGIN_H


#include <QtGlobal>
#if QT_VERSION < 0x050000
#include <QDesignerCustomWidgetCollectionInterface>
#include <QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include <QtUiPlugin/QDesignerExportWidget>
#endif


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

public:
explicit QgsExternalResourceWidgetPlugin( QObject *parent = 0 );

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 // QGSEXTERNALRESOURCEWIDGETPLUGIN_H
@@ -0,0 +1,96 @@
/***************************************************************************
qgsfilepickerwidgetplugin.cpp
--------------------------------------
Date : 13.01.2016
Copyright : (C) 2016 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 "qgsfilepickerwidgetplugin.h"
#include "qgsfilepickerwidget.h"


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

QString QgsFilePickerWidgetPlugin::name() const
{
return "QgsFilePickerWidget";
}

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

QString QgsFilePickerWidgetPlugin::includeFile() const
{
return "qgsfilepickerwidget.h";
}

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

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

QWidget *QgsFilePickerWidgetPlugin::createWidget( QWidget *parent )
{
return new QgsFilePickerWidget( parent );
}

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

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


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

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

QString QgsFilePickerWidgetPlugin::domXml() const
{
return QString( "<ui language=\"c++\">\n"
" <widget class=\"%1\" name=\"mQgsFilePickerWidget\">\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,55 @@
/***************************************************************************
qgsfilepickerwidgetplugin.h
--------------------------------------
Date : 13.01.2016
Copyright : (C) 2016 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 QGSFILEPICKERWIDGETPLUGIN_H
#define QGSFILEPICKERWIDGETPLUGIN_H


#include <QtGlobal>
#if QT_VERSION < 0x050000
#include <QDesignerCustomWidgetCollectionInterface>
#include <QDesignerExportWidget>
#else
#include <QtUiPlugin/QDesignerCustomWidgetInterface>
#include <QtUiPlugin/QDesignerExportWidget>
#endif


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

public:
explicit QgsFilePickerWidgetPlugin( QObject *parent = 0 );

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 // QGSFILEPICKERWIDGETPLUGIN_H

0 comments on commit 586b607

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