Skip to content
Permalink
Browse files

add a completer for the file widget when creating a new GPKG (#35072)

  • Loading branch information
3nids committed Mar 15, 2020
1 parent 9b9c906 commit a93db7d7c5c27d766bd3ada97af6cff9f60e8e66
@@ -0,0 +1,2 @@
# The following has been generated automatically from src/core/qgsproviderconnectionmodel.h
QgsProviderConnectionModel.Role.baseClass = QgsProviderConnectionModel
@@ -49,6 +49,7 @@ class CORE_EXPORT QgsProviderConnectionModel : public QAbstractItemModel
RoleConfiguration, //!< Connection configuration variant map
RoleEmpty, //!< Entry is an empty entry
};
Q_ENUM( Role )

/**
* Constructor for QgsProviderConnectionModel, for the specified \a provider.
@@ -31,11 +31,13 @@
#include "qgshelp.h"
#include "qgsogrutils.h"
#include "qgsgui.h"
#include "qgsproviderconnectionmodel.h"

#include <QPushButton>
#include <QLineEdit>
#include <QMessageBox>
#include <QFileDialog>
#include <QCompleter>

#include <ogr_api.h>
#include <ogr_srs_api.h>
@@ -129,6 +131,15 @@ QgsNewGeoPackageLayerDialog::QgsNewGeoPackageLayerDialog( QWidget *parent, Qt::W
}
checkOk();
} );

QgsProviderConnectionModel *ogrProviderModel = new QgsProviderConnectionModel( QStringLiteral( "ogr" ), this );

QCompleter *completer = new QCompleter( this );
completer->setModel( ogrProviderModel );
completer->setCompletionRole( QgsProviderConnectionModel::RoleUri );
completer->setCompletionMode( QCompleter::PopupCompletion );
completer->setFilterMode( Qt::MatchContains );
mDatabase->lineEdit()->setCompleter( completer );
}

void QgsNewGeoPackageLayerDialog::setCrs( const QgsCoordinateReferenceSystem &crs )

0 comments on commit a93db7d

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