Skip to content

Commit

Permalink
Bump minimum Qt version to 5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 5, 2018
1 parent 993dc81 commit dc72f06
Show file tree
Hide file tree
Showing 30 changed files with 4 additions and 194 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/overview.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions python/plugins/db_manager/dlg_sql_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions src/app/decorations/qgsdecorationcopyright.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
5 changes: 0 additions & 5 deletions src/app/decorations/qgsdecorationnortharrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions src/app/decorations/qgsdecorationscalebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

//////////

Expand Down
2 changes: 0 additions & 2 deletions src/app/qgisappstylesheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down
12 changes: 0 additions & 12 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down Expand Up @@ -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>();
Expand Down
6 changes: 0 additions & 6 deletions src/app/qgsmaplayerstylecategoriesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );

Expand Down
6 changes: 0 additions & 6 deletions src/app/qgsrelationadddlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 0 additions & 6 deletions src/app/qgsvectorlayerloadstyledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
2 changes: 0 additions & 2 deletions src/core/dxf/qgsdxfpaintdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
30 changes: 0 additions & 30 deletions src/core/processing/qgsprocessingparametertypeimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
21 changes: 0 additions & 21 deletions src/core/qgis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 0 additions & 5 deletions src/core/qgsfeaturefiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/core/qgsfontutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 );

Expand Down
2 changes: 0 additions & 2 deletions src/core/qgsrenderchecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit dc72f06

Please sign in to comment.