Skip to content

Commit

Permalink
Remove use of Qt3 support inline routines which redirect old Qt3 name…
Browse files Browse the repository at this point in the history
…s 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
  • Loading branch information
telwertowski committed Jun 9, 2008
1 parent c5d01dc commit 784ce74
Show file tree
Hide file tree
Showing 96 changed files with 1,030 additions and 1,011 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ ENDIF (POSTGRES_FOUND)
# search for Qt4
FIND_PACKAGE(Qt4 REQUIRED)

SET( QT_USE_QT3SUPPORT TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTSVG TRUE )
Expand Down
152 changes: 77 additions & 75 deletions src/app/composer/qgscomposer.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/composer/qgscomposer.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public slots:
\param from starting position
\param shift shift in bytes
*/
bool shiftFileContent ( QFile *file, Q_LONG start, int shift );
bool shiftFileContent ( QFile *file, qint64 start, int shift );

//! Set buttons up
void setToolActionsOff (void);
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ QRectF QgsComposerLabel::boundingRect ( void ) const
{
// Recalculate sizes according to current font size

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

QFont font ( mFont );
font.setPointSizeF ( size );
Expand Down
20 changes: 10 additions & 10 deletions src/app/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ void QgsComposerMap::init ()
mCacheUpdated = false;

// Calculate
mCalculateComboBox->insertItem( tr("Extent (calculate scale)"), Scale );
mCalculateComboBox->insertItem( tr("Scale (calculate extent)"), Extent );
mCalculateComboBox->addItem( tr("Extent (calculate scale)"), Scale );
mCalculateComboBox->addItem( tr("Scale (calculate extent)"), Extent );
mCalculate = Scale;

setPlotStyle ( QgsComposition::Preview );

// Preview style
mPreviewMode = Cache;
mPreviewModeComboBox->insertItem ( tr("Cache"), Cache );
mPreviewModeComboBox->insertItem ( tr("Render"), Render );
mPreviewModeComboBox->insertItem ( tr("Rectangle"), Rectangle );
mPreviewModeComboBox->setCurrentItem ( Cache );
mPreviewModeComboBox->addItem ( tr("Cache"), Cache );
mPreviewModeComboBox->addItem ( tr("Render"), Render );
mPreviewModeComboBox->addItem ( tr("Rectangle"), Rectangle );
mPreviewModeComboBox->setCurrentIndex ( Cache );

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

void QgsComposerMap::on_mCalculateComboBox_activated( int )
{
mCalculate = mCalculateComboBox->currentItem();
mCalculate = mCalculateComboBox->currentIndex();

if ( mCalculate == Scale )
{
Expand Down Expand Up @@ -384,7 +384,7 @@ void QgsComposerMap::on_mScaleLineEdit_editingFinished()
#ifdef QGISDEBUG
std::cout << "QgsComposerMap::on_mScaleLineEdit_editingFinished" << std::endl;
#endif
mCalculate = mCalculateComboBox->currentItem();
mCalculate = mCalculateComboBox->currentIndex();

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

Expand Down Expand Up @@ -508,7 +508,7 @@ void QgsComposerMap::setOptions ( void )

mNameLabel->setText ( mName );

mCalculateComboBox->setCurrentItem( mCalculate );
mCalculateComboBox->setCurrentIndex( mCalculate );

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

mFrameCheckBox->setChecked ( mFrame );

mPreviewModeComboBox->setCurrentItem( mPreviewMode );
mPreviewModeComboBox->setCurrentIndex( mPreviewMode );
}

void QgsComposerMap::on_mSetCurrentExtentButton_clicked ( void )
Expand Down
10 changes: 5 additions & 5 deletions src/app/composer/qgscomposerpicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void QgsComposerPicture::loadPicture ( void )

if ( !mPicturePath.isNull() )
{
if ( mPicturePath.lower().right(3) == "svg" )
if ( mPicturePath.toLower().right(3) == "svg" )
{
if ( !mPicture.load ( mPicturePath, "svg" ) )
{
Expand Down Expand Up @@ -469,14 +469,14 @@ QString QgsComposerPicture::pictureDialog ( void )
for ( int i = 0; i < formats.count(); i++ )
{
QString frmt = formats.at( i );
QString fltr = " *." + frmt.lower() + " *." + frmt.upper();
QString fltr = " *." + frmt.toLower() + " *." + frmt.toUpper();
filters += fltr;
}
filters += ");;All other files (*.*)";

// Retrieve the last used directory
QSettings settings;
QString lastUsedDir = settings.readEntry("/UI/lastComposerPictureDir", ".");
QString lastUsedDir = settings.value("/UI/lastComposerPictureDir", ".").toString();

QString file = QFileDialog::getOpenFileName(
0,
Expand All @@ -486,8 +486,8 @@ QString QgsComposerPicture::pictureDialog ( void )
if (file.length() != 0)
{
QFileInfo myFile(file);
QString myPath = myFile.dirPath();
settings.writeEntry("/UI/lastComposerPictureDir", myPath);
QString myPath = myFile.path();
settings.setValue("/UI/lastComposerPictureDir", myPath);
}

return file;
Expand Down
14 changes: 7 additions & 7 deletions src/app/composer/qgscomposerscalebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,15 @@ QRectF QgsComposerScalebar::render(QPainter * p)
// labels

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


// Create QFontMetrics so we can correctly place the text
QFont font(mFont);
font.setPointSizeFloat(size);
font.setPointSizeF(size);
QFontMetrics metrics(font);

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

if (plotStyle() == QgsComposition::Postscript)
{
Expand Down Expand Up @@ -467,24 +467,24 @@ void QgsComposerScalebar::setOptions(void)
mMaps.clear();

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

if (maps[i]->id() == mMap)
{
found = true;
mMapComboBox->setCurrentItem(i + 1);
mMapComboBox->setCurrentIndex(i + 1);
}
}

if (!found)
{
mMap = 0;
mMapComboBox->setCurrentItem(0);
mMapComboBox->setCurrentIndex(0);
}
}

Expand Down
54 changes: 27 additions & 27 deletions src/app/composer/qgscomposervectorlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ void QgsComposerVectorLegend::init ( void )

// Preview style
mPreviewMode = Render;
mPreviewModeComboBox->insertItem ( tr("Cache"), Cache );
mPreviewModeComboBox->insertItem ( tr("Render"), Render );
mPreviewModeComboBox->insertItem ( tr("Rectangle"), Rectangle );
mPreviewModeComboBox->setCurrentItem ( mPreviewMode );
mPreviewModeComboBox->addItem ( tr("Cache"), Cache );
mPreviewModeComboBox->addItem ( tr("Render"), Render );
mPreviewModeComboBox->addItem ( tr("Rectangle"), Rectangle );
mPreviewModeComboBox->setCurrentIndex ( mPreviewMode );

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

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

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

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

titleFont.setPointSizeFloat ( titleSize );
sectionFont.setPointSizeFloat ( sectionSize );
font.setPointSizeFloat ( size );
titleFont.setPointSizeF ( titleSize );
sectionFont.setPointSizeF ( sectionSize );
font.setPointSizeF ( size );

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

titleFont.setPointSizeFloat ( psTitleSize * FONT_WORKAROUND_SCALE );
sectionFont.setPointSizeFloat ( psSectionSize * FONT_WORKAROUND_SCALE );
font.setPointSizeFloat ( psSize * FONT_WORKAROUND_SCALE );
titleFont.setPointSizeF ( psTitleSize * FONT_WORKAROUND_SCALE );
sectionFont.setPointSizeF ( psSectionSize * FONT_WORKAROUND_SCALE );
font.setPointSizeF ( psSize * FONT_WORKAROUND_SCALE );
}
else
{
titleFont.setPointSizeFloat ( titleSize * FONT_WORKAROUND_SCALE );
sectionFont.setPointSizeFloat ( sectionSize * FONT_WORKAROUND_SCALE );
font.setPointSizeFloat ( size * FONT_WORKAROUND_SCALE );
titleFont.setPointSizeF ( titleSize * FONT_WORKAROUND_SCALE );
sectionFont.setPointSizeF ( sectionSize * FONT_WORKAROUND_SCALE );
font.setPointSizeF ( size * FONT_WORKAROUND_SCALE );
}

double x, y;
Expand Down Expand Up @@ -605,21 +605,21 @@ void QgsComposerVectorLegend::recalculate ( void )

// Title and section font
mTitleFont = mFont;
mTitleFont.setPointSizeFloat ( 1.4 * mFont.pointSizeFloat());
mTitleFont.setPointSizeF ( 1.4 * mFont.pointSizeF());
mSectionFont = mFont;
mSectionFont.setPointSizeFloat ( 1.2 * mFont.pointSizeFloat() );
mSectionFont.setPointSizeF ( 1.2 * mFont.pointSizeF() );

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

mMargin = 0.9 * size;
mSymbolHeight = 1.3 * size;
mSymbolWidth = 3.5 * size;
mSymbolSpace = 0.4 * size;

#ifdef QGISDEBUG
std::cout << "font size = " << mFont.pointSizeFloat() << std::endl;
std::cout << "title font size = " << mTitleFont.pointSizeFloat() << std::endl;
std::cout << "font size = " << mFont.pointSizeF() << std::endl;
std::cout << "title font size = " << mTitleFont.pointSizeF() << std::endl;

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

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

if ( maps[i]->id() == mMap ) {
found = true;
mMapComboBox->setCurrentItem ( i+1 );
mMapComboBox->setCurrentIndex ( i+1 );
}
}

if ( ! found ) {
mMap = 0;
mMapComboBox->setCurrentItem ( 0 );
mMapComboBox->setCurrentIndex ( 0 );
}

mFrameCheckBox->setChecked ( mFrame );
Expand Down Expand Up @@ -694,7 +694,7 @@ void QgsComposerVectorLegend::setOptions ( void )
}
}

mPreviewModeComboBox->setCurrentItem( mPreviewMode );
mPreviewModeComboBox->setCurrentIndex( mPreviewMode );
}

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

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

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

Expand Down
26 changes: 14 additions & 12 deletions src/app/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
#include "qgsproject.h"

#include <QGraphicsRectItem>
#include <QKeyEvent>
#include <QMatrix>
#include <QMessageBox>
#include <QMouseEvent>

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

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

// Orientation
mPaperOrientationComboBox->insertItem( tr("Portrait"), Portrait );
mPaperOrientationComboBox->insertItem( tr("Landscape"), Landscape );
mPaperOrientationComboBox->addItem( tr("Portrait"), Portrait );
mPaperOrientationComboBox->addItem( tr("Landscape"), Landscape );
mPaperOrientation = Landscape;

mPaperUnitsComboBox->insertItem( "mm" );
mPaperUnitsComboBox->addItem( "mm" );

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

void QgsComposition::createDefault(void)
{
mPaperSizeComboBox->setCurrentItem(mDefaultPaper);
mPaperOrientationComboBox->setCurrentItem(Landscape);
mPaperSizeComboBox->setCurrentIndex(mDefaultPaper);
mPaperOrientationComboBox->setCurrentIndex(Landscape);

mUserPaperWidth = mPapers[mDefaultPaper].mWidth;
mUserPaperHeight = mPapers[mDefaultPaper].mHeight;
Expand Down Expand Up @@ -598,8 +600,8 @@ void QgsComposition::paperSizeChanged ( void )
std::cout << "QgsComposition::paperSizeChanged" << std::endl;
#endif

mPaper = mPaperSizeComboBox->currentItem();
mPaperOrientation = mPaperOrientationComboBox->currentItem();
mPaper = mPaperSizeComboBox->currentIndex();
mPaperOrientation = mPaperOrientationComboBox->currentIndex();
#ifdef QGISDEBUG
std::cout << "custom = " << mPapers[mPaper].mCustom << std::endl;
std::cout << "orientation = " << mPaperOrientation << std::endl;
Expand Down Expand Up @@ -663,8 +665,8 @@ void QgsComposition::resolutionChanged ( void )

void QgsComposition::setOptions ( void )
{
mPaperSizeComboBox->setCurrentItem(mPaper);
mPaperOrientationComboBox->setCurrentItem(mPaperOrientation);
mPaperSizeComboBox->setCurrentIndex(mPaper);
mPaperOrientationComboBox->setCurrentIndex(mPaperOrientation);
mPaperWidthLineEdit->setText ( QString("%1").arg(mUserPaperWidth,0,'g') );
mPaperHeightLineEdit->setText ( QString("%1").arg(mUserPaperHeight,0,'g') );
mResolutionLineEdit->setText ( QString("%1").arg(mResolution) );
Expand Down Expand Up @@ -936,7 +938,7 @@ bool QgsComposition::readSettings ( void )
std::cout << "key: " << (*it).toLocal8Bit().data() << std::endl;
#endif

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

QStringList l = QStringList::split( '_', (*it) );
QStringList l = it->split( '_', QString::SkipEmptyParts );
if ( l.size() == 2 ) {
QString name = l.first();
QString ids = l.last();
Expand Down
Loading

0 comments on commit 784ce74

Please sign in to comment.