Skip to content

Commit f8f7d60

Browse files
authored
Merge pull request #4514 from nyalldawson/gui_instance
Make a new global QgsGui singleton
2 parents c3c694f + a8b10a2 commit f8f7d60

File tree

161 files changed

+650
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+650
-431
lines changed

cmake/FindQGIS.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ ELSE(WIN32)
142142
# also get other frameworks' headers folders on OS X
143143
IF (APPLE)
144144
FIND_PATH(QGIS_GUI_INCLUDE_DIR
145-
NAMES qgisgui.h
145+
NAMES qgsguiutils.h
146146
PATHS
147147
${QGIS_BUILD_PATH}/output/lib
148148
${QGIS_MAC_PATH}/Frameworks

doc/api_break.dox

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
6363
<table>
6464
<caption id="renamed_classes">Renamed classes</caption>
6565
<tr><th>API 2.x<th>API 3.X
66+
<tr><td>QgisGui<td>QgsGuiUtils
6667
<tr><td>QgsAttributeAction<td>QgsActionManager
6768
<tr><td>QgsAbstractGeometryV2<td>QgsAbstractGeometry
6869
<tr><td>QgsCategorizedSymbolRendererV2<td>QgsCategorizedSymbolRenderer
@@ -1011,7 +1012,7 @@ QgsEditFormConfig {#qgis_api_break_3_0_QgsEditFormConfig}
10111012

10121013
- Does no longer inherit QObject
10131014
- widgetType() and widgetConfig() now reflect only the user configured values.
1014-
QgsEditorWidgetRegistry::instance()->findBest() must be used instead.
1015+
QgsEditorWidgetRegistry::findBest() must be used instead.
10151016
- widgetConfig(), setWidgetType(), setWidgetConfig() and removeWidgetConfig() now only take a string as first parameter. Access by index has been removed.
10161017
- widgetType() has been removed in favor of QgsVectorLayer::editorWidgetSetup()
10171018
- expression(), setExpression(), expressionDescription() and setExpressionDescription()
@@ -1213,6 +1214,7 @@ plugins calling this method will need to be updated.
12131214
QgsEditorWidgetRegistry {#qgis_api_break_3_0_QgsEditorWidgetRegistry}
12141215
-----------------------
12151216

1217+
- The instance() singleton was removed. Use QgsGui::editorWidgetRegistry() instead.
12161218
- The signature of isFieldSupported() has been changed to return an unsigned
12171219
integer (how good it supports the given field) and is now const.
12181220

@@ -1307,6 +1309,12 @@ QgsLayerPropertiesWidget {#qgis_api_break_3_0_QgsLayerPropertiesWidget}
13071309
- expressionContext(), setExpressionContext(), setMapCanvas() and mapCanvas() have been removed in favor of setContext()/context()
13081310

13091311

1312+
QgsLayerTreeEmbeddedWidgetRegistry {#qgis_api_break_3_0_QgsLayerTreeEmbeddedWidgetRegistry}
1313+
----------------------------------
1314+
1315+
- QgsLayerTreeEmbeddedWidgetRegistry::instance() has been removed. Use QgsGui::layerTreeEmbeddedWidgetRegistry() instead.
1316+
1317+
13101318
QgsLayerTreeGroup {#qgis_api_break_3_0_QgsLayerTreeGroup}
13111319
-----------------
13121320

@@ -1438,6 +1446,13 @@ screenUpdateRequested() were removed. These members have had no effect for a num
14381446
- the invalidTransformInput() slot was removed - calling this slot had no effect
14391447
- metadata() was renamed to htmlMetadata()
14401448

1449+
1450+
QgsMapLayerActionRegistry {#qgis_api_break_3_0_QgsMapLayerActionRegistry}
1451+
-------------------------
1452+
1453+
- This class is no longer a singleton and instance() has been removed. Instead use QgsGui::mapLayerActionRegistry().
1454+
1455+
14411456
QgsMapOverviewCanvas {#qgis_api_break_3_0_QgsMapOverviewCanvas}
14421457
--------------------
14431458

@@ -1822,10 +1837,10 @@ QgsRenderChecker {#qgis_api_break_3_0_QgsRenderChecker}
18221837
setExcludeAttributesWms()
18231838
- excludeAttributesWFS() and setExcludeAttributesWFS() have been renamed to excludeAttributesWfs() and
18241839
setExcludeAttributesWfs()
1825-
- editorWidgetV2() and editorWidgetV2Config() have been removed and QgsEditorWidgetRegistry::instance()->findBest() must be used instead.
1840+
- editorWidgetV2() and editorWidgetV2Config() have been removed and QgsEditorWidgetRegistry::findBest() must be used instead.
18261841
- setEditorWidgetV2(), setEditorWidgetV2Config() have been removed and their equivalent in editFormConfig() must be used instead.
18271842
- setCheckedState() is removed. Use `editFormConfig()->setWidgetConfig()` instead.
1828-
- valueMap(), valueRelation(), dateFormat(), widgetSize() have been removed. Use QgsEditorWidgetRegistry::instance()->findBest().config() instead.
1843+
- valueMap(), valueRelation(), dateFormat(), widgetSize() have been removed. Use QgsEditorWidgetRegistry::findBest().config() instead.
18291844

18301845

18311846
QgsRenderContext {#qgis_api_break_3_0_QgsRenderContext}
@@ -1909,6 +1924,10 @@ QgsServer {#qgis_api_break_3_0_QgsServer}
19091924
- QgsServer::handleRequest( const QString &urlstr ) has been removed in favour of the new
19101925
- QgsServer::handleRequest( QgsServerRequest &request, QgsServerResponse &response ) has been added
19111926

1927+
QgsShortcutsManager {#qgis_api_break_3_0_QgsShortcutsManager}
1928+
-------------------
1929+
1930+
- QgsShortcutsManager::instance() was removed. Use QgsGui::shortcutsManager() instead.
19121931

19131932

19141933
QgsSimpleMarkerSymbolLayer {#qgis_api_break_3_0_QgsSimpleMarkerSymbolLayer}

python/gui/editorwidgets/core/qgseditorwidgetregistry.sip

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@
1313
class QgsEditorWidgetRegistry : QObject
1414
{
1515
%Docstring
16-
This class manages all known edit widget factories
16+
This class manages all known edit widget factories.
17+
18+
QgsEditorWidgetRegistry is not usually directly created, but rather accessed through
19+
QgsGui.editorWidgetRegistry().
1720
%End
1821

1922
%TypeHeaderCode
2023
#include "qgseditorwidgetregistry.h"
2124
%End
2225
public:
2326

24-
static QgsEditorWidgetRegistry *instance();
27+
QgsEditorWidgetRegistry();
2528
%Docstring
26-
This class is a singleton and has therefore to be accessed with this method instead
27-
of a constructor.
28-
29-
:return: The one and only instance of the editor widget registry
30-
:rtype: QgsEditorWidgetRegistry
29+
Constructor for QgsEditorWidgetRegistry. QgsEditorWidgetRegistry is not usually directly created, but rather accessed through
30+
QgsGui.editorWidgetRegistry().
3131
%End
3232

33-
static void initEditors( QgsMapCanvas *mapCanvas = 0, QgsMessageBar *messageBar = 0 );
33+
void initEditors( QgsMapCanvas *mapCanvas = 0, QgsMessageBar *messageBar = 0 );
3434
%Docstring
3535
Registers all the default widgets.
3636
Only call this once on startup of an application.
@@ -171,9 +171,6 @@ class QgsEditorWidgetRegistry : QObject
171171
\param plugin The plugin (ownership is transferred)
172172
%End
173173

174-
protected:
175-
QgsEditorWidgetRegistry();
176-
177174
};
178175

179176
/************************************************************************

python/gui/gui.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
%Include qgsfloatingwidget.sip
8282
%Include qgsfocuswatcher.sip
8383
%Include qgsformannotation.sip
84+
%Include qgsgui.sip
8485
%Include qgsgeometryrubberband.sip
8586
%Include qgsgradientcolorrampdialog.sip
8687
%Include qgsgradientstopeditor.sip

python/gui/layertree/qgslayertreeembeddedwidgetregistry.sip

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ class QgsLayerTreeEmbeddedWidgetRegistry
4747

4848
public:
4949

50-
/** Means of accessing canonical single instance */
51-
static QgsLayerTreeEmbeddedWidgetRegistry *instance();
50+
QgsLayerTreeEmbeddedWidgetRegistry();
5251

5352
~QgsLayerTreeEmbeddedWidgetRegistry();
5453

@@ -66,10 +65,6 @@ class QgsLayerTreeEmbeddedWidgetRegistry
6665
* Returns true on success, false if the provider was not registered. */
6766
bool removeProvider( const QString &providerId );
6867

69-
protected:
70-
//! Protected constructor - use instance() to access the registry.
71-
QgsLayerTreeEmbeddedWidgetRegistry();
72-
7368
private:
7469

7570
QgsLayerTreeEmbeddedWidgetRegistry( const QgsLayerTreeEmbeddedWidgetRegistry &other );

python/gui/qgsbusyindicatordialog.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class QgsBusyIndicatorDialog : QDialog
1515
* @param parent parent object (owner)
1616
* @param fl widget flags
1717
*/
18-
QgsBusyIndicatorDialog( const QString &message = "", QWidget *parent /TransferThis/ = 0, const Qt::WindowFlags &fl = QgisGui::ModalDialogFlags );
18+
QgsBusyIndicatorDialog( const QString &message = "", QWidget *parent /TransferThis/ = 0, const Qt::WindowFlags &fl = QgsGuiUtils::ModalDialogFlags );
1919
~QgsBusyIndicatorDialog();
2020

2121
QString message() const;

python/gui/qgscharacterselectdialog.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class QgsCharacterSelectorDialog : QDialog
44
#include <qgscharacterselectdialog.h>
55
%End
66
public:
7-
QgsCharacterSelectorDialog( QWidget *parent /TransferThis/ = 0, const Qt::WindowFlags &fl = QgisGui::ModalDialogFlags );
7+
QgsCharacterSelectorDialog( QWidget *parent /TransferThis/ = 0, const Qt::WindowFlags &fl = QgsGuiUtils::ModalDialogFlags );
88
~QgsCharacterSelectorDialog();
99

1010
public slots:

python/gui/qgscolordialog.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class QgsColorDialog : QDialog
2323
%End
2424
public:
2525

26-
QgsColorDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags,
26+
QgsColorDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
2727
const QColor &color = QColor() );
2828
%Docstring
2929
Create a new color picker dialog

python/gui/qgscredentialdialog.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class QgsCredentialDialog : QDialog, QgsCredentials
2020
#include "qgscredentialdialog.h"
2121
%End
2222
public:
23-
QgsCredentialDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
23+
QgsCredentialDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
2424
%Docstring
2525
QgsCredentialDialog constructor
2626
%End

python/gui/qgsdialog.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class QgsDialog : QDialog
2121
%End
2222
public:
2323

24-
QgsDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags,
24+
QgsDialog( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags,
2525
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Close,
2626
Qt::Orientation orientation = Qt::Horizontal );
2727
%Docstring

0 commit comments

Comments
 (0)