Skip to content

Commit 784ce74

Browse files
author
telwertowski
committed
Remove use of Qt3 support inline routines which redirect old Qt3 names to new Qt4 names. Remove USE_QT3SUPPORT from top-level CMakeLists and add it to GRASS provider/plugin CMakeLists so that all use of Qt3 names and libraries is limited to these two directories.
git-svn-id: http://svn.osgeo.org/qgis/trunk@8630 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c5d01dc commit 784ce74

File tree

96 files changed

+1030
-1011
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1030
-1011
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ ENDIF (POSTGRES_FOUND)
135135
# search for Qt4
136136
FIND_PACKAGE(Qt4 REQUIRED)
137137

138-
SET( QT_USE_QT3SUPPORT TRUE )
139138
SET( QT_USE_QTXML TRUE )
140139
SET( QT_USE_QTNETWORK TRUE )
141140
SET( QT_USE_QTSVG TRUE )

src/app/composer/qgscomposer.cpp

Lines changed: 77 additions & 75 deletions
Large diffs are not rendered by default.

src/app/composer/qgscomposer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public slots:
165165
\param from starting position
166166
\param shift shift in bytes
167167
*/
168-
bool shiftFileContent ( QFile *file, Q_LONG start, int shift );
168+
bool shiftFileContent ( QFile *file, qint64 start, int shift );
169169

170170
//! Set buttons up
171171
void setToolActionsOff (void);

src/app/composer/qgscomposerlabel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ QRectF QgsComposerLabel::boundingRect ( void ) const
207207
{
208208
// Recalculate sizes according to current font size
209209

210-
float size = 25.4 * mComposition->scale() * mFont.pointSizeFloat() / 72;
210+
float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
211211

212212
QFont font ( mFont );
213213
font.setPointSizeF ( size );

src/app/composer/qgscomposermap.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ void QgsComposerMap::init ()
9696
mCacheUpdated = false;
9797

9898
// Calculate
99-
mCalculateComboBox->insertItem( tr("Extent (calculate scale)"), Scale );
100-
mCalculateComboBox->insertItem( tr("Scale (calculate extent)"), Extent );
99+
mCalculateComboBox->addItem( tr("Extent (calculate scale)"), Scale );
100+
mCalculateComboBox->addItem( tr("Scale (calculate extent)"), Extent );
101101
mCalculate = Scale;
102102

103103
setPlotStyle ( QgsComposition::Preview );
104104

105105
// Preview style
106106
mPreviewMode = Cache;
107-
mPreviewModeComboBox->insertItem ( tr("Cache"), Cache );
108-
mPreviewModeComboBox->insertItem ( tr("Render"), Render );
109-
mPreviewModeComboBox->insertItem ( tr("Rectangle"), Rectangle );
110-
mPreviewModeComboBox->setCurrentItem ( Cache );
107+
mPreviewModeComboBox->addItem ( tr("Cache"), Cache );
108+
mPreviewModeComboBox->addItem ( tr("Render"), Render );
109+
mPreviewModeComboBox->addItem ( tr("Rectangle"), Rectangle );
110+
mPreviewModeComboBox->setCurrentIndex ( Cache );
111111

112112
mWidthScale = 1.0 / mComposition->scale();
113113
mSymbolScale = 0.5;
@@ -327,7 +327,7 @@ void QgsComposerMap::on_mHeightLineEdit_editingFinished ( void ) { sizeChanged()
327327

328328
void QgsComposerMap::on_mCalculateComboBox_activated( int )
329329
{
330-
mCalculate = mCalculateComboBox->currentItem();
330+
mCalculate = mCalculateComboBox->currentIndex();
331331

332332
if ( mCalculate == Scale )
333333
{
@@ -384,7 +384,7 @@ void QgsComposerMap::on_mScaleLineEdit_editingFinished()
384384
#ifdef QGISDEBUG
385385
std::cout << "QgsComposerMap::on_mScaleLineEdit_editingFinished" << std::endl;
386386
#endif
387-
mCalculate = mCalculateComboBox->currentItem();
387+
mCalculate = mCalculateComboBox->currentIndex();
388388

389389
mUserScale = mScaleLineEdit->text().toDouble();
390390

@@ -508,7 +508,7 @@ void QgsComposerMap::setOptions ( void )
508508

509509
mNameLabel->setText ( mName );
510510

511-
mCalculateComboBox->setCurrentItem( mCalculate );
511+
mCalculateComboBox->setCurrentIndex( mCalculate );
512512

513513
mWidthLineEdit->setText ( QString("%1").arg( mComposition->toMM((int)QGraphicsRectItem::rect().width()), 0,'g') );
514514
mHeightLineEdit->setText ( QString("%1").arg( mComposition->toMM((int)QGraphicsRectItem::rect().height()),0,'g') );
@@ -536,7 +536,7 @@ void QgsComposerMap::setOptions ( void )
536536

537537
mFrameCheckBox->setChecked ( mFrame );
538538

539-
mPreviewModeComboBox->setCurrentItem( mPreviewMode );
539+
mPreviewModeComboBox->setCurrentIndex( mPreviewMode );
540540
}
541541

542542
void QgsComposerMap::on_mSetCurrentExtentButton_clicked ( void )

src/app/composer/qgscomposerpicture.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void QgsComposerPicture::loadPicture ( void )
121121

122122
if ( !mPicturePath.isNull() )
123123
{
124-
if ( mPicturePath.lower().right(3) == "svg" )
124+
if ( mPicturePath.toLower().right(3) == "svg" )
125125
{
126126
if ( !mPicture.load ( mPicturePath, "svg" ) )
127127
{
@@ -469,14 +469,14 @@ QString QgsComposerPicture::pictureDialog ( void )
469469
for ( int i = 0; i < formats.count(); i++ )
470470
{
471471
QString frmt = formats.at( i );
472-
QString fltr = " *." + frmt.lower() + " *." + frmt.upper();
472+
QString fltr = " *." + frmt.toLower() + " *." + frmt.toUpper();
473473
filters += fltr;
474474
}
475475
filters += ");;All other files (*.*)";
476476

477477
// Retrieve the last used directory
478478
QSettings settings;
479-
QString lastUsedDir = settings.readEntry("/UI/lastComposerPictureDir", ".");
479+
QString lastUsedDir = settings.value("/UI/lastComposerPictureDir", ".").toString();
480480

481481
QString file = QFileDialog::getOpenFileName(
482482
0,
@@ -486,8 +486,8 @@ QString QgsComposerPicture::pictureDialog ( void )
486486
if (file.length() != 0)
487487
{
488488
QFileInfo myFile(file);
489-
QString myPath = myFile.dirPath();
490-
settings.writeEntry("/UI/lastComposerPictureDir", myPath);
489+
QString myPath = myFile.path();
490+
settings.setValue("/UI/lastComposerPictureDir", myPath);
491491
}
492492

493493
return file;

src/app/composer/qgscomposerscalebar.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ QRectF QgsComposerScalebar::render(QPainter * p)
243243
// labels
244244

245245
// Font size in canvas units
246-
float size = 25.4 * mComposition->scale() * mFont.pointSizeFloat() / 72;
246+
float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
247247

248248

249249
// Create QFontMetrics so we can correctly place the text
250250
QFont font(mFont);
251-
font.setPointSizeFloat(size);
251+
font.setPointSizeF(size);
252252
QFontMetrics metrics(font);
253253

254-
font.setPointSizeFloat(size * FONT_WORKAROUND_SCALE); //hack to work around Qt font bug
254+
font.setPointSizeF(size * FONT_WORKAROUND_SCALE); //hack to work around Qt font bug
255255

256256
if (plotStyle() == QgsComposition::Postscript)
257257
{
@@ -467,24 +467,24 @@ void QgsComposerScalebar::setOptions(void)
467467
mMaps.clear();
468468

469469
bool found = false;
470-
mMapComboBox->insertItem("", 0);
470+
mMapComboBox->addItem("");
471471
mMaps.push_back(0);
472472
for (int i = 0; i < (int)maps.size(); i++)
473473
{
474-
mMapComboBox->insertItem(maps[i]->name(), i + 1);
474+
mMapComboBox->addItem(maps[i]->name());
475475
mMaps.push_back(maps[i]->id());
476476

477477
if (maps[i]->id() == mMap)
478478
{
479479
found = true;
480-
mMapComboBox->setCurrentItem(i + 1);
480+
mMapComboBox->setCurrentIndex(i + 1);
481481
}
482482
}
483483

484484
if (!found)
485485
{
486486
mMap = 0;
487-
mMapComboBox->setCurrentItem(0);
487+
mMapComboBox->setCurrentIndex(0);
488488
}
489489
}
490490

src/app/composer/qgscomposervectorlegend.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ void QgsComposerVectorLegend::init ( void )
131131

132132
// Preview style
133133
mPreviewMode = Render;
134-
mPreviewModeComboBox->insertItem ( tr("Cache"), Cache );
135-
mPreviewModeComboBox->insertItem ( tr("Render"), Render );
136-
mPreviewModeComboBox->insertItem ( tr("Rectangle"), Rectangle );
137-
mPreviewModeComboBox->setCurrentItem ( mPreviewMode );
134+
mPreviewModeComboBox->addItem ( tr("Cache"), Cache );
135+
mPreviewModeComboBox->addItem ( tr("Render"), Render );
136+
mPreviewModeComboBox->addItem ( tr("Rectangle"), Rectangle );
137+
mPreviewModeComboBox->setCurrentIndex ( mPreviewMode );
138138

139139
connect ( mComposition, SIGNAL(mapChanged(int)), this, SLOT(mapChanged(int)) );
140140
}
@@ -164,9 +164,9 @@ QRectF QgsComposerVectorLegend::render ( QPainter *p )
164164
//std::cout << "mComposition->scale() = " << mComposition->scale() << std::endl;
165165

166166
// Font size in canvas units
167-
float titleSize = 25.4 * mComposition->scale() * mTitleFont.pointSizeFloat() / 72;
168-
float sectionSize = 25.4 * mComposition->scale() * mSectionFont.pointSizeFloat() / 72;
169-
float size = 25.4 * mComposition->scale() * mFont.pointSizeFloat() / 72;
167+
float titleSize = 25.4 * mComposition->scale() * mTitleFont.pointSizeF() / 72;
168+
float sectionSize = 25.4 * mComposition->scale() * mSectionFont.pointSizeF() / 72;
169+
float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
170170

171171
//std::cout << "font sizes = " << titleSize << " " << sectionSize << " " << size << std::endl;
172172

@@ -175,9 +175,9 @@ QRectF QgsComposerVectorLegend::render ( QPainter *p )
175175
QFont sectionFont ( mSectionFont );
176176
QFont font ( mFont );
177177

178-
titleFont.setPointSizeFloat ( titleSize );
179-
sectionFont.setPointSizeFloat ( sectionSize );
180-
font.setPointSizeFloat ( size );
178+
titleFont.setPointSizeF ( titleSize );
179+
sectionFont.setPointSizeF ( sectionSize );
180+
font.setPointSizeF ( size );
181181

182182
// Not sure about Style Strategy, QFont::PreferMatch?
183183
titleFont.setStyleStrategy ( (QFont::StyleStrategy) (QFont::PreferOutline | QFont::PreferAntialias) );
@@ -196,15 +196,15 @@ QRectF QgsComposerVectorLegend::render ( QPainter *p )
196196
double psSectionSize = sectionMetrics.ascent() * 72.0 / mComposition->resolution();
197197
double psSize = metrics.ascent() * 72.0 / mComposition->resolution();
198198

199-
titleFont.setPointSizeFloat ( psTitleSize * FONT_WORKAROUND_SCALE );
200-
sectionFont.setPointSizeFloat ( psSectionSize * FONT_WORKAROUND_SCALE );
201-
font.setPointSizeFloat ( psSize * FONT_WORKAROUND_SCALE );
199+
titleFont.setPointSizeF ( psTitleSize * FONT_WORKAROUND_SCALE );
200+
sectionFont.setPointSizeF ( psSectionSize * FONT_WORKAROUND_SCALE );
201+
font.setPointSizeF ( psSize * FONT_WORKAROUND_SCALE );
202202
}
203203
else
204204
{
205-
titleFont.setPointSizeFloat ( titleSize * FONT_WORKAROUND_SCALE );
206-
sectionFont.setPointSizeFloat ( sectionSize * FONT_WORKAROUND_SCALE );
207-
font.setPointSizeFloat ( size * FONT_WORKAROUND_SCALE );
205+
titleFont.setPointSizeF ( titleSize * FONT_WORKAROUND_SCALE );
206+
sectionFont.setPointSizeF ( sectionSize * FONT_WORKAROUND_SCALE );
207+
font.setPointSizeF ( size * FONT_WORKAROUND_SCALE );
208208
}
209209

210210
double x, y;
@@ -605,21 +605,21 @@ void QgsComposerVectorLegend::recalculate ( void )
605605

606606
// Title and section font
607607
mTitleFont = mFont;
608-
mTitleFont.setPointSizeFloat ( 1.4 * mFont.pointSizeFloat());
608+
mTitleFont.setPointSizeF ( 1.4 * mFont.pointSizeF());
609609
mSectionFont = mFont;
610-
mSectionFont.setPointSizeFloat ( 1.2 * mFont.pointSizeFloat() );
610+
mSectionFont.setPointSizeF ( 1.2 * mFont.pointSizeF() );
611611

612612
// Font size in canvas units
613-
float size = 25.4 * mComposition->scale() * mFont.pointSizeFloat() / 72;
613+
float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
614614

615615
mMargin = 0.9 * size;
616616
mSymbolHeight = 1.3 * size;
617617
mSymbolWidth = 3.5 * size;
618618
mSymbolSpace = 0.4 * size;
619619

620620
#ifdef QGISDEBUG
621-
std::cout << "font size = " << mFont.pointSizeFloat() << std::endl;
622-
std::cout << "title font size = " << mTitleFont.pointSizeFloat() << std::endl;
621+
std::cout << "font size = " << mFont.pointSizeF() << std::endl;
622+
std::cout << "title font size = " << mTitleFont.pointSizeF() << std::endl;
623623

624624
std::cout << "mMargin = " << mMargin << " mSymbolHeight = " << mSymbolHeight
625625
<< "mSymbolWidth = " << mSymbolWidth << " mSymbolSpace = " << mSymbolSpace << std::endl;
@@ -643,21 +643,21 @@ void QgsComposerVectorLegend::setOptions ( void )
643643
mMaps.clear();
644644

645645
bool found = false;
646-
mMapComboBox->insertItem ( "", 0 );
646+
mMapComboBox->addItem ( "" );
647647
mMaps.push_back ( 0 );
648648
for ( int i = 0; i < (int)maps.size(); i++ ) {
649-
mMapComboBox->insertItem ( maps[i]->name(), i+1 );
649+
mMapComboBox->addItem ( maps[i]->name() );
650650
mMaps.push_back ( maps[i]->id() );
651651

652652
if ( maps[i]->id() == mMap ) {
653653
found = true;
654-
mMapComboBox->setCurrentItem ( i+1 );
654+
mMapComboBox->setCurrentIndex ( i+1 );
655655
}
656656
}
657657

658658
if ( ! found ) {
659659
mMap = 0;
660-
mMapComboBox->setCurrentItem ( 0 );
660+
mMapComboBox->setCurrentIndex ( 0 );
661661
}
662662

663663
mFrameCheckBox->setChecked ( mFrame );
@@ -694,7 +694,7 @@ void QgsComposerVectorLegend::setOptions ( void )
694694
}
695695
}
696696

697-
mPreviewModeComboBox->setCurrentItem( mPreviewMode );
697+
mPreviewModeComboBox->setCurrentIndex( mPreviewMode );
698698
}
699699

700700
void QgsComposerVectorLegend::setSelected ( bool s )
@@ -914,7 +914,7 @@ bool QgsComposerVectorLegend::readSettings ( void )
914914
QStringList el = QgsProject::instance()->subkeyList ( "Compositions", path );
915915

916916
for ( QStringList::iterator it = el.begin(); it != el.end(); ++it ) {
917-
int idx = (*it).find('_');
917+
int idx = (*it).indexOf('_');
918918

919919
QString id = (*it).right( (*it).length() - (idx+1) );
920920

src/app/composer/qgscomposition.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
#include "qgsproject.h"
3232

3333
#include <QGraphicsRectItem>
34+
#include <QKeyEvent>
3435
#include <QMatrix>
3536
#include <QMessageBox>
37+
#include <QMouseEvent>
3638

3739
#include <iostream>
3840
#include <math.h>
@@ -101,7 +103,7 @@ QgsComposition::QgsComposition( QgsComposer *c, int id )
101103

102104
mPaper = mDefaultPaper = mCustomPaper = 0;
103105
for( int i = 0; i < (int)mPapers.size(); i++ ) {
104-
mPaperSizeComboBox->insertItem( mPapers[i].mName );
106+
mPaperSizeComboBox->addItem( mPapers[i].mName );
105107
// Map - A4 land for now, if future read from template
106108
if ( mPapers[i].mWidth == 210 && mPapers[i].mHeight == 297 ){
107109
mDefaultPaper = i;
@@ -110,11 +112,11 @@ QgsComposition::QgsComposition( QgsComposer *c, int id )
110112
}
111113

112114
// Orientation
113-
mPaperOrientationComboBox->insertItem( tr("Portrait"), Portrait );
114-
mPaperOrientationComboBox->insertItem( tr("Landscape"), Landscape );
115+
mPaperOrientationComboBox->addItem( tr("Portrait"), Portrait );
116+
mPaperOrientationComboBox->addItem( tr("Landscape"), Landscape );
115117
mPaperOrientation = Landscape;
116118

117-
mPaperUnitsComboBox->insertItem( "mm" );
119+
mPaperUnitsComboBox->addItem( "mm" );
118120

119121
// Create canvas
120122
mPaperWidth = 1;
@@ -130,8 +132,8 @@ QgsComposition::QgsComposition( QgsComposer *c, int id )
130132

131133
void QgsComposition::createDefault(void)
132134
{
133-
mPaperSizeComboBox->setCurrentItem(mDefaultPaper);
134-
mPaperOrientationComboBox->setCurrentItem(Landscape);
135+
mPaperSizeComboBox->setCurrentIndex(mDefaultPaper);
136+
mPaperOrientationComboBox->setCurrentIndex(Landscape);
135137

136138
mUserPaperWidth = mPapers[mDefaultPaper].mWidth;
137139
mUserPaperHeight = mPapers[mDefaultPaper].mHeight;
@@ -598,8 +600,8 @@ void QgsComposition::paperSizeChanged ( void )
598600
std::cout << "QgsComposition::paperSizeChanged" << std::endl;
599601
#endif
600602

601-
mPaper = mPaperSizeComboBox->currentItem();
602-
mPaperOrientation = mPaperOrientationComboBox->currentItem();
603+
mPaper = mPaperSizeComboBox->currentIndex();
604+
mPaperOrientation = mPaperOrientationComboBox->currentIndex();
603605
#ifdef QGISDEBUG
604606
std::cout << "custom = " << mPapers[mPaper].mCustom << std::endl;
605607
std::cout << "orientation = " << mPaperOrientation << std::endl;
@@ -663,8 +665,8 @@ void QgsComposition::resolutionChanged ( void )
663665

664666
void QgsComposition::setOptions ( void )
665667
{
666-
mPaperSizeComboBox->setCurrentItem(mPaper);
667-
mPaperOrientationComboBox->setCurrentItem(mPaperOrientation);
668+
mPaperSizeComboBox->setCurrentIndex(mPaper);
669+
mPaperOrientationComboBox->setCurrentIndex(mPaperOrientation);
668670
mPaperWidthLineEdit->setText ( QString("%1").arg(mUserPaperWidth,0,'g') );
669671
mPaperHeightLineEdit->setText ( QString("%1").arg(mUserPaperHeight,0,'g') );
670672
mResolutionLineEdit->setText ( QString("%1").arg(mResolution) );
@@ -936,7 +938,7 @@ bool QgsComposition::readSettings ( void )
936938
std::cout << "key: " << (*it).toLocal8Bit().data() << std::endl;
937939
#endif
938940

939-
QStringList l = QStringList::split( '_', (*it) );
941+
QStringList l = it->split( '_', QString::SkipEmptyParts );
940942
if ( l.size() == 2 ) {
941943
QString name = l.first();
942944
QString ids = l.last();
@@ -956,7 +958,7 @@ bool QgsComposition::readSettings ( void )
956958
std::cout << "key: " << (*it).toLocal8Bit().data() << std::endl;
957959
#endif
958960

959-
QStringList l = QStringList::split( '_', (*it) );
961+
QStringList l = it->split( '_', QString::SkipEmptyParts );
960962
if ( l.size() == 2 ) {
961963
QString name = l.first();
962964
QString ids = l.last();

0 commit comments

Comments
 (0)