Skip to content
Permalink
Browse files

Bump minimum Qt version to 5.9

  • Loading branch information
nyalldawson committed Nov 4, 2018
1 parent 993dc81 commit dc72f06e538920f98a501d9b56bba51a5c8f0484
@@ -315,14 +315,7 @@ IF(WITH_CORE)
ENDIF(WITH_QTWEBKIT)
#############################################################
# search for Qt5
IF (WITH_3D)
# for 3D support we strictly require Qt >= 5.9
# (Qt 3D was introduced in 5.7 but it is not stable enough in that branch)
# Qt 5.8 is missing some classes, https://github.com/qgis/QGIS/pull/5203#discussion_r142319862
SET(QT_MIN_VERSION 5.9.0)
ELSE ()
SET(QT_MIN_VERSION 5.4.0)
ENDIF()
SET(QT_MIN_VERSION 5.9.0)
FIND_PACKAGE(Qt5Core QUIET)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
@@ -97,7 +97,7 @@ Required build tools:

Required build dependencies:

- Qt >= 5.3.0
- Qt >= 5.9.0
- Proj >= 4.4.x
- GEOS >= 3.4
- Sqlite3 >= 3.0.0
@@ -15,7 +15,7 @@ Required build tools:

Required build dependencies:

- Qt >= 5.3.0
- Qt >= 5.9.0
- Proj >= 4.4.x
- GEOS >= 3.4
- Sqlite3 >= 3.0.0
@@ -97,11 +97,7 @@ def __init__(self, iface, db, parent=None):
self.btnCancel.setText(self.tr("Cancel (ESC)"))
self.btnCancel.setEnabled(False)
self.btnCancel.clicked.connect(self.executeSqlCanceled)
try:
self.btnCancel.setShortcut(QKeySequence.Cancel)
except AttributeError:
# QKeySequence.Cancel only available in Qt >= 5.6
pass
self.btnCancel.setShortcut(QKeySequence.Cancel)
self.progressBar.setEnabled(False)
self.progressBar.setRange(0, 100)
self.progressBar.setValue(0)
@@ -125,13 +125,8 @@ void QgsDecorationCopyright::render( const QgsMapSettings &mapSettings, QgsRende
double textHeight = QgsTextRenderer::textHeight( context, mTextFormat, displayStringList, QgsTextRenderer::Point, &fm );

QPaintDevice *device = context.painter()->device();
#if QT_VERSION < 0x050600
int deviceHeight = device->height() / device->devicePixelRatio();
int deviceWidth = device->width() / device->devicePixelRatio();
#else
int deviceHeight = device->height() / device->devicePixelRatioF();
int deviceWidth = device->width() / device->devicePixelRatioF();
#endif

float xOffset( 0 ), yOffset( 0 );

@@ -169,13 +169,8 @@ void QgsDecorationNorthArrow::render( const QgsMapSettings &mapSettings, QgsRend
) - centerYDouble );
// need width/height of paint device
QPaintDevice *device = context.painter()->device();
#if QT_VERSION < 0x050600
int deviceHeight = device->height() / device->devicePixelRatio();
int deviceWidth = device->width() / device->devicePixelRatio();
#else
int deviceHeight = device->height() / device->devicePixelRatioF();
int deviceWidth = device->width() / device->devicePixelRatioF();
#endif

// Set margin according to selected units
int xOffset = 0;
@@ -178,13 +178,8 @@ void QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRender

//Get canvas dimensions
QPaintDevice *device = context.painter()->device();
#if QT_VERSION < 0x050600
int deviceHeight = device->height() / device->devicePixelRatio();
int deviceWidth = device->width() / device->devicePixelRatio();
#else
int deviceHeight = device->height() / device->devicePixelRatioF();
int deviceWidth = device->width() / device->devicePixelRatioF();
#endif

//Get map units per pixel. This can be negative at times (to do with
//projections) and that just confuses the rest of the code in this
@@ -248,9 +248,7 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
setAcceptDrops( true );

setAttribute( Qt::WA_DeleteOnClose );
#if QT_VERSION >= 0x050600
setDockOptions( dockOptions() | QMainWindow::GroupedDragging );
#endif

//create layout view
QGridLayout *viewLayout = new QGridLayout();
@@ -411,11 +411,9 @@ void myMessageOutput( QtMsgType type, const char *msg )
break; // silence warnings
}

#if QT_VERSION >= 0x050500
case QtInfoMsg:
myPrint( "Info: %s\n", msg );
break;
#endif
}
}

@@ -712,9 +712,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
this->addAction( mActionToggleMapOnly );
endProfile();

#if QT_VERSION >= 0x050600
setDockOptions( dockOptions() | QMainWindow::GroupedDragging );
#endif

//////////

@@ -108,7 +108,6 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
if ( fontSize != defaultSize || fontFamily != defaultFamily )
ss += QStringLiteral( "* { font: %1pt \"%2\"} " ).arg( fontSize, fontFamily );

#if QT_VERSION >= 0x050900
// Fix for macOS Qt 5.9+, where close boxes do not show on document mode tab bar tabs
// See: https://bugreports.qt.io/browse/QTBUG-61092
// https://bugreports.qt.io/browse/QTBUG-61742
@@ -121,7 +120,6 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &opts )
ss += QLatin1String( "QTabBar::close-button{ image: url(:/images/themes/default/mIconCloseTab.svg); }" );
ss += QLatin1String( "QTabBar::close-button:hover{ image: url(:/images/themes/default/mIconCloseTabHover.svg); }" );
}
#endif

// QGroupBox and QgsCollapsibleGroupBox, mostly for Ubuntu and Mac
bool gbxCustom = opts.value( QStringLiteral( "groupBoxCustom" ) ).toBool();
@@ -330,13 +330,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
for ( int row = 0; row < model->rowCount(); ++row )
{
QModelIndex index = model->index( row, 0 );
#if QT_VERSION <= 0x050601
// in Qt 5.6.1 and former, QVariant does not correctly convert enum using value
// see https://bugreports.qt.io/browse/QTBUG-53384
QgsMapLayer::StyleCategory category = static_cast<QgsMapLayer::StyleCategory>( model->data( index, Qt::UserRole ).toInt() );
#else
QgsMapLayer::StyleCategory category = model->data( index, Qt::UserRole ).value<QgsMapLayer::StyleCategory>();
#endif
QString name = model->data( index, Qt::DisplayRole ).toString();
QString tooltip = model->data( index, Qt::ToolTipRole ).toString();
QIcon icon = model->data( index, Qt::DecorationRole ).value<QIcon>();
@@ -375,13 +369,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
for ( int row = 0; row < model->rowCount(); ++row )
{
QModelIndex index = model->index( row, 0 );
#if QT_VERSION <= 0x050601
// in Qt 5.6.1 and former, QVariant does not correctly convert enum using value
// see https://bugreports.qt.io/browse/QTBUG-53384
QgsMapLayer::StyleCategory category = static_cast<QgsMapLayer::StyleCategory>( model->data( index, Qt::UserRole ).toInt() );
#else
QgsMapLayer::StyleCategory category = model->data( index, Qt::UserRole ).value<QgsMapLayer::StyleCategory>();
#endif
QString name = model->data( index, Qt::DisplayRole ).toString();
QString tooltip = model->data( index, Qt::ToolTipRole ).toString();
QIcon icon = model->data( index, Qt::DecorationRole ).value<QIcon>();
@@ -242,13 +242,7 @@ bool QgsMapLayerStyleCategoriesModel::setData( const QModelIndex &index, const Q

if ( role == Qt::CheckStateRole )
{
#if QT_VERSION <= 0x050601
// in Qt 5.6.1 and former, QVariant does not correctly convert enum using value
// see https://bugreports.qt.io/browse/QTBUG-53384
QgsMapLayer::StyleCategory category = static_cast<QgsMapLayer::StyleCategory>( data( index, Qt::UserRole ).toInt() );
#else
QgsMapLayer::StyleCategory category = data( index, Qt::UserRole ).value<QgsMapLayer::StyleCategory>();
#endif
if ( value.value<Qt::CheckState>() == Qt::Checked )
{
mCategories |= category;
@@ -1608,13 +1608,7 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/qgis/digitizing/disable_enter_attribute_values_dialog" ), chkDisableAttributeValuesDlg->isChecked() );
mSettings->setValue( QStringLiteral( "/qgis/digitizing/validate_geometries" ), mValidateGeometries->currentIndex() );

#if QT_VERSION <= 0x050601
// in Qt 5.6.1 and former, QVariant does not correctly convert enum using value
// see https://bugreports.qt.io/browse/QTBUG-53384
mSettings->setEnumValue( QStringLiteral( "/qgis/digitizing/offset_join_style" ), static_cast<QgsGeometry::JoinStyle>( mOffsetJoinStyleComboBox->currentData().toInt() ) );
#else
mSettings->setEnumValue( QStringLiteral( "/qgis/digitizing/offset_join_style" ), mOffsetJoinStyleComboBox->currentData().value<QgsGeometry::JoinStyle>() );
#endif
mSettings->setValue( QStringLiteral( "/qgis/digitizing/offset_quad_seg" ), mOffsetQuadSegSpinBox->value() );
mSettings->setValue( QStringLiteral( "/qgis/digitizing/offset_miter_limit" ), mCurveOffsetMiterLimitComboBox->value() );

@@ -80,13 +80,7 @@ QString QgsRelationAddDlg::relationName()

QgsRelation::RelationStrength QgsRelationAddDlg::relationStrength()
{
#if QT_VERSION <= 0x050601
// in Qt 5.6.1 and former, QVariant does not correctly convert enum using value
// see https://bugreports.qt.io/browse/QTBUG-53384
return static_cast<QgsRelation::RelationStrength>( mCbxRelationStrength->currentData().toInt() );
#else
return mCbxRelationStrength->currentData().value<QgsRelation::RelationStrength>();
#endif
}

void QgsRelationAddDlg::checkDefinitionValid()
@@ -115,13 +115,7 @@ QgsMapLayer::StyleCategories QgsVectorLayerLoadStyleDialog::styleCategories() co

QgsVectorLayerProperties::StyleType QgsVectorLayerLoadStyleDialog::currentStyleType() const
{
#if QT_VERSION <= 0x050601
// in Qt 5.6.1 and former, QVariant does not correctly convert enum using value
// see https://bugreports.qt.io/browse/QTBUG-53384
QgsVectorLayerProperties::StyleType type = static_cast<QgsVectorLayerProperties::StyleType>( mStyleTypeComboBox->currentData().toInt() );
#else
QgsVectorLayerProperties::StyleType type = mStyleTypeComboBox->currentData().value<QgsVectorLayerProperties::StyleType>();
#endif
if ( type == QgsVectorLayerProperties::QML )
{
QFileInfo fi( mFileWidget->filePath() );
@@ -57,10 +57,8 @@ int QgsDxfPaintDevice::metric( PaintDeviceMetric metric ) const
return 96;
case QPaintDevice::PdmDevicePixelRatio:
return 1;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
case QPaintDevice::PdmDevicePixelRatioScaled:
return 1;
#endif
}
return 0;
}
@@ -562,13 +562,7 @@ class CORE_EXPORT QgsProcessingParameterTypeVectorDestination : public QgsProces
ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();

#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif

return flags;
}

@@ -613,13 +607,7 @@ class CORE_EXPORT QgsProcessingParameterTypeFileDestination : public QgsProcessi
ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();

#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif

return flags;
}

@@ -664,13 +652,7 @@ class CORE_EXPORT QgsProcessingParameterTypeFolderDestination : public QgsProces
ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();

#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif

return flags;
}

@@ -714,13 +696,7 @@ class CORE_EXPORT QgsProcessingParameterTypeRasterDestination : public QgsProces
ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();

#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif

return flags;
}

@@ -976,13 +952,7 @@ class CORE_EXPORT QgsProcessingParameterTypeFeatureSink : public QgsProcessingPa
ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();

#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif

return flags;
}

@@ -264,30 +264,9 @@ uint qHash( const QVariant &variant )
case QVariant::Char:
return qHash( variant.toChar() );
case QVariant::List:

#if QT_VERSION >= 0x050600
return qHash( variant.toList() );
#else
{
QVariantList list = variant.toList();
if ( list.isEmpty() )
return -1;
else
return qHash( list.at( 0 ) );
}
#endif
case QVariant::StringList:
#if QT_VERSION >= 0x050600
return qHash( variant.toStringList() );
#else
{
QStringList list = variant.toStringList();
if ( list.isEmpty() )
return -1;
else
return qHash( list.at( 0 ) );
}
#endif
case QVariant::ByteArray:
return qHash( variant.toByteArray() );
case QVariant::Date:
@@ -256,12 +256,7 @@ void QgsFeatureFilterModel::updateCompleter()
if ( mExtraIdentifierValueIndex != 0 )
{
beginMoveRows( QModelIndex(), mExtraIdentifierValueIndex, mExtraIdentifierValueIndex, QModelIndex(), 0 );
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
Entry extraEntry = mEntries.takeAt( mExtraIdentifierValueIndex );
mEntries.prepend( extraEntry );
#else
mEntries.move( mExtraIdentifierValueIndex, 0 );
#endif
endMoveRows();
}
firstRow = 1;
@@ -493,7 +493,6 @@ QString QgsFontUtils::asCSS( const QFont &font, double pointToPixelScale )
case QFont::Black:
cssWeight = 900;
break;
#if QT_VERSION >= 0x050500
case QFont::Thin:
cssWeight = 100;
break;
@@ -506,7 +505,6 @@ QString QgsFontUtils::asCSS( const QFont &font, double pointToPixelScale )
case QFont::ExtraBold:
cssWeight = 800;
break;
#endif
}
css += QStringLiteral( "font-weight: %1;" ).arg( cssWeight );

@@ -194,9 +194,7 @@ bool QgsRenderChecker::runTest( const QString &testName,
mElapsedTime = myTime.elapsed();

QImage myImage = job.renderedImage();
#if QT_VERSION >= 0x050600
Q_ASSERT( myImage.devicePixelRatioF() == mMapSettings.devicePixelRatio() );
#endif

//
// Save the pixmap to disk so the user can make a

0 comments on commit dc72f06

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