Skip to content

Commit 364df1c

Browse files
committedJul 4, 2011
Merge branch 'master' of github.com:qgis/Quantum-GIS
2 parents 934e56f + a946a20 commit 364df1c

17 files changed

+416
-282
lines changed
 

‎python/gui/qgscomposerview.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,9 @@ class QgsComposerView: QGraphicsView
107107
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
108108
QgsComposer may set the selection tool again*/
109109
void actionFinished();
110+
111+
/**Emitted before composerview is shown*/
112+
void composerViewShow( QgsComposerView* );
113+
/**Emitted before composerview is hidden*/
114+
void composerViewHide( QgsComposerView* );
110115
};

‎src/app/composer/qgscomposer.cpp

100644100755
Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@
6666
#include <QToolBar>
6767
#include <QToolButton>
6868
#include <QUndoView>
69-
70-
71-
69+
#include <QPaintEngine>
7270

7371

7472
QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ): QMainWindow(), mTitle( title ), mUndoView( 0 )
@@ -486,6 +484,38 @@ void QgsComposer::on_mActionRefreshView_triggered()
486484
mComposition->update();
487485
}
488486

487+
// Hack to workaround Qt #5114 by disabling PatternTransform
488+
class QgsPaintEngineHack : public QPaintEngine
489+
{
490+
public:
491+
void fixFlags()
492+
{
493+
gccaps = 0;
494+
gccaps |= ( QPaintEngine::PrimitiveTransform
495+
// | QPaintEngine::PatternTransform
496+
| QPaintEngine::PixmapTransform
497+
// | QPaintEngine::PatternBrush
498+
// | QPaintEngine::LinearGradientFill
499+
// | QPaintEngine::RadialGradientFill
500+
// | QPaintEngine::ConicalGradientFill
501+
| QPaintEngine::AlphaBlend
502+
// | QPaintEngine::PorterDuff
503+
| QPaintEngine::PainterPaths
504+
| QPaintEngine::Antialiasing
505+
| QPaintEngine::BrushStroke
506+
| QPaintEngine::ConstantOpacity
507+
| QPaintEngine::MaskedBrush
508+
// | QPaintEngine::PerspectiveTransform
509+
| QPaintEngine::BlendModes
510+
// | QPaintEngine::ObjectBoundingModeGradients
511+
#if QT_VERSION >= 0x040500
512+
| QPaintEngine::RasterOpModes
513+
#endif
514+
| QPaintEngine::PaintOutsidePaintEvent
515+
);
516+
}
517+
};
518+
489519
void QgsComposer::on_mActionExportAsPDF_triggered()
490520
{
491521
QSettings myQSettings; // where we keep last used filter in persistent state
@@ -521,6 +551,14 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
521551
printer.setOutputFileName( myOutputFileNameQString );
522552
printer.setPaperSize( QSizeF( mComposition->paperWidth(), mComposition->paperHeight() ), QPrinter::Millimeter );
523553

554+
QPaintEngine *engine = printer.paintEngine();
555+
if ( engine && engine->hasFeature( QPaintEngine::PatternTransform ) )
556+
{
557+
QgsPaintEngineHack *hack = static_cast<QgsPaintEngineHack*>( engine );
558+
hack->fixFlags();
559+
Q_ASSERT( !engine->hasFeature( QPaintEngine::PatternTransform ) );
560+
}
561+
524562
print( printer );
525563
}
526564

‎src/app/qgsfieldcalculator.cpp

100755100644
File mode changed.

‎src/app/spatialite/qgsspatialitesourceselect.cpp

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QgisApp * app, Qt::WFlags
9191
mSearchModeComboBox->setVisible( false );
9292
mSearchModeLabel->setVisible( false );
9393
mSearchTableEdit->setVisible( false );
94-
cbxAllowGeometrylessTables->setVisible( false );
94+
95+
cbxAllowGeometrylessTables->setDisabled( true );
9596
}
9697

9798
// Slot for performing action when the Add button is clicked
@@ -113,6 +114,11 @@ void QgsSpatiaLiteSourceSelect::buildQuery()
113114
setSql( mTablesTreeView->currentIndex() );
114115
}
115116

117+
void QgsSpatiaLiteSourceSelect::on_cbxAllowGeometrylessTables_stateChanged( int )
118+
{
119+
on_btnConnect_clicked();
120+
}
121+
116122
void QgsSpatiaLiteSourceSelect::on_mTablesTreeView_clicked( const QModelIndex &index )
117123
{
118124
mBuildQueryButton->setEnabled( index.parent().isValid() );
@@ -269,13 +275,8 @@ sqlite3 *QgsSpatiaLiteSourceSelect::openSpatiaLiteDb( QString path )
269275
if ( gcSpatiaLite && rsSpatiaLite )
270276
return handle;
271277

272-
// this one cannot be a valid SpatiaLite DB - no Spatial MetaData where found
273-
closeSpatiaLiteDb( handle );
274-
errCause = tr( "seems to be a valid SQLite DB, but not a SpatiaLite's one ..." );
275-
QMessageBox::critical( this, tr( "SpatiaLite DB Open Error" ),
276-
tr( "Failure while connecting to: %1\n\n%2" ).arg( mSqlitePath ).arg( errCause ) );
277-
mSqlitePath = "";
278-
return NULL;
278+
// this seems to be a valid SQLite DB, but not a SpatiaLite's one
279+
return handle;
279280

280281
error:
281282
// unexpected IO error
@@ -471,6 +472,8 @@ void QgsSpatiaLiteSourceSelect::on_btnConnect_clicked()
471472
{
472473
sqlite3 *handle;
473474

475+
cbxAllowGeometrylessTables->setEnabled( false );
476+
474477
QSettings settings;
475478
QString subKey = cmbConnections->currentText();
476479
int idx = subKey.indexOf( "@" );
@@ -517,6 +520,8 @@ void QgsSpatiaLiteSourceSelect::on_btnConnect_clicked()
517520
}
518521
mTablesTreeView->resizeColumnToContents( 0 );
519522
mTablesTreeView->resizeColumnToContents( 1 );
523+
524+
cbxAllowGeometrylessTables->setEnabled( true );
520525
}
521526

522527
QStringList QgsSpatiaLiteSourceSelect::selectedTables()
@@ -562,7 +567,7 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
562567
int columns;
563568
char *errMsg = NULL;
564569
bool ok = false;
565-
char sql[1024];
570+
QString sql;
566571
QApplication::setOverrideCursor( Qt::WaitCursor );
567572

568573
// setting the SQLite DB name
@@ -571,9 +576,9 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
571576
mTableModel.setSqliteDb( myName );
572577

573578
// the following query return the tables containing a Geometry column
574-
strcpy( sql, "SELECT f_table_name, f_geometry_column, type " );
575-
strcat( sql, "FROM geometry_columns" );
576-
ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, &errMsg );
579+
sql = "SELECT f_table_name, f_geometry_column, type "
580+
"FROM geometry_columns";
581+
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
577582
if ( ret != SQLITE_OK )
578583
goto error;
579584
if ( rows < 1 )
@@ -599,10 +604,10 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
599604
if ( checkViewsGeometryColumns( handle ) )
600605
{
601606
// the following query return the views supporting a Geometry column
602-
strcpy( sql, "SELECT view_name, view_geometry, type " );
603-
strcat( sql, "FROM views_geometry_columns " );
604-
strcat( sql, "JOIN geometry_columns USING (f_table_name, f_geometry_column)" );
605-
ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, &errMsg );
607+
sql = "SELECT view_name, view_geometry, type "
608+
"FROM views_geometry_columns "
609+
"JOIN geometry_columns USING (f_table_name, f_geometry_column)";
610+
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
606611
if ( ret != SQLITE_OK )
607612
goto error;
608613
if ( rows < 1 )
@@ -627,9 +632,9 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
627632
if ( checkVirtsGeometryColumns( handle ) )
628633
{
629634
// the following query return the VirtualShapefiles
630-
strcpy( sql, "SELECT virt_name, virt_geometry, type " );
631-
strcat( sql, "FROM virts_geometry_columns" );
632-
ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, &errMsg );
635+
sql = "SELECT virt_name, virt_geometry, type "
636+
"FROM virts_geometry_columns";
637+
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
633638
if ( ret != SQLITE_OK )
634639
goto error;
635640
if ( rows < 1 )
@@ -651,6 +656,29 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
651656
sqlite3_free_table( results );
652657
}
653658

659+
if ( cbxAllowGeometrylessTables->isChecked() )
660+
{
661+
// get all tables
662+
sql = "SELECT name "
663+
"FROM sqlite_master "
664+
"WHERE type in ('table', 'view')";
665+
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
666+
if ( ret != SQLITE_OK )
667+
goto error;
668+
if ( rows < 1 )
669+
;
670+
else
671+
{
672+
for ( i = 1; i <= rows; i++ )
673+
{
674+
QString tableName = QString::fromUtf8( results[( i * columns ) + 0] );
675+
mTableModel.addTableEntry( tr( "No geometry" ), tableName, QString::null, "" );
676+
}
677+
ok = true;
678+
}
679+
sqlite3_free_table( results );
680+
}
681+
654682
QApplication::restoreOverrideCursor();
655683
return ok;
656684

‎src/app/spatialite/qgsspatialitesourceselect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
8585
void on_mSearchTableEdit_textChanged( const QString & text );
8686
void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );
8787
void on_mSearchModeComboBox_currentIndexChanged( const QString & text );
88+
void on_cbxAllowGeometrylessTables_stateChanged( int );
8889
void setSql( const QModelIndex& index );
8990
void on_cmbConnections_activated( int );
9091
void setLayerType( QString table, QString column, QString type );

‎src/core/qgsmaprenderer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include <QDomDocument>
3535
#include <QDomNode>
36+
#include <QMutexLocker>
3637
#include <QPainter>
3738
#include <QListIterator>
3839
#include <QSettings>
@@ -214,6 +215,9 @@ void QgsMapRenderer::adjustExtentToSize()
214215

215216
void QgsMapRenderer::render( QPainter* painter )
216217
{
218+
//Lock render method for concurrent threads (e.g. from globe)
219+
QMutexLocker renderLock( &mRenderMutex );
220+
217221
//flag to see if the render context has changed
218222
//since the last time we rendered. If it hasnt changed we can
219223
//take some shortcuts with rendering

‎src/core/qgsmaprenderer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#ifndef QGSMAPRENDER_H
1717
#define QGSMAPRENDER_H
1818

19+
#include <QMutex>
1920
#include <QSize>
2021
#include <QStringList>
2122
#include <QVector>
@@ -318,6 +319,9 @@ class CORE_EXPORT QgsMapRenderer : public QObject
318319

319320
//! Labeling engine (NULL by default)
320321
QgsLabelingEngineInterface* mLabelingEngine;
322+
323+
//! Locks rendering loop for concurrent draws
324+
QMutex mRenderMutex;
321325
};
322326

323327
#endif

‎src/core/qgspallabeling.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
734734
max_scale = lyr.scaleMax;
735735
}
736736

737-
Layer* l = mPal->addLayer( layer->id().toLocal8Bit().data(),
737+
Layer* l = mPal->addLayer( layer->id().toUtf8().data(),
738738
min_scale, max_scale, arrangement,
739739
METER, priority, lyr.obstacle, true, true );
740740

@@ -771,7 +771,7 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
771771

772772
int QgsPalLabeling::addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSettings *s )
773773
{
774-
Layer* l = mPal->addLayer( layer->id().append( "d" ).toLocal8Bit().data(), -1, -1, pal::Arrangement( s->placement ), METER, s->priority, s->obstacle, true, true );
774+
Layer* l = mPal->addLayer( layer->id().append( "d" ).toUtf8().data(), -1, -1, pal::Arrangement( s->placement ), METER, s->priority, s->obstacle, true, true );
775775
l->setArrangementFlags( s->placementFlags );
776776

777777
s->palLayer = l;
@@ -1013,13 +1013,15 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
10131013
continue;
10141014
}
10151015

1016+
//layer names
1017+
QString layerNameUtf8 = QString::fromUtf8(( *it )->getLayerName() );
10161018
if ( palGeometry->isDiagram() )
10171019
{
10181020
//render diagram
10191021
QHash<QgsVectorLayer*, QgsDiagramLayerSettings>::iterator dit = mActiveDiagramLayers.begin();
10201022
for ( dit = mActiveDiagramLayers.begin(); dit != mActiveDiagramLayers.end(); ++dit )
10211023
{
1022-
if ( dit.key() && dit.key()->id().append( "d" ) == ( *it )->getLayerName() )
1024+
if ( dit.key() && dit.key()->id().append( "d" ) == layerNameUtf8 )
10231025
{
10241026
QgsPoint outPt = xform->transform(( *it )->getX(), ( *it )->getY() );
10251027
dit.value().renderer->renderDiagram( palGeometry->diagramAttributes(), context, QPointF( outPt.x(), outPt.y() ) );
@@ -1030,14 +1032,14 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
10301032
if ( mLabelSearchTree )
10311033
{
10321034
//for diagrams, remove the additional 'd' at the end of the layer id
1033-
QString layerId = ( *it )->getLayerName();
1035+
QString layerId = layerNameUtf8;
10341036
layerId.chop( 1 );
10351037
mLabelSearchTree->insertLabel( *it, QString( palGeometry->strId() ).toInt(), layerId, true );
10361038
}
10371039
continue;
10381040
}
10391041

1040-
const QgsPalLayerSettings& lyr = layer(( *it )->getLayerName() );
1042+
const QgsPalLayerSettings& lyr = layer( layerNameUtf8 );
10411043
QFont fontForLabel = lyr.textFont;
10421044
QColor fontColor = lyr.textColor;
10431045
double bufferSize = lyr.bufferSize;
@@ -1216,7 +1218,7 @@ void QgsPalLabeling::drawLabel( pal::LabelPosition* label, QPainter* painter, co
12161218
QgsPoint outPt = xform->transform( label->getX(), label->getY() );
12171219

12181220
// TODO: optimize access :)
1219-
const QgsPalLayerSettings& lyr = layer( label->getLayerName() );
1221+
const QgsPalLayerSettings& lyr = layer( QString::fromUtf8( label->getLayerName() ) );
12201222

12211223
QString text = (( QgsPalGeometry* )label->getFeaturePart()->getUserGeometry() )->text();
12221224
QString txt = ( label->getPartId() == -1 ? text : QString( text[label->getPartId()] ) );

‎src/core/qgssearchstringparser.yy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,20 @@ scalar_exp:
176176
| scalar_exp '-' scalar_exp { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opMINUS,$1, $3); joinTmpNodes($$,$1,$3); }
177177
| '(' scalar_exp ')' { $$ = $2; }
178178
| '+' scalar_exp %prec UMINUS { $$ = $2; }
179-
| '-' scalar_exp %prec UMINUS { $$ = $2; if ($$->type() == QgsSearchTreeNode::tNumber) $$->setNumber(- $$->number()); }
179+
| '-' scalar_exp %prec UMINUS
180+
{
181+
if ( $2->type() == QgsSearchTreeNode::tNumber )
182+
{
183+
$$ = $2;
184+
$$->setNumber(- $$->number());
185+
}
186+
else
187+
{
188+
QgsSearchTreeNode *null = new QgsSearchTreeNode( 0.0 );
189+
$$ = new QgsSearchTreeNode( QgsSearchTreeNode::opMINUS, null, $2);
190+
joinTmpNodes($$, $2, 0);
191+
}
192+
}
180193
| scalar_exp CONCAT scalar_exp { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opCONCAT, $1, $3); joinTmpNodes($$, $1, $3); }
181194
| ROWNUM { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opROWNUM, 0, 0); addToTmpNodes($$); }
182195
| AREA { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opAREA, 0, 0); addToTmpNodes($$); }

‎src/core/qgssearchtreenode.cpp

100755100644
File mode changed.

‎src/core/symbology-ng/qgssvgcache.h

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class QDomElement;
2727
class QImage;
2828
class QPicture;
2929

30-
struct QgsSvgCacheEntry
30+
struct CORE_EXPORT QgsSvgCacheEntry
3131
{
3232
QgsSvgCacheEntry();
3333
QgsSvgCacheEntry( const QString& file, double size, double outlineWidth, double widthScaleFactor, double rasterScaleFctor, const QColor& fill, const QColor& outline );
@@ -58,7 +58,7 @@ struct QgsSvgCacheEntry
5858
/**A cache for images / pictures derived from svg files. This class supports parameter replacement in svg files
5959
according to the svg params specification (http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/). Supported are
6060
the parameters 'fill-color', 'pen-color', 'outline-width', 'stroke-width'. E.g. <circle fill="param(fill-color red)" stroke="param(pen-color black)" stroke-width="param(outline-width 1)"*/
61-
class QgsSvgCache
61+
class CORE_EXPORT QgsSvgCache
6262
{
6363
public:
6464

@@ -73,7 +73,7 @@ class QgsSvgCache
7373
/**Tests if an svg file contains parameters for fill, outline color, outline width. If yes, possible default values are returned. If there are several
7474
default values in the svg file, only the first one is considered*/
7575
void containsParams( const QString& path, bool& hasFillParam, QColor& defaultFillColor, bool& hasOutlineParam, QColor& defaultOutlineColor, bool& hasOutlineWidthParam,
76-
double& defaultOutlineWidth ) const;
76+
double& defaultOutlineWidth ) const;
7777

7878
protected:
7979
QgsSvgCache();
@@ -115,7 +115,7 @@ class QgsSvgCache
115115
void replaceElemParams( QDomElement& elem, const QColor& fill, const QColor& outline, double outlineWidth );
116116

117117
void containsElemParams( const QDomElement& elem, bool& hasFillParam, QColor& defaultFill, bool& hasOutlineParam, QColor& defaultOutline,
118-
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const;
118+
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const;
119119

120120
/**Release memory and remove cache entry from mEntryLookup*/
121121
void removeCacheEntry( QString s, QgsSvgCacheEntry* entry );

‎src/gui/qgscomposerview.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qgscomposerscalebar.h"
3030
#include "qgscomposershape.h"
3131
#include "qgscomposerattributetable.h"
32+
#include "qgslogger.h"
3233

3334
QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags f )
3435
: QGraphicsView( parent )
@@ -499,6 +500,18 @@ void QgsComposerView::paintEvent( QPaintEvent* event )
499500
}
500501
}
501502

503+
void QgsComposerView::hideEvent( QHideEvent* e )
504+
{
505+
emit( composerViewShow( this ) );
506+
e->ignore();
507+
}
508+
509+
void QgsComposerView::showEvent( QShowEvent* e )
510+
{
511+
emit( composerViewHide( this ) );
512+
e->ignore();
513+
}
514+
502515
void QgsComposerView::setComposition( QgsComposition* c )
503516
{
504517
setScene( c );

‎src/gui/qgscomposerview.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
117117

118118
void paintEvent( QPaintEvent* event );
119119

120+
void hideEvent( QHideEvent* e );
121+
void showEvent( QShowEvent* e );
120122

121123
private:
122124
/**Status of shift key (used for multiple selection)*/
@@ -167,6 +169,11 @@ class GUI_EXPORT QgsComposerView: public QGraphicsView
167169
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
168170
QgsComposer may set the selection tool again*/
169171
void actionFinished();
172+
173+
/**Emitted before composerview is shown*/
174+
void composerViewShow( QgsComposerView* );
175+
/**Emitted before composerview is hidden*/
176+
void composerViewHide( QgsComposerView* );
170177
};
171178

172179
#endif

‎src/mapserver/qgswmsserver.cpp

100644100755
Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <QPrinter>
5252
#include <QSvgGenerator>
5353
#include <QUrl>
54+
#include <QPaintEngine>
5455

5556
QgsWMSServer::QgsWMSServer( std::map<QString, QString> parameters, QgsMapRenderer* renderer )
5657
: mParameterMap( parameters )
@@ -208,13 +209,15 @@ QDomDocument QgsWMSServer::getCapabilities()
208209
}
209210
QgsDebugMsg( "layersAndStylesCapabilities returned" );
210211

212+
#if 0
211213
//for debugging: save the document to disk
212-
/*QFile capabilitiesFile( QDir::tempPath() + "/capabilities.txt" );
214+
QFile capabilitiesFile( QDir::tempPath() + "/capabilities.txt" );
213215
if ( capabilitiesFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
214216
{
215217
QTextStream capabilitiesStream( &capabilitiesFile );
216218
doc.save( capabilitiesStream, 4 );
217-
}*/
219+
}
220+
#endif
218221
return doc;
219222
}
220223

@@ -337,6 +340,38 @@ QDomDocument QgsWMSServer::getStyle()
337340
return mConfigParser->getStyle( styleName, layerName );
338341
}
339342

343+
// Hack to workaround Qt #5114 by disabling PatternTransform
344+
class QgsPaintEngineHack : public QPaintEngine
345+
{
346+
public:
347+
void fixFlags()
348+
{
349+
gccaps = 0;
350+
gccaps |= ( QPaintEngine::PrimitiveTransform
351+
// | QPaintEngine::PatternTransform
352+
| QPaintEngine::PixmapTransform
353+
// | QPaintEngine::PatternBrush
354+
// | QPaintEngine::LinearGradientFill
355+
// | QPaintEngine::RadialGradientFill
356+
// | QPaintEngine::ConicalGradientFill
357+
| QPaintEngine::AlphaBlend
358+
// | QPaintEngine::PorterDuff
359+
| QPaintEngine::PainterPaths
360+
| QPaintEngine::Antialiasing
361+
| QPaintEngine::BrushStroke
362+
| QPaintEngine::ConstantOpacity
363+
| QPaintEngine::MaskedBrush
364+
// | QPaintEngine::PerspectiveTransform
365+
| QPaintEngine::BlendModes
366+
// | QPaintEngine::ObjectBoundingModeGradients
367+
#if QT_VERSION >= 0x040500
368+
| QPaintEngine::RasterOpModes
369+
#endif
370+
| QPaintEngine::PaintOutsidePaintEvent
371+
);
372+
}
373+
};
374+
340375
QByteArray* QgsWMSServer::getPrint( const QString& formatString )
341376
{
342377
QStringList layersList, stylesList, layerIdList;
@@ -429,6 +464,15 @@ QByteArray* QgsWMSServer::getPrint( const QString& formatString )
429464
printer.setPaperSize( QSizeF( c->paperWidth(), c->paperHeight() ), QPrinter::Millimeter );
430465
QRectF paperRectMM = printer.pageRect( QPrinter::Millimeter );
431466
QRectF paperRectPixel = printer.pageRect( QPrinter::DevicePixel );
467+
468+
QPaintEngine *engine = printer.paintEngine();
469+
if ( engine->hasFeature( QPaintEngine::PatternTransform ) )
470+
{
471+
QgsPaintEngineHack *hack = static_cast<QgsPaintEngineHack*>( engine );
472+
hack->fixFlags();
473+
Q_ASSERT( !engine->hasFeature( QPaintEngine::PatternTransform ) );
474+
}
475+
432476
QPainter p( &printer );
433477
if ( c->printAsRaster() ) //embed one raster into the pdf
434478
{

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ qint64 QgsPostgresProvider::getBinaryInt( PGresult *queryResult, int row, int co
491491

492492
case 8:
493493
{
494-
qint32 oid0 = htonl( *( qint32 * ) p );
495-
qint32 oid1 = htonl( *( qint32 * )( p + sizeof( qint32 ) ) );
494+
qint32 oid0 = *( qint32 * ) p;
495+
qint32 oid1 = *( qint32 * )( p + sizeof( qint32 ) );
496496

497497
if ( swapEndian )
498498
{

‎src/providers/spatialite/qgsspatialiteprovider.cpp

Lines changed: 213 additions & 245 deletions
Large diffs are not rendered by default.

‎src/providers/spatialite/qgsspatialiteprovider.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,13 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
380380
bool getQueryGeometryDetails();
381381
bool getSridDetails();
382382
bool getTableSummary();
383+
bool prepareStatement( sqlite3_stmt *&stmt,
384+
const QgsAttributeList &fetchAttributes,
385+
bool fetchGeometry,
386+
QString whereClause );
387+
bool getFeature( sqlite3_stmt *stmt, bool fetchGeometry,
388+
QgsFeature &feature,
389+
const QgsAttributeList &fetchAttributes );
383390
void convertToGeosWKB( const unsigned char *blob, size_t blob_size,
384391
unsigned char **wkb, size_t *geom_size );
385392
int computeSizeFromMultiWKB2D( const unsigned char *p_in, int nDims,

0 commit comments

Comments
 (0)
Please sign in to comment.