Skip to content

Commit

Permalink
set minimum Qt version to 4.7 and remove #ifdef code depending on pri…
Browse files Browse the repository at this point in the history
…or versions
  • Loading branch information
jef-n committed Nov 30, 2013
1 parent 9cc3c5c commit 3e5ff1f
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 175 deletions.
10 changes: 3 additions & 7 deletions CMakeLists.txt
Expand Up @@ -219,7 +219,7 @@ SET (HAVE_MSSQL TRUE)

#############################################################
# search for Qt4
SET(QT_MIN_VERSION 4.5.0)
SET(QT_MIN_VERSION 4.7.0)
FIND_PACKAGE(Qt4 ${QT_MIN_VERSION} REQUIRED)
MESSAGE(STATUS "Found Qt version: ${QTVERSION}")
SET(QT_USE_QTXML 1)
Expand All @@ -242,12 +242,8 @@ ELSE (ANDROID)
SET (DEFAULT_WITH_TOUCH FALSE)
ENDIF (ANDROID)

#Add a touch mode if Qt has Qt Gestures (starting from 4.6)
IF ( (QT_VERSION_MAJOR EQUAL 4 AND QT_VERSION_MINOR GREATER 5) OR QT_VERSION_MAJOR GREATER 4 )
SET (WITH_TOUCH ${DEFAULT_WITH_TOUCH} CACHE BOOL "Determines if touch interface related code should be build")
ELSE ( (QT_VERSION_MAJOR EQUAL 4 AND QT_VERSION_MINOR GREATER 5) OR QT_VERSION_MAJOR GREATER 4 )
SET (WITH_TOUCH FALSE)
ENDIF ( (QT_VERSION_MAJOR EQUAL 4 AND QT_VERSION_MINOR GREATER 5) OR QT_VERSION_MAJOR GREATER 4 )
#Add a touch mode if Qt has Qt Gestures
SET (WITH_TOUCH ${DEFAULT_WITH_TOUCH} CACHE BOOL "Determines if touch interface related code should be build")

IF (WITH_TOUCH)
# following variable is used in qgsconfig.h
Expand Down
8 changes: 4 additions & 4 deletions INSTALL
@@ -1,10 +1,10 @@
QGIS
Building QGIS from source - step by step
Thursday November 21, 2013
Saturday November 30, 2013


Last Updated: Thursday November 21, 2013
Last Change : Thursday November 21, 2013
Last Updated: Saturday November 30, 2013
Last Change : Saturday November 30, 2013


1. Introduction
Expand Down Expand Up @@ -98,7 +98,7 @@ Required build tools:

Required build deps:

- Qt >= 4.5.0
- Qt >= 4.7.0
- Proj >= 4.4.x
- GEOS >= 3.0
- Sqlite3 >= 3.0.0
Expand Down
12 changes: 6 additions & 6 deletions doc/INSTALL.html
Expand Up @@ -5,7 +5,7 @@
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>QGIS</TITLE>

<!-- Included /home/fischer/src/qgis/doc/style.css -->
<!-- Included /home/fischer/src/qgis/qgis/doc/style.css -->
<STYLE TYPE="text/css">
body{ background: white;
color: black;
Expand Down Expand Up @@ -77,13 +77,13 @@
<DIV CLASS="header" ID="header">
<H1>QGIS</H1>
<H2>Building QGIS from source - step by step</H2>
<H3>Thursday November 21, 2013</H3>
<H3>Saturday November 30, 2013</H3>
</DIV>

<DIV CLASS="body" ID="body">
<P>
Last Updated: Thursday November 21, 2013
Last Change : Thursday November 21, 2013
Last Updated: Saturday November 30, 2013
Last Change : Saturday November 30, 2013
</P>
<DIV CLASS="toc">

Expand Down Expand Up @@ -205,7 +205,7 @@ <H1>2. Overview</H1>
</P>

<UL>
<LI>Qt &gt;= 4.5.0
<LI>Qt &gt;= 4.7.0
<LI>Proj &gt;= 4.4.x
<LI>GEOS &gt;= 3.0
<LI>Sqlite3 &gt;= 3.0.0
Expand Down Expand Up @@ -3227,5 +3227,5 @@ <H1>9. Authors and Acknowledgments</H1>

</DIV>
<!-- html code generated by txt2tags 2.6 (http://txt2tags.org) -->
<!-- cmdline: txt2tags -o/home/fischer/src/qgis/debian/build/doc/INSTALL.html -t html /home/fischer/src/qgis/doc/INSTALL.t2t -->
<!-- cmdline: txt2tags -o/home/fischer/src/qgis/qgis/debian/build/doc/INSTALL.html -t html /home/fischer/src/qgis/qgis/doc/INSTALL.t2t -->
</BODY></HTML>
2 changes: 1 addition & 1 deletion doc/overview.t2t
Expand Up @@ -15,7 +15,7 @@ Required build tools:

Required build deps:

- Qt >= 4.5.0
- Qt >= 4.7.0
- Proj >= 4.4.x
- GEOS >= 3.0
- Sqlite3 >= 3.0.0
Expand Down
4 changes: 0 additions & 4 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -1509,9 +1509,7 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
for ( int i = 0; i < mComposition->numPages(); ++i )
{
QSvgGenerator generator;
#if QT_VERSION >= 0x040500
generator.setTitle( QgsProject::instance()->title() );
#endif
if ( i == 0 )
{
generator.setFileName( outputFileName );
Expand All @@ -1527,9 +1525,7 @@ void QgsComposer::on_mActionExportAsSVG_triggered()
//height in pixel
int height = ( int )( mComposition->paperHeight() * mComposition->printResolution() / 25.4 );
generator.setSize( QSize( width, height ) );
#if QT_VERSION >= 0x040500
generator.setViewBox( QRect( 0, 0, width, height ) );
#endif
generator.setResolution( mComposition->printResolution() ); //because the rendering is done in mm, convert the dpi

QPainter p( &generator );
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerlabelwidget.cpp
Expand Up @@ -86,7 +86,7 @@ void QgsComposerLabelWidget::on_mFontButton_clicked()
if ( mComposerLabel )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerLabel->font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
8 changes: 4 additions & 4 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -373,7 +373,7 @@ void QgsComposerLegendWidget::on_mTitleFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::Title ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -395,7 +395,7 @@ void QgsComposerLegendWidget::on_mGroupFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::Group ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -417,7 +417,7 @@ void QgsComposerLegendWidget::on_mLayerFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::Subgroup ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -439,7 +439,7 @@ void QgsComposerLegendWidget::on_mItemFontButton_clicked()
if ( mLegend )
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mLegend->style( QgsComposerLegendStyle::SymbolLabel ).font(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -751,7 +751,7 @@ void QgsComposerMapWidget::on_mAnnotationFontButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerMap->gridAnnotationFont(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerscalebarwidget.cpp
Expand Up @@ -282,7 +282,7 @@ void QgsComposerScaleBarWidget::on_mFontButton_clicked()

bool dialogAccepted;
QFont oldFont = mComposerScaleBar->font();
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &dialogAccepted, oldFont, 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscomposertablewidget.cpp
Expand Up @@ -217,7 +217,7 @@ void QgsComposerTableWidget::on_mHeaderFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->headerFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
Expand All @@ -239,7 +239,7 @@ void QgsComposerTableWidget::on_mContentFontPushButton_clicked()
}

bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog );
#else
Expand Down
7 changes: 2 additions & 5 deletions src/app/legend/qgslegendlayer.cpp
Expand Up @@ -215,9 +215,7 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
SymbologyList itemList;
QList< QPair< QString, QColor > > rasterItemList = layer->legendSymbologyItems();
QList< QPair< QString, QColor > >::const_iterator itemIt = rasterItemList.constBegin();
#if QT_VERSION >= 0x40700
itemList.reserve( rasterItemList.size() );
#endif

// GetLegendGraphics in case of WMS service... pixmap can return null if GetLegendGraphics
// is not supported by the server
Expand All @@ -231,9 +229,8 @@ void QgsLegendLayer::rasterLayerSymbology( QgsRasterLayer* layer )
{
QgsDebugMsg( QString( "downloaded legend with dimension width:" ) + QString::number( legendGraphic.width() ) + QString( " and Height:" ) + QString::number( legendGraphic.height() ) );

#if QT_VERSION >= 0x40700
if ( rasterItemList.size() == 0 ) itemList.reserve( 1 );
#endif
if ( rasterItemList.size() == 0 )
itemList.reserve( 1 );
itemList.append( qMakePair( QString( "" ), QPixmap::fromImage( legendGraphic ) ) );
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -74,10 +74,7 @@
#include <QNetworkReply>
#include <QNetworkProxy>
#include <QAuthenticator>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
#endif

//
// Mac OS X Includes
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationgriddialog.cpp
Expand Up @@ -275,7 +275,7 @@ void QgsDecorationGridDialog::on_mPbtnUpdateFromLayer_clicked()
void QgsDecorationGridDialog::on_mAnnotationFontButton_clicked()
{
bool ok;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QFont newFont = QFontDialog::getFont( &ok, mDeco.gridAnnotationFont(), 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgslabeldialog.cpp
Expand Up @@ -280,7 +280,7 @@ void QgsLabelDialog::changeFont( void )

qreal fontSize = mFont.pointSizeF();
bool resultFlag;
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
mFont = QFontDialog::getFont( &resultFlag, mFont, 0, QString(), QFontDialog::DontUseNativeDialog );
#else
Expand Down
10 changes: 0 additions & 10 deletions src/app/qgsoptions.cpp
Expand Up @@ -48,10 +48,7 @@
#include <QSize>
#include <QStyleFactory>
#include <QMessageBox>

#if QT_VERSION >= 0x40500
#include <QNetworkDiskCache>
#endif

#include <limits>
#include <sqlite3.h>
Expand Down Expand Up @@ -286,7 +283,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
}
}

#if QT_VERSION >= 0x40500
// cache settings
QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( QgsNetworkAccessManager::instance()->cache() );
if ( cache )
Expand All @@ -298,10 +294,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
QgsDebugMsg( QString( "set cacheSize: %1" ).arg( cache->maximumCacheSize() ) );
mCacheSize->setValue( cache->maximumCacheSize() / 1024 );
}
#else
grpUrlExclude->setHidden( true );
grpCache->setHidden( true );
#endif

//wms search server
leWmsSearch->setText( settings.value( "/qgis/WMSSearchUrl", "http://geopole.org/wms/search?search=%1&type=rss" ).toString() );
Expand Down Expand Up @@ -1700,9 +1692,7 @@ void QgsOptions::on_mBrowseCacheDirectory_clicked()

void QgsOptions::on_mClearCache_clicked()
{
#if QT_VERSION >= 0x40500
QgsNetworkAccessManager::instance()->cache()->clear();
#endif
}

void QgsOptions::on_mOptionsStackedWidget_currentChanged( int theIndx )
Expand Down
37 changes: 0 additions & 37 deletions src/core/composer/qgscomposermap.cpp
Expand Up @@ -1974,7 +1974,6 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
}
QGraphicsItem* currentItem = 0;

#if QT_VERSION >= 0x40600 //Qt 4.6 provides the items in visibility order
for ( int i = itemList.size() - 1; i >= 0; --i )
{
currentItem = itemList.at( i );
Expand All @@ -1985,42 +1984,6 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
}
drawCanvasItem( currentItem, painter, itemStyle );
}
#else //Qt <4.6 provides the items in random order
QMultiMap<int, QGraphicsItem*> topLevelItems;
QMultiMap<QGraphicsItem*, QGraphicsItem*> childItems; //QMultiMap<parentItem, childItem>

for ( int i = 0; i < itemList.size(); ++i )
{
currentItem = itemList.at( i );
//don't draw mapcanvasmap (has z value -10)
if ( !currentItem || currentItem->data( 0 ) != "AnnotationItem" )
{
continue;
}
if ( currentItem->parentItem() )
{
childItems.insert( currentItem->parentItem(), currentItem );
}
else
{
topLevelItems.insert( currentItem->zValue(), currentItem );
}
}

QMultiMap<int, QGraphicsItem*>::iterator topLevelIt = topLevelItems.begin();
for ( ; topLevelIt != topLevelItems.end(); ++topLevelIt )
{
drawCanvasItem( topLevelIt.value(), painter, itemStyle );
//Draw children. They probably should be sorted according to z-order, but we don't do it because this code is only
//there for backward compatibility. And currently, having several embedded children is not used in QGIS
QMap<QGraphicsItem*, QGraphicsItem*>::iterator childIt = childItems.find( topLevelIt.value() );
while ( childIt != childItems.end() && childIt.key() == topLevelIt.value() )
{
drawCanvasItem( childIt.value(), painter, itemStyle );
++childIt;
}
}
#endif
}

void QgsComposerMap::drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QStyleOptionGraphicsItem* itemStyle )
Expand Down
6 changes: 0 additions & 6 deletions src/core/qgsnetworkaccessmanager.cpp
Expand Up @@ -28,7 +28,6 @@
#include <QTimer>
#include <QNetworkReply>

#if QT_VERSION >= 0x40500
class QgsNetworkProxyFactory : public QNetworkProxyFactory
{
public:
Expand Down Expand Up @@ -70,7 +69,6 @@ class QgsNetworkProxyFactory : public QNetworkProxyFactory
return QList<QNetworkProxy>() << nam->fallbackProxy();
}
};
#endif

QgsNetworkAccessManager *QgsNetworkAccessManager::instance()
{
Expand All @@ -82,16 +80,13 @@ QgsNetworkAccessManager *QgsNetworkAccessManager::instance()
QgsNetworkAccessManager::QgsNetworkAccessManager( QObject *parent )
: QNetworkAccessManager( parent )
{
#if QT_VERSION >= 0x40500
setProxyFactory( new QgsNetworkProxyFactory() );
#endif
}

QgsNetworkAccessManager::~QgsNetworkAccessManager()
{
}

#if QT_VERSION >= 0x40500
void QgsNetworkAccessManager::insertProxyFactory( QNetworkProxyFactory *factory )
{
mProxyFactories.insert( 0, factory );
Expand All @@ -106,7 +101,6 @@ const QList<QNetworkProxyFactory *> QgsNetworkAccessManager::proxyFactories() co
{
return mProxyFactories;
}
#endif

const QStringList &QgsNetworkAccessManager::excludeList() const
{
Expand Down

0 comments on commit 3e5ff1f

Please sign in to comment.