diff --git a/src/customwidgets/CMakeLists.txt b/src/customwidgets/CMakeLists.txt index dcb599118d41..b3ec119952f3 100644 --- a/src/customwidgets/CMakeLists.txt +++ b/src/customwidgets/CMakeLists.txt @@ -32,6 +32,7 @@ SET (QGIS_CUSTOMWIDGETS_SRCS qgsrelationreferencewidgetplugin.cpp qgsscalerangewidgetplugin.cpp qgsscalewidgetplugin.cpp + qgsscrollareawidgetplugin.cpp qgsspinboxplugin.cpp ) @@ -57,6 +58,7 @@ SET (QGIS_CUSTOMWIDGETS_MOC_HDRS qgsrelationreferencewidgetplugin.h qgsscalerangewidgetplugin.h qgsscalewidgetplugin.h + qgsscrollareawidgetplugin.h qgsspinboxplugin.h ) diff --git a/src/customwidgets/qgsscrollareawidgetplugin.cpp b/src/customwidgets/qgsscrollareawidgetplugin.cpp new file mode 100644 index 000000000000..27b82ee09f42 --- /dev/null +++ b/src/customwidgets/qgsscrollareawidgetplugin.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + qgsscrollareawidgetplugin.cpp + -------------------------------------- + Date : March 2017 + Copyright : (C) 2017 Nyall Dawson + Email : nyall dot dawson at gmail dot 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 "qgsscrollareawidgetplugin.h" +#include "qgsscrollarea.h" + + +QgsScrollAreaWidgetPlugin::QgsScrollAreaWidgetPlugin( QObject *parent ) + : QObject( parent ) +{} + +QString QgsScrollAreaWidgetPlugin::name() const +{ + return "QgsScrollArea"; +} + +QString QgsScrollAreaWidgetPlugin::group() const +{ + return QgisCustomWidgets::groupName(); +} + +QString QgsScrollAreaWidgetPlugin::includeFile() const +{ + return "qgsscrollarea.h"; +} + +QIcon QgsScrollAreaWidgetPlugin::icon() const +{ + return QIcon( ":/images/icons/qgis-icon-60x60.png" ); +} + +bool QgsScrollAreaWidgetPlugin::isContainer() const +{ + return true; +} + +QWidget *QgsScrollAreaWidgetPlugin::createWidget( QWidget *parent ) +{ + return new QgsScrollArea( parent ); +} + +bool QgsScrollAreaWidgetPlugin::isInitialized() const +{ + return mInitialized; +} + +void QgsScrollAreaWidgetPlugin::initialize( QDesignerFormEditorInterface *core ) +{ + Q_UNUSED( core ); + if ( mInitialized ) + return; + mInitialized = true; +} + + +QString QgsScrollAreaWidgetPlugin::toolTip() const +{ + return tr( "Scroll area" ); +} + +QString QgsScrollAreaWidgetPlugin::whatsThis() const +{ + return ""; +} + +QString QgsScrollAreaWidgetPlugin::domXml() const +{ + return QString( "\n" + " \n" + " \n" + " \n" + " 0\n" + " 0\n" + " 300\n" + " 100\n" + " \n" + " \n" + " \n" + "\n" ) + .arg( name() ); +} diff --git a/src/customwidgets/qgsscrollareawidgetplugin.h b/src/customwidgets/qgsscrollareawidgetplugin.h new file mode 100644 index 000000000000..24e6e3ff9738 --- /dev/null +++ b/src/customwidgets/qgsscrollareawidgetplugin.h @@ -0,0 +1,50 @@ +/*************************************************************************** + qgsscrollareawidgetplugin.h + -------------------------------------- + Date : March 2017 + Copyright : (C) 2017 Nyall Dawson + Email : nyall dot dawson at gmail dot 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 QGSSCROLLAREAWIDGETPLUGIN_H +#define QGSSCROLLAREAWIDGETPLUGIN_H + + +#include +#include +#include +#include "qgis_customwidgets.h" + +class CUSTOMWIDGETS_EXPORT QgsScrollAreaWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES( QDesignerCustomWidgetInterface ) + + public: + explicit QgsScrollAreaWidgetPlugin( QObject *parent = 0 ); + + private: + bool mInitialized = false; + + // 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 // QGSSCROLLAREAWIDGETPLUGIN_H