mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Start depreating
This commit is contained in:
parent
9796aa3b88
commit
d44f31000d
@ -10,6 +10,11 @@
|
||||
|
||||
class QgsSublayersDialog : QDialog
|
||||
{
|
||||
%Docstring(signature="appended")
|
||||
|
||||
.. deprecated::
|
||||
Will be removed in QGIS 4.0
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgssublayersdialog.h"
|
||||
@ -48,11 +53,11 @@ class QgsSublayersDialog : QDialog
|
||||
typedef QList<QgsSublayersDialog::LayerDefinition> LayerDefinitionList;
|
||||
|
||||
|
||||
QgsSublayersDialog( ProviderType providerType,
|
||||
const QString &name,
|
||||
QWidget *parent /TransferThis/ = 0,
|
||||
Qt::WindowFlags fl = Qt::WindowFlags(),
|
||||
const QString &dataSourceUri = QString() );
|
||||
QgsSublayersDialog( ProviderType providerType,
|
||||
const QString &name,
|
||||
QWidget *parent /TransferThis/ = 0,
|
||||
Qt::WindowFlags fl = Qt::WindowFlags(),
|
||||
const QString &dataSourceUri = QString() ) /Deprecated/;
|
||||
%Docstring
|
||||
Construct a new QgsSublayersDialog object - a dialog to select which sub layers to be imported from a data source (e.g. from geopackage or zipfile)
|
||||
|
||||
@ -61,6 +66,9 @@ Construct a new QgsSublayersDialog object - a dialog to select which sub layers
|
||||
:param parent: parent widget of the dialog
|
||||
:param fl: window flags
|
||||
:param dataSourceUri: data source URI
|
||||
|
||||
.. deprecated::
|
||||
Will be removed in QGIS 4.0
|
||||
%End
|
||||
|
||||
~QgsSublayersDialog();
|
||||
|
@ -98,6 +98,9 @@
|
||||
#include "qgsvectorlayersavestyledialog.h"
|
||||
#include "maptools/qgsappmaptools.h"
|
||||
#include "qgsexpressioncontextutils.h"
|
||||
#include "qgsprovidersublayerdetails.h"
|
||||
#include "qgsproviderutils.h"
|
||||
#include "qgsprovidersublayersdialog.h"
|
||||
|
||||
#include "qgsanalysis.h"
|
||||
#include "qgsgeometrycheckregistry.h"
|
||||
@ -7675,6 +7678,41 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive )
|
||||
}
|
||||
}
|
||||
|
||||
// query sublayers
|
||||
QList< QgsProviderSublayerDetails > sublayers = QgsProviderRegistry::instance()->querySublayers( fileName );
|
||||
if ( !sublayers.empty() )
|
||||
{
|
||||
bool detailsAreIncomplete = QgsProviderUtils::sublayerDetailsAreIncomplete( sublayers, false );
|
||||
const bool singleSublayerOnly = sublayers.size() == 1;
|
||||
if ( singleSublayerOnly && !detailsAreIncomplete )
|
||||
{
|
||||
// nice and easy -- we only have one sublayer, so load that
|
||||
}
|
||||
else if ( allowInteractive )
|
||||
{
|
||||
// prompt user for sublayers
|
||||
QgsProviderSublayersDialog dlg( fileName, sublayers, this );
|
||||
|
||||
dlg.exec();
|
||||
}
|
||||
else // non-interactive
|
||||
{
|
||||
// in non-interactive mode we don't care if feature counts are missing, so re-test if
|
||||
// details are incomplete with ignoring unknown feature counts
|
||||
detailsAreIncomplete = QgsProviderUtils::sublayerDetailsAreIncomplete( sublayers, true );
|
||||
if ( detailsAreIncomplete )
|
||||
{
|
||||
// requery sublayers, resolving geometry types
|
||||
sublayers = QgsProviderRegistry::instance()->querySublayers( fileName, Qgis::SublayerQueryFlag::ResolveGeometryType );
|
||||
}
|
||||
|
||||
// add all sublayers
|
||||
|
||||
}
|
||||
ok = true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// try to load it as raster
|
||||
if ( QgsRasterLayer::isValidRasterFileName( fileName ) )
|
||||
{
|
||||
@ -7701,14 +7739,14 @@ bool QgisApp::openLayer( const QString &fileName, bool allowInteractive )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CPLPopErrorHandler();
|
||||
|
||||
// Try to load as mesh layer after raster & vector
|
||||
if ( !ok )
|
||||
{
|
||||
ok = static_cast< bool >( addMeshLayerPrivate( fileName, fileInfo.completeBaseName(), QStringLiteral( "mdal" ), false ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
CPLPopErrorHandler();
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
|
@ -25,6 +25,7 @@
|
||||
/**
|
||||
* \ingroup gui
|
||||
* \class QgsSublayersDialog
|
||||
* \deprecated Will be removed in QGIS 4.0
|
||||
*/
|
||||
class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDialogBase
|
||||
{
|
||||
@ -97,12 +98,14 @@ class GUI_EXPORT QgsSublayersDialog : public QDialog, private Ui::QgsSublayersDi
|
||||
* \param parent parent widget of the dialog
|
||||
* \param fl window flags
|
||||
* \param dataSourceUri data source URI
|
||||
*
|
||||
* \deprecated Will be removed in QGIS 4.0
|
||||
*/
|
||||
QgsSublayersDialog( ProviderType providerType,
|
||||
const QString &name,
|
||||
QWidget *parent SIP_TRANSFERTHIS = nullptr,
|
||||
Qt::WindowFlags fl = Qt::WindowFlags(),
|
||||
const QString &dataSourceUri = QString() );
|
||||
Q_DECL_DEPRECATED QgsSublayersDialog( ProviderType providerType,
|
||||
const QString &name,
|
||||
QWidget *parent SIP_TRANSFERTHIS = nullptr,
|
||||
Qt::WindowFlags fl = Qt::WindowFlags(),
|
||||
const QString &dataSourceUri = QString() ) SIP_DEPRECATED;
|
||||
|
||||
~QgsSublayersDialog() override;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user