Remove more old qt fallbacks

This commit is contained in:
Nyall Dawson 2022-08-04 09:47:14 +10:00
parent ffca1d5693
commit 33788b6cb4
22 changed files with 5 additions and 127 deletions

View File

@ -206,8 +206,6 @@ project settings, they may be converted to relative paths when the project is sa
.. seealso:: :py:func:`styleDatabasesChanged`
%End
%If (CONCATENATED_TABLES_MODEL)
QgsCombinedStyleModel *combinedStyleModel();
%Docstring
Returns the combined style model which includes all style databases
@ -220,7 +218,6 @@ This model also includes :py:func:`QgsStyle.defaultStyle()`.
This is only available on builds based on Qt 5.13 or later.
.. seealso:: :py:func:`styles`
%End
%End
signals:

View File

@ -11,7 +11,6 @@
class QgsCombinedStyleModel: QConcatenateTablesProxyModel
{
%Docstring(signature="appended")

View File

@ -123,8 +123,6 @@ Constructor for QgsStyleProxyModel, using the specified source ``model`` and ``p
The source ``model`` object must exist for the lifetime of this model.
%End
%If (CONCATENATED_TABLES_MODEL)
explicit QgsStyleProxyModel( QgsCombinedStyleModel *model, QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsStyleProxyModel, using the specified source combined ``model`` and ``parent`` object.
@ -136,7 +134,6 @@ The source ``model`` object must exist for the lifetime of this model.
This is only available on builds based on Qt 5.13 or later.
.. versionadded:: 3.26
%End
%End
QString filterString() const;

View File

@ -85,11 +85,7 @@ void QgsSymbol3DWidget::setSymbolFromStyle( const QString &name, QgsStyle::Style
return;
QgsStyle *style = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
#else
( void )stylePath;
#endif
if ( !style )
style = QgsStyle::defaultStyle();

View File

@ -111,11 +111,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
mMetadataWidget = new QgsMetadataWidget();
mMetadataPage->layout()->addWidget( mMetadataWidget );
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
// not supported on Qt < 5.13
mGroupBoxStyleDatabases->hide();
#endif
connect( pbnAddScale, &QToolButton::clicked, this, &QgsProjectProperties::pbnAddScale_clicked );
connect( pbnRemoveScale, &QToolButton::clicked, this, &QgsProjectProperties::pbnRemoveScale_clicked );
connect( pbnImportScales, &QToolButton::clicked, this, &QgsProjectProperties::pbnImportScales_clicked );

View File

@ -599,9 +599,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f
//error beginning print
return FileError;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
p.setRenderHint( QPainter::LosslessImageRendering, mLayout->renderContext().flags() & QgsLayoutRenderContext::FlagLosslessImageRendering );
#endif
layerExportResult = printPrivate( printer, p, false, subSettings.dpi, subSettings.rasterizeWholeImage );
p.end();
return layerExportResult;
@ -703,9 +701,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f
//error beginning print
return FileError;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
p.setRenderHint( QPainter::LosslessImageRendering, mLayout->renderContext().flags() & QgsLayoutRenderContext::FlagLosslessImageRendering );
#endif
result = printPrivate( printer, p, false, settings.dpi, settings.rasterizeWholeImage );
p.end();
@ -787,9 +783,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( QgsAbstractLayou
//error beginning print
return PrintError;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
p.setRenderHint( QPainter::LosslessImageRendering, iterator->layout()->renderContext().flags() & QgsLayoutRenderContext::FlagLosslessImageRendering );
#endif
}
QgsLayoutExporter exporter( iterator->layout() );
@ -895,9 +889,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::print( QPrinter &printer, con
//error beginning print
return PrintError;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
p.setRenderHint( QPainter::LosslessImageRendering, mLayout->renderContext().flags() & QgsLayoutRenderContext::FlagLosslessImageRendering );
#endif
ExportResult result = printPrivate( printer, p, false, settings.dpi, settings.rasterizeWholeImage );
p.end();
@ -962,9 +954,7 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::print( QgsAbstractLayoutItera
//error beginning print
return PrintError;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
p.setRenderHint( QPainter::LosslessImageRendering, iterator->layout()->renderContext().flags() & QgsLayoutRenderContext::FlagLosslessImageRendering );
#endif
}
QgsLayoutExporter exporter( iterator->layout() );

View File

@ -450,9 +450,7 @@ QgsProject::QgsProject( QObject *parent, Qgis::ProjectCapabilities capabilities
connect( mViewSettings, &QgsProjectViewSettings::mapScalesChanged, this, &QgsProject::mapScalesChanged );
Q_NOWARN_DEPRECATED_POP
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mStyleSettings->combinedStyleModel()->addDefaultStyle();
#endif
}

View File

@ -24,10 +24,7 @@
#include "qgscolorramp.h"
#include "qgstextformat.h"
#include "qgsstyle.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
#include "qgscombinedstylemodel.h"
#endif
#include <QDomElement>
@ -35,9 +32,7 @@ QgsProjectStyleSettings::QgsProjectStyleSettings( QgsProject *project )
: QObject( project )
, mProject( project )
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mCombinedStyleModel = new QgsCombinedStyleModel( this );
#endif
}
QgsProjectStyleSettings::~QgsProjectStyleSettings()
@ -139,9 +134,7 @@ void QgsProjectStyleSettings::setProjectStyle( QgsStyle *style )
{
if ( mProjectStyle )
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mCombinedStyleModel->removeStyle( mProjectStyle );
#endif
mProjectStyle->deleteLater();
}
mProjectStyle = style;
@ -153,9 +146,7 @@ void QgsProjectStyleSettings::setProjectStyle( QgsStyle *style )
{
connect( mProject, &QgsProject::projectColorsChanged, mProjectStyle, &QgsStyle::triggerIconRebuild );
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mCombinedStyleModel->addStyle( mProjectStyle );
#endif
emit projectStyleChanged();
}
@ -399,9 +390,7 @@ void QgsProjectStyleSettings::loadStyleAtPath( const QString &path )
}
style->setName( fileInfo.completeBaseName() );
mStyles.append( style );
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mCombinedStyleModel->addStyle( style );
#endif
if ( mProject )
{
@ -420,9 +409,7 @@ void QgsProjectStyleSettings::clearStyles()
mStyleDatabases.removeAll( path );
if ( QgsStyle *style = styleAtPath( path ) )
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mCombinedStyleModel->removeStyle( style );
#endif
style->deleteLater();
mStyles.removeAll( style );
}
@ -430,22 +417,18 @@ void QgsProjectStyleSettings::clearStyles()
}
// should already be empty, but play it safe..!
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
for ( QgsStyle *style : std::as_const( mStyles ) )
{
mCombinedStyleModel->removeStyle( style );
}
#endif
qDeleteAll( mStyles );
mStyles.clear();
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
QgsCombinedStyleModel *QgsProjectStyleSettings::combinedStyleModel()
{
return mCombinedStyleModel;
}
#endif
@ -463,11 +446,9 @@ QgsProjectStyleDatabaseModel::QgsProjectStyleDatabaseModel( QgsProjectStyleSetti
connect( mSettings, &QgsProjectStyleSettings::styleDatabaseAboutToBeRemoved, this, &QgsProjectStyleDatabaseModel::styleDatabaseAboutToBeRemoved );
connect( mSettings, &QgsProjectStyleSettings::styleDatabaseRemoved, this, &QgsProjectStyleDatabaseModel::styleDatabaseRemoved );
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
if ( mSettings->projectStyle() )
setProjectStyle( mSettings->projectStyle() );
connect( mSettings, &QgsProjectStyleSettings::projectStyleChanged, this, &QgsProjectStyleDatabaseModel::projectStyleChanged );
#endif
}
int QgsProjectStyleDatabaseModel::rowCount( const QModelIndex &parent ) const

View File

@ -200,9 +200,6 @@ class CORE_EXPORT QgsProjectStyleSettings : public QObject
*/
void setStyleDatabasePaths( const QStringList &paths );
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
SIP_IF_FEATURE( CONCATENATED_TABLES_MODEL )
/**
* Returns the combined style model which includes all style databases
* associated with the project.
@ -214,8 +211,6 @@ class CORE_EXPORT QgsProjectStyleSettings : public QObject
* \see styles()
*/
QgsCombinedStyleModel *combinedStyleModel();
SIP_END
#endif
signals:

View File

@ -19,9 +19,6 @@
#include "qgssingleitemmodel.h"
#include "qgsapplication.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
QgsCombinedStyleModel::QgsCombinedStyleModel( QObject *parent )
: QConcatenateTablesProxyModel( parent )
{
@ -156,5 +153,3 @@ void QgsCombinedStyleModel::addDesiredIconSize( QSize size )
QgsApplication::defaultStyleModel()->addDesiredIconSize( size );
}
}
#endif

View File

@ -20,9 +20,6 @@
#include "qgis_sip.h"
#include <QtGlobal>
SIP_IF_MODULE( CONCATENATED_TABLES_MODEL )
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
#include <QConcatenateTablesProxyModel>
class QgsStyle;
@ -103,6 +100,5 @@ class CORE_EXPORT QgsCombinedStyleModel: public QConcatenateTablesProxyModel
QList< QSize > mAdditionalSizes;
};
#endif
#endif //QGSCOMBINEDSTYLEMODEL_H

View File

@ -20,14 +20,12 @@
#include "qgssvgcache.h"
#include "qgsimagecache.h"
#include "qgsexpressioncontextutils.h"
#include "qgscombinedstylemodel.h"
#include <QIcon>
#include <QBuffer>
#include <QDir>
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
#include "qgscombinedstylemodel.h"
#endif
const double ICON_PADDING_FACTOR = 0.16;
const auto ENTITIES = { QgsStyle::SymbolEntity, QgsStyle::ColorrampEntity, QgsStyle::TextFormatEntity, QgsStyle::LabelSettingsEntity, QgsStyle::LegendPatchShapeEntity, QgsStyle::Symbol3DEntity };
@ -814,7 +812,6 @@ QgsStyleProxyModel::QgsStyleProxyModel( QgsStyleModel *model, QObject *parent )
initialize();
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
QgsStyleProxyModel::QgsStyleProxyModel( QgsCombinedStyleModel *model, QObject *parent )
: QSortFilterProxyModel( parent )
, mCombinedModel( model )
@ -822,7 +819,6 @@ QgsStyleProxyModel::QgsStyleProxyModel( QgsCombinedStyleModel *model, QObject *p
setSourceModel( mCombinedModel );
initialize();
}
#endif
bool QgsStyleProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
{
@ -951,10 +947,8 @@ void QgsStyleProxyModel::addDesiredIconSize( QSize size )
{
if ( mModel )
mModel->addDesiredIconSize( size );
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
if ( mCombinedModel )
mCombinedModel->addDesiredIconSize( size );
#endif
}
bool QgsStyleProxyModel::symbolTypeFilterEnabled() const

View File

@ -239,9 +239,6 @@ class CORE_EXPORT QgsStyleProxyModel: public QSortFilterProxyModel
*/
explicit QgsStyleProxyModel( QgsStyleModel *model, QObject *parent SIP_TRANSFERTHIS = nullptr );
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
SIP_IF_FEATURE( CONCATENATED_TABLES_MODEL )
/**
* Constructor for QgsStyleProxyModel, using the specified source combined \a model and \a parent object.
*
@ -252,8 +249,6 @@ class CORE_EXPORT QgsStyleProxyModel: public QSortFilterProxyModel
* \since QGIS 3.26
*/
explicit QgsStyleProxyModel( QgsCombinedStyleModel *model, QObject *parent SIP_TRANSFERTHIS = nullptr );
SIP_END
#endif
/**
* Returns the current filter string, if set.
@ -473,9 +468,7 @@ class CORE_EXPORT QgsStyleProxyModel: public QSortFilterProxyModel
void initialize();
QgsStyleModel *mModel = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
QgsCombinedStyleModel *mCombinedModel = nullptr;
#endif
QgsStyle *mStyle = nullptr;
QString mFilterString;

View File

@ -909,11 +909,7 @@ QList<QgsSymbolLayerReference> QgsSymbolLayer::masks() const
void QgsSymbolLayer::prepareMasks( const QgsSymbolRenderContext &context )
{
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
mClipPath = QPainterPath();
#else
mClipPath.clear();
#endif
const QgsRenderContext &renderContext = context.renderContext();
const QList<QPainterPath> clipPaths = renderContext.symbolLayerClipPaths( this );

View File

@ -702,12 +702,7 @@ void QgsLabelingGui::updateUi()
void QgsLabelingGui::setFormatFromStyle( const QString &name, QgsStyle::StyleEntity type, const QString &stylePath )
{
QgsStyle *style = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
#else
( void )stylePath;
#endif
QgsStyle *style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
if ( !style )
style = QgsStyle::defaultStyle();

View File

@ -62,12 +62,7 @@ void QgsLegendPatchShapeWidget::setShapeFromStyle( const QString &name, QgsStyle
if ( name.isEmpty() )
return;
QgsStyle *style = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
#else
( void )stylePath;
#endif
QgsStyle *style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
if ( !style )
style = QgsStyle::defaultStyle();

View File

@ -43,13 +43,11 @@ QgsReadOnlyStyleModel::QgsReadOnlyStyleModel( QgsStyle *style, QObject *parent )
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
QgsReadOnlyStyleModel::QgsReadOnlyStyleModel( QgsCombinedStyleModel *style, QObject *parent )
: QgsStyleProxyModel( style, parent )
{
}
#endif
Qt::ItemFlags QgsReadOnlyStyleModel::flags( const QModelIndex &index ) const
{
@ -249,13 +247,8 @@ void QgsStyleItemsListWidget::setStyle( QgsStyle *style )
{
mStyle = style;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
mModel = mStyle == QgsStyle::defaultStyle() ? new QgsReadOnlyStyleModel( QgsProject::instance()->styleSettings()->combinedStyleModel(), this )
: new QgsReadOnlyStyleModel( mStyle, this );
#else
mModel = mStyle == QgsStyle::defaultStyle() ? new QgsReadOnlyStyleModel( QgsApplication::defaultStyleModel(), this )
: new QgsReadOnlyStyleModel( mStyle, this );
#endif
mModel->addDesiredIconSize( viewSymbols->iconSize() );
mModel->addDesiredIconSize( mSymbolTreeView->iconSize() );

View File

@ -37,10 +37,7 @@ class QgsReadOnlyStyleModel : public QgsStyleProxyModel
explicit QgsReadOnlyStyleModel( QgsStyleModel *sourceModel, QObject *parent = nullptr );
explicit QgsReadOnlyStyleModel( QgsStyle *style, QObject *parent = nullptr );
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
explicit QgsReadOnlyStyleModel( QgsCombinedStyleModel *style, QObject *parent = nullptr );
#endif
Qt::ItemFlags flags( const QModelIndex &index ) const override;
QVariant data( const QModelIndex &index, int role ) const override;

View File

@ -1903,12 +1903,7 @@ void QgsTextFormatWidget::setFormatFromStyle( const QString &name, QgsStyle::Sty
if ( name.isEmpty() )
return;
QgsStyle *style = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
#else
( void )stylePath;
#endif
QgsStyle *style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
if ( !style )
style = QgsStyle::defaultStyle();

View File

@ -204,11 +204,6 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QWidget *parent, Qt::WindowFlags f
connect( mButtonAddStyleDatabase, &QAbstractButton::clicked, this, [ = ] { addStyleDatabase( false ); } );
connect( mButtonNewStyleDatabase, &QAbstractButton::clicked, this, [ = ] { addStyleDatabase( true ); } );
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
// you don't get nice stuff
mStyleDatabaseWidget->hide();
#endif
}
void QgsStyleManagerDialog::init()

View File

@ -77,10 +77,6 @@ QgsStyleSaveDialog::QgsStyleSaveDialog( QWidget *parent, QgsStyle::StyleEntity t
break;
}
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
mLabelDestination->hide();
mComboBoxDestination->hide();
#else
QgsProjectStyleDatabaseModel *projectStyleModel = new QgsProjectStyleDatabaseModel( QgsProject::instance()->styleSettings(), this );
QgsProjectStyleDatabaseProxyModel *styleProxyModel = new QgsProjectStyleDatabaseProxyModel( projectStyleModel, this );
styleProxyModel->setFilters( QgsProjectStyleDatabaseProxyModel::Filter::FilterHideReadOnly );
@ -95,7 +91,6 @@ QgsStyleSaveDialog::QgsStyleSaveDialog( QWidget *parent, QgsStyle::StyleEntity t
projectStyleModel->setShowDefaultStyle( true );
mComboBoxDestination->setModel( styleProxyModel );
}
#endif
if ( possibleEntities.size() < 2 )
{
@ -171,9 +166,6 @@ QgsStyle::StyleEntity QgsStyleSaveDialog::selectedType() const
QgsStyle *QgsStyleSaveDialog::destinationStyle()
{
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
return QgsStyle::defaultStyle();
#else
if ( QgsStyle *style = qobject_cast< QgsStyle * >( mComboBoxDestination->model()->data( mComboBoxDestination->model()->index( mComboBoxDestination->currentIndex(), 0, QModelIndex() ), QgsProjectStyleDatabaseModel::StyleRole ).value< QObject * >() ) )
{
return style;
@ -182,5 +174,4 @@ QgsStyle *QgsStyleSaveDialog::destinationStyle()
{
return QgsStyle::defaultStyle();
}
#endif
}

View File

@ -607,7 +607,6 @@ void QgsSymbolsListWidget::setSymbolFromStyle( const QString &name, QgsStyle::St
return;
QgsStyle *style = nullptr;
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
if ( mStyle != QgsStyle::defaultStyle() )
{
// get new instance of symbol from style
@ -617,10 +616,6 @@ void QgsSymbolsListWidget::setSymbolFromStyle( const QString &name, QgsStyle::St
{
style = QgsProject::instance()->styleSettings()->styleAtPath( stylePath );
}
#else
( void )stylePath;
style = mStyle;
#endif
if ( !style )
return;