Skip to content

Commit 4a5c9a7

Browse files
committed
Make a new global QgsGui singleton
Move QgsEditorWidgetRegistry from being a singleton itself to instead being a member of the QgsGui singleton
1 parent 280ca31 commit 4a5c9a7

36 files changed

+278
-117
lines changed

doc/api_break.dox

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ QgsEditFormConfig {#qgis_api_break_3_0_QgsEditFormConfig}
10111011

10121012
- Does no longer inherit QObject
10131013
- widgetType() and widgetConfig() now reflect only the user configured values.
1014-
QgsEditorWidgetRegistry::instance()->findBest() must be used instead.
1014+
QgsEditorWidgetRegistry::findBest() must be used instead.
10151015
- widgetConfig(), setWidgetType(), setWidgetConfig() and removeWidgetConfig() now only take a string as first parameter. Access by index has been removed.
10161016
- widgetType() has been removed in favor of QgsVectorLayer::editorWidgetSetup()
10171017
- expression(), setExpression(), expressionDescription() and setExpressionDescription()
@@ -1213,6 +1213,7 @@ plugins calling this method will need to be updated.
12131213
QgsEditorWidgetRegistry {#qgis_api_break_3_0_QgsEditorWidgetRegistry}
12141214
-----------------------
12151215

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

@@ -1822,10 +1823,10 @@ QgsRenderChecker {#qgis_api_break_3_0_QgsRenderChecker}
18221823
setExcludeAttributesWms()
18231824
- excludeAttributesWFS() and setExcludeAttributesWFS() have been renamed to excludeAttributesWfs() and
18241825
setExcludeAttributesWfs()
1825-
- editorWidgetV2() and editorWidgetV2Config() have been removed and QgsEditorWidgetRegistry::instance()->findBest() must be used instead.
1826+
- editorWidgetV2() and editorWidgetV2Config() have been removed and QgsEditorWidgetRegistry::findBest() must be used instead.
18261827
- setEditorWidgetV2(), setEditorWidgetV2Config() have been removed and their equivalent in editFormConfig() must be used instead.
18271828
- setCheckedState() is removed. Use `editFormConfig()->setWidgetConfig()` instead.
1828-
- valueMap(), valueRelation(), dateFormat(), widgetSize() have been removed. Use QgsEditorWidgetRegistry::instance()->findBest().config() instead.
1829+
- valueMap(), valueRelation(), dateFormat(), widgetSize() have been removed. Use QgsEditorWidgetRegistry::findBest().config() instead.
18291830

18301831

18311832
QgsRenderContext {#qgis_api_break_3_0_QgsRenderContext}

python/gui/editorwidgets/core/qgseditorwidgetregistry.sip

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ class QgsEditorWidgetRegistry : QObject
2121
%End
2222
public:
2323

24-
static QgsEditorWidgetRegistry *instance();
25-
%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
31-
%End
32-
3324
static void initEditors( QgsMapCanvas *mapCanvas = 0, QgsMessageBar *messageBar = 0 );
3425
%Docstring
3526
Registers all the default widgets.

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/qgsgui.sip

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsgui.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
class QgsGui
14+
{
15+
%Docstring
16+
QgsGui is a singleton class containing various registry and other global members
17+
related to GUI classes.
18+
.. versionadded:: 3.0
19+
%End
20+
21+
%TypeHeaderCode
22+
#include "qgsgui.h"
23+
%End
24+
public:
25+
26+
27+
28+
static QgsGui *instance();
29+
%Docstring
30+
Returns a pointer to the singleton instance.
31+
:rtype: QgsGui
32+
%End
33+
34+
static QgsEditorWidgetRegistry *editorWidgetRegistry();
35+
%Docstring
36+
Returns the global editor widget registry, used for managing all known edit widget factories.
37+
.. versionadded:: 3.0
38+
:rtype: QgsEditorWidgetRegistry
39+
%End
40+
41+
~QgsGui();
42+
43+
private:
44+
QgsGui( const QgsGui &other );
45+
};
46+
47+
/************************************************************************
48+
* This file has been generated automatically from *
49+
* *
50+
* src/gui/qgsgui.h *
51+
* *
52+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
53+
************************************************************************/

src/app/ogr/qgsvectorlayersaveasdialog.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "qgseditorwidgetfactory.h"
2424
#include "qgseditorwidgetregistry.h"
2525
#include "qgssettings.h"
26-
26+
#include "qgsgui.h"
2727
#include <QMessageBox>
2828
#include <QFileDialog>
2929
#include <QTextCodec>
@@ -379,9 +379,9 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
379379
bool foundFieldThatCanBeExportedAsDisplayedValue = false;
380380
for ( int i = 0; i < mLayer->fields().size(); ++i )
381381
{
382-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mLayer, mLayer->fields()[i].name() );
382+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, mLayer->fields()[i].name() );
383383
if ( setup.type() != QLatin1String( "TextEdit" ) &&
384-
QgsEditorWidgetRegistry::instance()->factory( setup.type() ) )
384+
QgsGui::editorWidgetRegistry()->factory( setup.type() ) )
385385
{
386386
foundFieldThatCanBeExportedAsDisplayedValue = true;
387387
break;
@@ -416,11 +416,11 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
416416

417417
if ( foundFieldThatCanBeExportedAsDisplayedValue )
418418
{
419-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mLayer, mLayer->fields()[i].name() );
419+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, mLayer->fields()[i].name() );
420420
QgsEditorWidgetFactory *factory = nullptr;
421421
if ( flags == Qt::ItemIsEnabled &&
422422
setup.type() != QLatin1String( "TextEdit" ) &&
423-
( factory = QgsEditorWidgetRegistry::instance()->factory( setup.type() ) ) )
423+
( factory = QgsGui::editorWidgetRegistry()->factory( setup.type() ) ) )
424424
{
425425
item = new QTableWidgetItem( tr( "Use %1" ).arg( factory->name() ) );
426426
item->setFlags( ( selectAllFields ) ? ( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable ) : Qt::ItemIsUserCheckable );

src/app/qgisapp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
278278
#include "qgsmaprenderertask.h"
279279
#include "qgsmapdecoration.h"
280280
#include "qgsnewnamedialog.h"
281+
#include "qgsgui.h"
281282

282283
#include "qgssublayersdialog.h"
283284
#include "ogr/qgsopenvectorlayerdialog.h"
@@ -924,7 +925,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
924925
mVectorLayerTools = new QgsGuiVectorLayerTools();
925926

926927
// Init the editor widget types
927-
QgsEditorWidgetRegistry::initEditors( mMapCanvas, mInfoBar );
928+
QgsGui::editorWidgetRegistry()->initEditors( mMapCanvas, mInfoBar );
928929

929930
mInternalClipboard = new QgsClipboard; // create clipboard
930931
connect( mInternalClipboard, &QgsClipboard::changed, this, &QgisApp::clipboardChanged );
@@ -6810,7 +6811,7 @@ QVariant QgisAppFieldValueConverter::convert( int idx, const QVariant &value )
68106811
{
68116812
return value;
68126813
}
6813-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mLayer, mLayer->fields().field( idx ).name() );
6814+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, mLayer->fields().field( idx ).name() );
68146815
QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );
68156816
return fieldFormatter->representValue( mLayer, idx, setup.config(), QVariant(), value );
68166817
}

src/app/qgsattributetabledialog.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "qgsfields.h"
5050
#include "qgseditorwidgetregistry.h"
5151
#include "qgsfieldproxymodel.h"
52+
#include "qgsgui.h"
5253

5354
QgsExpressionContext QgsAttributeTableDialog::createExpressionContext() const
5455
{
@@ -412,7 +413,7 @@ void QgsAttributeTableDialog::columnBoxInit()
412413
if ( idx < 0 )
413414
continue;
414415

415-
if ( QgsEditorWidgetRegistry::instance()->findBest( mLayer, field.name() ).type() != QLatin1String( "Hidden" ) )
416+
if ( QgsGui::editorWidgetRegistry()->findBest( mLayer, field.name() ).type() != QLatin1String( "Hidden" ) )
416417
{
417418
QIcon icon = mLayer->fields().iconForField( idx );
418419
QString alias = mLayer->attributeDisplayName( idx );
@@ -560,8 +561,8 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject *filterAction )
560561
int fldIdx = mLayer->fields().lookupField( fieldName );
561562
if ( fldIdx < 0 )
562563
return;
563-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mLayer, fieldName );
564-
mCurrentSearchWidgetWrapper = QgsEditorWidgetRegistry::instance()->
564+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, fieldName );
565+
mCurrentSearchWidgetWrapper = QgsGui::editorWidgetRegistry()->
565566
createSearchWidget( setup.type(), mLayer, fldIdx, setup.config(), mFilterContainer, mEditorContext );
566567
if ( mCurrentSearchWidgetWrapper->applyDirectly() )
567568
{

src/app/qgsattributetypedialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "qgsfieldformatter.h"
2828
#include "qgseditorwidgetfactory.h"
2929
#include "qgseditorwidgetregistry.h"
30+
#include "qgsgui.h"
3031

3132
#include <QTableWidgetItem>
3233
#include <QFile>
@@ -46,7 +47,7 @@ QgsAttributeTypeDialog::QgsAttributeTypeDialog( QgsVectorLayer *vl, int fieldIdx
4647
setupUi( this );
4748
setWindowTitle( tr( "Edit Widget Properties - %1 (%2)" ).arg( vl->fields().at( fieldIdx ).name(), vl->name() ) );
4849

49-
QMapIterator<QString, QgsEditorWidgetFactory *> it( QgsEditorWidgetRegistry::instance()->factories() );
50+
QMapIterator<QString, QgsEditorWidgetFactory *> it( QgsGui::editorWidgetRegistry()->factories() );
5051
while ( it.hasNext() )
5152
{
5253
it.next();
@@ -160,7 +161,7 @@ void QgsAttributeTypeDialog::setEditorWidgetType( const QString &type )
160161
}
161162
else
162163
{
163-
QgsEditorConfigWidget *cfgWdg = QgsEditorWidgetRegistry::instance()->createConfigWidget( type, mLayer, mFieldIdx, this );
164+
QgsEditorConfigWidget *cfgWdg = QgsGui::editorWidgetRegistry()->createConfigWidget( type, mLayer, mFieldIdx, this );
164165

165166
if ( cfgWdg )
166167
{

src/app/qgsfieldsproperties.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qgsvectorlayer.h"
3030
#include "qgsfieldexpressionwidget.h"
3131
#include "qgssettings.h"
32+
#include "qgsgui.h"
3233

3334
#include <QTreeWidgetItem>
3435
#include <QWidget>
@@ -339,7 +340,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField &field )
339340

340341
FieldConfig cfg( mLayer, idx );
341342
QPushButton *pb = nullptr;
342-
pb = new QPushButton( QgsEditorWidgetRegistry::instance()->name( cfg.mEditorWidgetType ) );
343+
pb = new QPushButton( QgsGui::editorWidgetRegistry()->name( cfg.mEditorWidgetType ) );
343344
cfg.mButton = pb;
344345
mFieldsList->setCellWidget( row, AttrEditTypeCol, pb );
345346

@@ -398,7 +399,7 @@ void QgsFieldsProperties::loadRelations()
398399
if ( nmrel.fieldPairs().at( 0 ).referencingField() != relation.fieldPairs().at( 0 ).referencingField() )
399400
nmCombo->addItem( QStringLiteral( "%1 (%2)" ).arg( nmrel.referencedLayer()->name(), nmrel.fieldPairs().at( 0 ).referencedField() ), nmrel.id() );
400401

401-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mLayer, relation.id() );
402+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mLayer, relation.id() );
402403

403404
const QVariant nmrelcfg = setup.config().value( QStringLiteral( "nm-rel" ) );
404405

@@ -1102,7 +1103,7 @@ QgsFieldsProperties::FieldConfig::FieldConfig( QgsVectorLayer *layer, int idx )
11021103
mConstraintStrength.insert( QgsFieldConstraints::ConstraintUnique, constraints.constraintStrength( QgsFieldConstraints::ConstraintUnique ) );
11031104
mConstraintStrength.insert( QgsFieldConstraints::ConstraintExpression, constraints.constraintStrength( QgsFieldConstraints::ConstraintExpression ) );
11041105
mConstraintDescription = constraints.constraintDescription();
1105-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( layer, layer->fields().field( idx ).name() );
1106+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( layer, layer->fields().field( idx ).name() );
11061107
mEditorWidgetType = setup.type();
11071108
mEditorWidgetConfig = setup.config();
11081109
}

src/app/qgsidentifyresultsdialog.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "qgsfieldformatterregistry.h"
4747
#include "qgsfieldformatter.h"
4848
#include "qgssettings.h"
49+
#include "qgsgui.h"
4950

5051
#include <QCloseEvent>
5152
#include <QLabel>
@@ -535,7 +536,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
535536
if ( i >= fields.count() )
536537
break;
537538

538-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( vlayer, fields[i].name() );
539+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( vlayer, fields[i].name() );
539540
if ( setup.type() == QLatin1String( "Hidden" ) )
540541
{
541542
continue;
@@ -603,7 +604,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
603604
continue;
604605

605606
QString value = fields.at( i ).displayString( attrs.at( i ) );
606-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( vlayer, fields.at( i ).name() );
607+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( vlayer, fields.at( i ).name() );
607608
QString value2 = representValue( vlayer, setup, fields.at( i ).name(), value );
608609

609610
tblResults->setRowCount( j + 1 );
@@ -710,7 +711,7 @@ QString QgsIdentifyResultsDialog::representValue( QgsVectorLayer *vlayer, const
710711
QVariant cache;
711712
QMap<QString, QVariant> &layerCaches = mWidgetCaches[vlayer->id()];
712713

713-
QgsEditorWidgetFactory *factory = QgsEditorWidgetRegistry::instance()->factory( setup.type() );
714+
QgsEditorWidgetFactory *factory = QgsGui::editorWidgetRegistry()->factory( setup.type() );
714715
QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );
715716

716717
int idx = vlayer->fields().lookupField( fieldName );
@@ -1542,7 +1543,7 @@ void QgsIdentifyResultsDialog::attributeValueChanged( QgsFeatureId fid, int idx,
15421543

15431544
if ( item->data( 0, Qt::UserRole + 1 ).toInt() == idx )
15441545
{
1545-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( vlayer, fld.name() );
1546+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( vlayer, fld.name() );
15461547
value = representValue( vlayer, setup, fld.name(), val );
15471548

15481549
QgsTreeWidgetItem *treeItem = static_cast< QgsTreeWidgetItem * >( item );

src/app/qgsmergeattributesdialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "qgsstatisticalsummary.h"
2929
#include "qgseditorwidgetregistry.h"
3030
#include "qgssettings.h"
31+
#include "qgsgui.h"
3132

3233
#include <limits>
3334
#include <QComboBox>
@@ -115,7 +116,7 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
115116
mHiddenAttributes.clear();
116117
for ( int idx = 0; idx < mFields.count(); ++idx )
117118
{
118-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( mVectorLayer, mFields.at( idx ).name() );
119+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( mVectorLayer, mFields.at( idx ).name() );
119120
if ( setup.type() == QLatin1String( "Hidden" ) || setup.type() == QLatin1String( "Immutable" ) )
120121
{
121122
mHiddenAttributes.insert( idx );
@@ -155,7 +156,7 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
155156
QTableWidgetItem *attributeValItem = new QTableWidgetItem( attrs.at( idx ).toString() );
156157
attributeValItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
157158
mTableWidget->setItem( i + 1, j, attributeValItem );
158-
QgsEditorWidgetWrapper *eww = QgsEditorWidgetRegistry::instance()->create( mVectorLayer, idx, nullptr, mTableWidget, context );
159+
QgsEditorWidgetWrapper *eww = QgsGui::editorWidgetRegistry()->create( mVectorLayer, idx, nullptr, mTableWidget, context );
159160
if ( eww )
160161
{
161162
eww->setValue( attrs.at( idx ) );

src/gui/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ SET(QGIS_GUI_SRCS
226226
qgsgradientcolorrampdialog.cpp
227227
qgsgradientstopeditor.cpp
228228
qgsgroupwmsdatadialog.cpp
229+
qgsgui.cpp
229230
qgshighlight.cpp
230231
qgshistogramwidget.cpp
231232
qgshelp.cpp
@@ -621,6 +622,7 @@ SET(QGIS_GUI_HDRS
621622
qgsdetaileditemdata.h
622623
qgsexpressionbuilderdialog.h
623624
qgsfiledropedit.h
625+
qgsgui.h
624626
qgshelp.h
625627
qgshighlight.h
626628
qgsmapcanvasitem.h

src/gui/attributetable/qgsattributetabledelegate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "qgslogger.h"
3030
#include "qgsvectordataprovider.h"
3131
#include "qgsactionmanager.h"
32-
32+
#include "qgsgui.h"
3333

3434
QgsVectorLayer *QgsAttributeTableDelegate::layer( const QAbstractItemModel *model )
3535
{
@@ -67,7 +67,7 @@ QWidget *QgsAttributeTableDelegate::createEditor( QWidget *parent, const QStyleO
6767
int fieldIdx = index.model()->data( index, QgsAttributeTableModel::FieldIndexRole ).toInt();
6868

6969
QgsAttributeEditorContext context( masterModel( index.model() )->editorContext(), QgsAttributeEditorContext::Popup );
70-
QgsEditorWidgetWrapper *eww = QgsEditorWidgetRegistry::instance()->create( vl, fieldIdx, nullptr, parent, context );
70+
QgsEditorWidgetWrapper *eww = QgsGui::editorWidgetRegistry()->create( vl, fieldIdx, nullptr, parent, context );
7171
QWidget *w = eww->widget();
7272

7373
w->setAutoFillBackground( true );

src/gui/attributetable/qgsattributetablemodel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "qgsvectordataprovider.h"
3434
#include "qgssymbollayerutils.h"
3535
#include "qgsfieldformatterregistry.h"
36-
36+
#include "qgsgui.h"
3737
#include <QVariant>
3838

3939
#include <limits>
@@ -351,8 +351,8 @@ void QgsAttributeTableModel::loadAttributes()
351351

352352
for ( int idx = 0; idx < fields.count(); ++idx )
353353
{
354-
const QgsEditorWidgetSetup setup = QgsEditorWidgetRegistry::instance()->findBest( layer(), fields[idx].name() );
355-
QgsEditorWidgetFactory *widgetFactory = QgsEditorWidgetRegistry::instance()->factory( setup.type() );
354+
const QgsEditorWidgetSetup setup = QgsGui::editorWidgetRegistry()->findBest( layer(), fields[idx].name() );
355+
QgsEditorWidgetFactory *widgetFactory = QgsGui::editorWidgetRegistry()->factory( setup.type() );
356356
QgsFieldFormatter *fieldFormatter = QgsApplication::fieldFormatterRegistry()->fieldFormatter( setup.type() );
357357

358358
if ( widgetFactory )

src/gui/attributetable/qgsdualview.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qgseditorwidgetregistry.h"
3030
#include "qgssettings.h"
3131
#include "qgsscrollarea.h"
32+
#include "qgsgui.h"
3233

3334
#include <QClipboard>
3435
#include <QDialog>
@@ -148,7 +149,7 @@ void QgsDualView::columnBoxInit()
148149
if ( fieldIndex == -1 )
149150
continue;
150151

151-
if ( QgsEditorWidgetRegistry::instance()->findBest( mLayer, field.name() ).type() != QLatin1String( "Hidden" ) )
152+
if ( QgsGui::editorWidgetRegistry()->findBest( mLayer, field.name() ).type() != QLatin1String( "Hidden" ) )
152153
{
153154
QIcon icon = mLayer->fields().iconForField( fieldIndex );
154155
QString text = field.name();

0 commit comments

Comments
 (0)