Skip to content
Permalink
Browse files

Start on classes for dev tool widgets and dev tool widget factory

  • Loading branch information
nyalldawson committed Mar 25, 2020
1 parent c10f39f commit bab86e9af3ffe5499ece6a75ed2c466896f6af8d
@@ -103,6 +103,7 @@ IF(WITH_APIDOC)
${CMAKE_SOURCE_DIR}/src/gui/auth
${CMAKE_SOURCE_DIR}/src/gui/attributetable
${CMAKE_SOURCE_DIR}/src/gui/callouts
${CMAKE_SOURCE_DIR}/src/gui/devtools
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets/core
${CMAKE_SOURCE_DIR}/src/gui/effects
@@ -141,6 +141,7 @@ IF (WITH_GUI)
${CMAKE_SOURCE_DIR}/src/gui/raster
${CMAKE_SOURCE_DIR}/src/gui/attributetable
${CMAKE_SOURCE_DIR}/src/gui/auth
${CMAKE_SOURCE_DIR}/src/gui/devtools
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets/core
${CMAKE_SOURCE_DIR}/src/gui/effects
@@ -0,0 +1,36 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/devtools/qgsdevtoolwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsDevToolWidget : QgsPanelWidget
{
%Docstring
A panel widget that can be shown in the developer tools panel.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsdevtoolwidget.h"
%End
public:

QgsDevToolWidget( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsDevToolWidget, with the specified ``parent`` widget.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/devtools/qgsdevtoolwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,73 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/devtools/qgsdevtoolwidgetfactory.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsDevToolWidgetFactory
{
%Docstring
Factory class for creating custom developer/debugging tool pages

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsdevtoolwidgetfactory.h"
%End
public:

QgsDevToolWidgetFactory( const QString &title = QString(), const QIcon &icon = QIcon() );
%Docstring
Constructor for a QgsDevToolWidgetFactory with the specified ``title`` and ``icon``.
%End

virtual ~QgsDevToolWidgetFactory();

virtual QIcon icon() const;
%Docstring
Returns the icon that will be shown in the tool in the panel.

.. seealso:: :py:func:`setIcon`
%End

void setIcon( const QIcon &icon );
%Docstring
Sets the ``icon`` for the factory object, which will be shown for the tool in the panel.

.. seealso:: :py:func:`icon`
%End

virtual QString title() const;
%Docstring
Returns the (translated) title of the tool.

.. seealso:: :py:func:`setTitle`
%End

void setTitle( const QString &title );
%Docstring
Set the translated ``title`` for the tool.
%End

virtual QgsDevToolWidget *createWidget( QWidget *parent = 0 ) const = 0 /Factory/;
%Docstring
Factory function to create the widget on demand as needed by the dock.

The ``parent`` argument gives the correct parent for the newly created widget.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/devtools/qgsdevtoolwidgetfactory.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -108,7 +108,7 @@ Check if the layer is supported for this widget.
:return: ``True`` if this layer is supported for this widget
%End

virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent /TransferThis/ = 0 ) const = 0 /Factory/;
virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent = 0 ) const = 0 /Factory/;
%Docstring
Factory function to create the widget on demand as needed by the dock.

@@ -241,6 +241,8 @@
%Include auto_generated/auth/qgsauthsslimportdialog.sip
%Include auto_generated/auth/qgsauthtrustedcasdialog.sip
%Include auto_generated/callouts/qgscalloutwidget.sip
%Include auto_generated/devtools/qgsdevtoolwidget.sip
%Include auto_generated/devtools/qgsdevtoolwidgetfactory.sip
%Include auto_generated/editorwidgets/core/qgseditorconfigwidget.sip
%Include auto_generated/editorwidgets/core/qgseditorwidgetautoconf.sip
%Include auto_generated/editorwidgets/core/qgseditorwidgetfactory.sip
@@ -409,6 +409,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/symbology
${CMAKE_SOURCE_DIR}/src/gui/attributetable
${CMAKE_SOURCE_DIR}/src/gui/auth
${CMAKE_SOURCE_DIR}/src/gui/devtools
${CMAKE_SOURCE_DIR}/src/gui/labeling
${CMAKE_SOURCE_DIR}/src/gui/numericformats
${CMAKE_SOURCE_DIR}/src/gui/ogr
@@ -112,6 +112,9 @@ SET(QGIS_GUI_SRCS
auth/qgsauthsslimportdialog.cpp
auth/qgsauthtrustedcasdialog.cpp

devtools/qgsdevtoolwidget.cpp
devtools/qgsdevtoolwidgetfactory.cpp

editorwidgets/core/qgseditorconfigwidget.cpp
editorwidgets/core/qgseditorwidgetautoconf.cpp
editorwidgets/core/qgseditorwidgetfactory.cpp
@@ -793,6 +796,9 @@ SET(QGIS_GUI_HDRS

callouts/qgscalloutwidget.h

devtools/qgsdevtoolwidget.h
devtools/qgsdevtoolwidgetfactory.h

editorwidgets/core/qgseditorconfigwidget.h
editorwidgets/core/qgseditorwidgetautoconf.h
editorwidgets/core/qgseditorwidgetfactory.h
@@ -1163,6 +1169,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/symbology
${CMAKE_SOURCE_DIR}/src/gui/attributetable
${CMAKE_SOURCE_DIR}/src/gui/auth
${CMAKE_SOURCE_DIR}/src/gui/devtools
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets/core
${CMAKE_SOURCE_DIR}/src/gui/effects
@@ -0,0 +1,21 @@
/***************************************************************************
qgsdevtoolwidget.cpp
--------------------
Date : March 2020
Copyright : (C) 2020 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 "qgsdevtoolwidget.h"

QgsDevToolWidget::QgsDevToolWidget( QWidget *parent )
: QgsPanelWidget( parent )
{

}
@@ -0,0 +1,40 @@
/***************************************************************************
qgsdevtoolwidget.h
------------------
Date : March 2020
Copyright : (C) 2020 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 QGSDEVTOOLWIDGET_H
#define QGSDEVTOOLWIDGET_H

#include "qgspanelwidget.h"
#include "qgis_sip.h"
#include "qgis_gui.h"

/**
* \ingroup gui
* \class QgsDevToolWidget
* \brief A panel widget that can be shown in the developer tools panel.
* \since QGIS 3.14
*/
class GUI_EXPORT QgsDevToolWidget : public QgsPanelWidget
{
Q_OBJECT
public:

/**
* Constructor for QgsDevToolWidget, with the specified \a parent widget.
*/
QgsDevToolWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );

};

#endif // QGSDEVTOOLWIDGET_H
@@ -0,0 +1,22 @@
/***************************************************************************
qgsdevtoolwidgetfactory.cpp
--------------------------
Date : March 2020
Copyright : (C) 2020 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 "qgsdevtoolwidgetfactory.h"

QgsDevToolWidgetFactory::QgsDevToolWidgetFactory( const QString &title, const QIcon &icon )
: mIcon( icon )
, mTitle( title )
{
}
@@ -0,0 +1,79 @@
/***************************************************************************
qgsdevtoolwidgetfactory.h
------------------------
Date : March 2020
Copyright : (C) 2020 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 QGSDEVTOOLWIDGETFACTORY_H
#define QGSDEVTOOLWIDGETFACTORY_H

#include "qgis_gui.h"
#include "qgis_sip.h"
#include <QString>
#include <QIcon>

class QgsDevToolWidget;
class QWidget;

/**
* \ingroup gui
* \class QgsDevToolWidgetFactory
* Factory class for creating custom developer/debugging tool pages
* \since QGIS 3.14
*/
class GUI_EXPORT QgsDevToolWidgetFactory
{
public:

/**
* Constructor for a QgsDevToolWidgetFactory with the specified \a title and \a icon.
*/
QgsDevToolWidgetFactory( const QString &title = QString(), const QIcon &icon = QIcon() );

virtual ~QgsDevToolWidgetFactory() = default;

/**
* Returns the icon that will be shown in the tool in the panel.
* \see setIcon()
*/
virtual QIcon icon() const { return mIcon; }

/**
* Sets the \a icon for the factory object, which will be shown for the tool in the panel.
* \see icon()
*/
void setIcon( const QIcon &icon ) { mIcon = icon; }

/**
* Returns the (translated) title of the tool.
* \see setTitle()
*/
virtual QString title() const { return mTitle; }

/**
* Set the translated \a title for the tool.
*/
void setTitle( const QString &title ) { mTitle = title; }

/**
* Factory function to create the widget on demand as needed by the dock.
*
* The \a parent argument gives the correct parent for the newly created widget.
*/
virtual QgsDevToolWidget *createWidget( QWidget *parent = nullptr ) const = 0 SIP_FACTORY;

private:
QIcon mIcon;
QString mTitle;
};

#endif // QGSDEVTOOLWIDGETFACTORY_H
@@ -110,7 +110,7 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
* \returns A new QgsMapStylePanel which is shown in the map style dock.
* \note This function is called each time the panel is selected. Keep it light for better UX.
*/
virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent SIP_TRANSFERTHIS = nullptr ) const = 0 SIP_FACTORY;
virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent = nullptr ) const = 0 SIP_FACTORY;

private:
QIcon mIcon;

0 comments on commit bab86e9

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