Skip to content
Permalink
Browse files

remove #ifdefs related to no longer supported Qt versions

git-svn-id: http://svn.osgeo.org/qgis/trunk@13042 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 10, 2010
1 parent 9da13b6 commit 8ffb723b015a6d1b9eff3726302a4c625c1e61f7
@@ -59,11 +59,7 @@
#include <QSettings>
#include <QIcon>
#include <QPixmap>
#if QT_VERSION < 0x040300
#include <Q3Picture>
#else
#include <QSvgGenerator>
#endif
#include <QToolBar>
#include <QToolButton>
#include <QImageWriter>
@@ -554,16 +550,10 @@ void QgsComposer::print( QPrinter &printer )
}
else
{
#if QT_VERSION < 0x040400
QRectF paperRect( 0, 0, mComposition->paperWidth(), mComposition->paperHeight() );
QRect pageRect = printer.pageRect();
mComposition->render( &p, pageRect, paperRect );
#else
//better in case of custom page size, but only possible with Qt>=4.4.0
QRectF paperRectMM = printer.pageRect( QPrinter::Millimeter );
QRectF paperRectPixel = printer.pageRect( QPrinter::DevicePixel );
mComposition->render( &p, paperRectPixel, paperRectMM );
#endif
}
mComposition->setPlotStyle( savedPlotStyle );
QApplication::restoreOverrideCursor();
@@ -555,15 +555,8 @@ int main( int argc, char *argv[] )
}
else
{
#if defined(Q_OS_MACX) && QT_VERSION < 0x040300
//on mac automasking as done below does not work (as of qt 4.2.1)
//so we do it the old way see bug #387
QPixmap myMaskPixmap( mySplashPath + QString( "splash_mask.png" ), 0, Qt::ThresholdDither | Qt::ThresholdAlphaDither | Qt::AvoidDither );
mypSplash->setMask( myMaskPixmap.createHeuristicMask() );
#else
//for win and linux we can just automask and png transparency areas will be used
mypSplash->setMask( myPixmap.mask() );
#endif
mypSplash->show();
}

@@ -40,9 +40,7 @@ QgsAttributeActionDialog::QgsAttributeActionDialog( QgsAttributeAction* actions,
header->setStretchLastSection( true );
attributeActionTable->setColumnWidth( 0, 100 );
attributeActionTable->setColumnWidth( 1, 230 );
#if QT_VERSION >= 0x040300
attributeActionTable->setCornerButtonEnabled( false );
#endif

connect( attributeActionTable, SIGNAL( itemSelectionChanged() ),
this, SLOT( itemSelectionChanged() ) );
@@ -271,16 +269,6 @@ void QgsAttributeActionDialog::itemSelectionChanged()
QList<QTableWidgetItem *> selection = attributeActionTable->selectedItems();
if ( !selection.isEmpty() )
{
#if QT_VERSION < 0x040400
// Supress multiple selection and select row where mouse release occurs.
// Workaround for Qt 4.3 bug which allows multiple rows to be selected if
// the user presses the mouse in one row header and releases in another.
if ( attributeActionTable->row( selection.first() ) != attributeActionTable->row( selection.last() ) )
{
attributeActionTable->selectRow( attributeActionTable->currentRow() );
selection = attributeActionTable->selectedItems();
}
#endif
rowSelected( attributeActionTable->row( selection.first() ) );
}
}
@@ -23,11 +23,6 @@
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"

#if QT_VERSION < 0x040300
#define toPlainText() text()
#endif


// constructor used when the query builder must make its own
// connection to the database
QgsQueryBuilder::QgsQueryBuilder( QgsVectorLayer *layer,
@@ -26,11 +26,6 @@
#include "qgsvectorlayer.h"
#include "qgslogger.h"

#if QT_VERSION < 0x040300
#define toPlainText() text()
#endif


QgsSearchQueryBuilder::QgsSearchQueryBuilder( QgsVectorLayer* layer,
QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl ), mLayer( layer )
@@ -49,9 +44,9 @@ QgsSearchQueryBuilder::QgsSearchQueryBuilder( QgsVectorLayer* layer,
connect( pbn, SIGNAL( clicked() ), this, SLOT( on_btnClear_clicked() ) );

// disable unsupported operators
btnIn->setEnabled( false );
btnNotIn->setEnabled( false );
btnPct->setEnabled( false );
btnIn->setHidden( true );
btnNotIn->setHidden( true );
btnPct->setHidden( true );

// change to ~
btnILike->setText( "~" );
@@ -264,21 +259,6 @@ void QgsSearchQueryBuilder::on_btnGreaterThan_clicked()
txtSQL->insertPlainText( " > " );
}

void QgsSearchQueryBuilder::on_btnPct_clicked()
{
txtSQL->insertPlainText( " % " );
}

void QgsSearchQueryBuilder::on_btnIn_clicked()
{
txtSQL->insertPlainText( " IN " );
}

void QgsSearchQueryBuilder::on_btnNotIn_clicked()
{
txtSQL->insertPlainText( " NOT IN " );
}

void QgsSearchQueryBuilder::on_btnLike_clicked()
{
txtSQL->insertPlainText( " LIKE " );
@@ -55,9 +55,6 @@ class QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase
void on_btnOk_clicked();
void on_btnLessThan_clicked();
void on_btnGreaterThan_clicked();
void on_btnPct_clicked();
void on_btnIn_clicked();
void on_btnNotIn_clicked();
void on_btnLike_clicked();
void on_btnILike_clicked();

@@ -59,10 +59,6 @@
#include "qgsstylev2.h"
#include "qgssymbologyv2conversion.h"

#if QT_VERSION < 0x040300
#define toPlainText() text()
#endif


QgsVectorLayerProperties::QgsVectorLayerProperties(
QgsVectorLayer *lyr,
@@ -532,7 +532,6 @@ bool QgsHttpTransaction::applyProxySettings( QHttp& http, const QString& url )
{
proxyType = QNetworkProxy::HttpProxy;
}
#if QT_VERSION >= 0x040400
else if ( proxyTypeString == "HttpCachingProxy" )
{
proxyType = QNetworkProxy::HttpCachingProxy;
@@ -541,7 +540,6 @@ bool QgsHttpTransaction::applyProxySettings( QHttp& http, const QString& url )
{
proxyType = QNetworkProxy::FtpCachingProxy;
}
#endif
http.setProxy( QNetworkProxy( proxyType, proxyHost, proxyPort, proxyUser, proxyPassword ) );
return true;
}
@@ -44,12 +44,7 @@ namespace QgisGui
* Qt::WindowMaximizeButtonHint is included but will be ignored if
* the dialog is a fixed size and does not have a size grip.
*/
static const Qt::WFlags ModalDialogFlags =
#if QT_VERSION < 0x040200
Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint;
#else
0;
#endif
static const Qt::WFlags ModalDialogFlags = 0;

/**
Open files, preferring to have the default file selector be the
@@ -32,10 +32,7 @@
#include <QSpinBox>
#include <QCompleter>
#include <QHBoxLayout>

#if QT_VERSION >= 0x040400
#include <QPlainTextEdit>
#endif

void QgsAttributeEditor::selectFileName( void )
{
@@ -274,26 +271,17 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
{
QLineEdit *le = NULL;
QTextEdit *te = NULL;
#if QT_VERSION >= 0x040400
QPlainTextEdit *pte = NULL;
#endif

if ( editor )
{
le = qobject_cast<QLineEdit *>( editor );
te = qobject_cast<QTextEdit *>( editor );
#if QT_VERSION >= 0x040400
pte = qobject_cast<QPlainTextEdit *>( editor );
#endif
}
else if ( editType == QgsVectorLayer::TextEdit )
{
#if QT_VERSION >= 0x040400
pte = new QPlainTextEdit( parent );
#else
te = new QTextEdit( parent );
te->setAcceptRichText( false );
#endif
}
else
{
@@ -331,18 +319,14 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed

if ( te )
{
#if QT_VERSION >= 0x040400
te->setAcceptRichText( true );
#endif
myWidget = te;
}

#if QT_VERSION >= 0x040400
if ( pte )
{
myWidget = pte;
}
#endif
}
break;

@@ -424,19 +408,14 @@ bool QgsAttributeEditor::retrieveValue( QWidget *widget, QgsVectorLayer *vl, int
QTextEdit *te = qobject_cast<QTextEdit *>( widget );
if ( te )
{
#if QT_VERSION >= 0x040400
text = te->toHtml();
#else
text = te->toPlainText();
#endif
modified = te->document()->isModified();
if ( text == "NULL" )
{
text = QString::null;
}
}

#if QT_VERSION >= 0x040400
QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( widget );
if ( pte )
{
@@ -447,7 +426,6 @@ bool QgsAttributeEditor::retrieveValue( QWidget *widget, QgsVectorLayer *vl, int
text = QString::null;
}
}
#endif

QComboBox *cb = qobject_cast<QComboBox *>( widget );
if ( cb )
@@ -614,14 +592,9 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,
{
QLineEdit *le = qobject_cast<QLineEdit *>( editor );
QTextEdit *te = qobject_cast<QTextEdit *>( editor );
#if QT_VERSION >= 0x040400
QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( editor );
if ( !le && !te && !pte )
return false;
#else
if ( !le && !te )
return false;
#endif

QString text;
if ( value.isNull() )
@@ -634,15 +607,10 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,

if ( le )
le->setText( text );
#if QT_VERSION >= 0x040400
if ( te )
te->setHtml( text );
if ( pte )
pte->setPlainText( text );
#else
if ( te )
te->setPlainText( text );
#endif
}
break;

@@ -76,7 +76,7 @@ QgsColorButtonV2::QgsColorButtonV2( QWidget* parent )
}

QgsColorButtonV2::QgsColorButtonV2( QString text, QWidget* parent )
: QPushButton( text, parent )
: QPushButton( text, parent )
{
}

@@ -95,11 +95,7 @@ void QgsColorButtonV2::setColor( const QColor &color )
p.setPen( Qt::NoPen );
p.setRenderHint( QPainter::Antialiasing );
p.setBrush( color );
#if QT_VERSION >= 0x040400
p.drawRoundedRect( rect, 4, 4 );
#else
p.drawRect( rect );
#endif
p.end();

// set this pixmap as icon
@@ -36,11 +36,7 @@ void QgsCopyrightLabelPluginGui::on_buttonBox_accepted()
hide();
//close the dialog
emit changeFont( txtCopyrightText->currentFont() );
#if QT_VERSION < 0x040300
emit changeLabel( txtCopyrightText->text() );
#else
emit changeLabel( txtCopyrightText->toPlainText() );
#endif
emit changeColor( pbnColorChooser->color() );
emit changePlacement( cboPlacement->currentIndex() );
emit enableCopyrightLabel( cboxEnabled->isChecked() );
@@ -60,15 +60,6 @@ QgsGrassNewMapset::QgsGrassNewMapset( QgisInterface *iface,
QgsDebugMsg( "QgsGrassNewMapset()" );

setupUi( this );
#if QT_VERSION < 0x040400
// this is not done by Qt4.3 uic
addPage( WizardPage1 );
addPage( WizardPage2 );
addPage( WizardPage3 );
addPage( WizardPage4 );
addPage( WizardPage5 );
addPage( WizardPage6 );
#endif
#ifdef Q_WS_MAC
setWizardStyle( QWizard::ClassicStyle );
#endif
@@ -53,11 +53,6 @@ class CleanUpGlobalStatic

# define K_GLOBAL_STATIC_STRUCT_NAME(NAME)

#if QT_VERSION < 0x040400
# define Q_BASIC_ATOMIC_INITIALIZER Q_ATOMIC_INIT
# define testAndSetOrdered testAndSet
#endif

#define K_GLOBAL_STATIC(TYPE, NAME) K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ())

#define K_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \
@@ -21,11 +21,6 @@
#include <QSettings>
#include <QPrinter>

#if QT_VERSION < 0x040300
#define toPlainText() text()
#endif


//standard includes

QuickPrintGui::QuickPrintGui( QgsMapCanvas * thepMapCanvas,

0 comments on commit 8ffb723

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