Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:qgis/Quantum-GIS

  • Loading branch information
timlinux committed Jul 4, 2011
2 parents 934e56f + a946a20 commit 364df1cf854331f3aff2f21f0b74cbc40f2cb806
@@ -107,4 +107,9 @@ class QgsComposerView: QGraphicsView
/**Current action (e.g. adding composer map) has been finished. The purpose of this signal is that
QgsComposer may set the selection tool again*/
void actionFinished();

/**Emitted before composerview is shown*/
void composerViewShow( QgsComposerView* );
/**Emitted before composerview is hidden*/
void composerViewHide( QgsComposerView* );
};
44 src/app/composer/qgscomposer.cpp 100644 → 100755
@@ -66,9 +66,7 @@
#include <QToolBar>
#include <QToolButton>
#include <QUndoView>



#include <QPaintEngine>


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

// Hack to workaround Qt #5114 by disabling PatternTransform
class QgsPaintEngineHack : public QPaintEngine
{
public:
void fixFlags()
{
gccaps = 0;
gccaps |= ( QPaintEngine::PrimitiveTransform
// | QPaintEngine::PatternTransform
| QPaintEngine::PixmapTransform
// | QPaintEngine::PatternBrush
// | QPaintEngine::LinearGradientFill
// | QPaintEngine::RadialGradientFill
// | QPaintEngine::ConicalGradientFill
| QPaintEngine::AlphaBlend
// | QPaintEngine::PorterDuff
| QPaintEngine::PainterPaths
| QPaintEngine::Antialiasing
| QPaintEngine::BrushStroke
| QPaintEngine::ConstantOpacity
| QPaintEngine::MaskedBrush
// | QPaintEngine::PerspectiveTransform
| QPaintEngine::BlendModes
// | QPaintEngine::ObjectBoundingModeGradients
#if QT_VERSION >= 0x040500
| QPaintEngine::RasterOpModes
#endif
| QPaintEngine::PaintOutsidePaintEvent
);
}
};

void QgsComposer::on_mActionExportAsPDF_triggered()
{
QSettings myQSettings; // where we keep last used filter in persistent state
@@ -521,6 +551,14 @@ void QgsComposer::on_mActionExportAsPDF_triggered()
printer.setOutputFileName( myOutputFileNameQString );
printer.setPaperSize( QSizeF( mComposition->paperWidth(), mComposition->paperHeight() ), QPrinter::Millimeter );

QPaintEngine *engine = printer.paintEngine();
if ( engine && engine->hasFeature( QPaintEngine::PatternTransform ) )
{
QgsPaintEngineHack *hack = static_cast<QgsPaintEngineHack*>( engine );
hack->fixFlags();
Q_ASSERT( !engine->hasFeature( QPaintEngine::PatternTransform ) );
}

print( printer );
}

0 src/app/qgsfieldcalculator.cpp 100755 → 100644
No changes.
@@ -91,7 +91,8 @@ QgsSpatiaLiteSourceSelect::QgsSpatiaLiteSourceSelect( QgisApp * app, Qt::WFlags
mSearchModeComboBox->setVisible( false );
mSearchModeLabel->setVisible( false );
mSearchTableEdit->setVisible( false );
cbxAllowGeometrylessTables->setVisible( false );

cbxAllowGeometrylessTables->setDisabled( true );
}

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

void QgsSpatiaLiteSourceSelect::on_cbxAllowGeometrylessTables_stateChanged( int )
{
on_btnConnect_clicked();
}

void QgsSpatiaLiteSourceSelect::on_mTablesTreeView_clicked( const QModelIndex &index )
{
mBuildQueryButton->setEnabled( index.parent().isValid() );
@@ -269,13 +275,8 @@ sqlite3 *QgsSpatiaLiteSourceSelect::openSpatiaLiteDb( QString path )
if ( gcSpatiaLite && rsSpatiaLite )
return handle;

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

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

cbxAllowGeometrylessTables->setEnabled( false );

QSettings settings;
QString subKey = cmbConnections->currentText();
int idx = subKey.indexOf( "@" );
@@ -517,6 +520,8 @@ void QgsSpatiaLiteSourceSelect::on_btnConnect_clicked()
}
mTablesTreeView->resizeColumnToContents( 0 );
mTablesTreeView->resizeColumnToContents( 1 );

cbxAllowGeometrylessTables->setEnabled( true );
}

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

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

// the following query return the tables containing a Geometry column
strcpy( sql, "SELECT f_table_name, f_geometry_column, type " );
strcat( sql, "FROM geometry_columns" );
ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, &errMsg );
sql = "SELECT f_table_name, f_geometry_column, type "
"FROM geometry_columns";
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
if ( ret != SQLITE_OK )
goto error;
if ( rows < 1 )
@@ -599,10 +604,10 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
if ( checkViewsGeometryColumns( handle ) )
{
// the following query return the views supporting a Geometry column
strcpy( sql, "SELECT view_name, view_geometry, type " );
strcat( sql, "FROM views_geometry_columns " );
strcat( sql, "JOIN geometry_columns USING (f_table_name, f_geometry_column)" );
ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, &errMsg );
sql = "SELECT view_name, view_geometry, type "
"FROM views_geometry_columns "
"JOIN geometry_columns USING (f_table_name, f_geometry_column)";
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
if ( ret != SQLITE_OK )
goto error;
if ( rows < 1 )
@@ -627,9 +632,9 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
if ( checkVirtsGeometryColumns( handle ) )
{
// the following query return the VirtualShapefiles
strcpy( sql, "SELECT virt_name, virt_geometry, type " );
strcat( sql, "FROM virts_geometry_columns" );
ret = sqlite3_get_table( handle, sql, &results, &rows, &columns, &errMsg );
sql = "SELECT virt_name, virt_geometry, type "
"FROM virts_geometry_columns";
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
if ( ret != SQLITE_OK )
goto error;
if ( rows < 1 )
@@ -651,6 +656,29 @@ bool QgsSpatiaLiteSourceSelect::getTableInfo( sqlite3 * handle )
sqlite3_free_table( results );
}

if ( cbxAllowGeometrylessTables->isChecked() )
{
// get all tables
sql = "SELECT name "
"FROM sqlite_master "
"WHERE type in ('table', 'view')";
ret = sqlite3_get_table( handle, sql.toUtf8(), &results, &rows, &columns, &errMsg );
if ( ret != SQLITE_OK )
goto error;
if ( rows < 1 )
;
else
{
for ( i = 1; i <= rows; i++ )
{
QString tableName = QString::fromUtf8( results[( i * columns ) + 0] );
mTableModel.addTableEntry( tr( "No geometry" ), tableName, QString::null, "" );
}
ok = true;
}
sqlite3_free_table( results );
}

QApplication::restoreOverrideCursor();
return ok;

@@ -85,6 +85,7 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
void on_mSearchTableEdit_textChanged( const QString & text );
void on_mSearchColumnComboBox_currentIndexChanged( const QString & text );
void on_mSearchModeComboBox_currentIndexChanged( const QString & text );
void on_cbxAllowGeometrylessTables_stateChanged( int );
void setSql( const QModelIndex& index );
void on_cmbConnections_activated( int );
void setLayerType( QString table, QString column, QString type );
@@ -33,6 +33,7 @@

#include <QDomDocument>
#include <QDomNode>
#include <QMutexLocker>
#include <QPainter>
#include <QListIterator>
#include <QSettings>
@@ -214,6 +215,9 @@ void QgsMapRenderer::adjustExtentToSize()

void QgsMapRenderer::render( QPainter* painter )
{
//Lock render method for concurrent threads (e.g. from globe)
QMutexLocker renderLock( &mRenderMutex );

//flag to see if the render context has changed
//since the last time we rendered. If it hasnt changed we can
//take some shortcuts with rendering
@@ -16,6 +16,7 @@
#ifndef QGSMAPRENDER_H
#define QGSMAPRENDER_H

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

//! Labeling engine (NULL by default)
QgsLabelingEngineInterface* mLabelingEngine;

//! Locks rendering loop for concurrent draws
QMutex mRenderMutex;
};

#endif
@@ -734,7 +734,7 @@ int QgsPalLabeling::prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices,
max_scale = lyr.scaleMax;
}

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

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

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

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

//layer names
QString layerNameUtf8 = QString::fromUtf8(( *it )->getLayerName() );
if ( palGeometry->isDiagram() )
{
//render diagram
QHash<QgsVectorLayer*, QgsDiagramLayerSettings>::iterator dit = mActiveDiagramLayers.begin();
for ( dit = mActiveDiagramLayers.begin(); dit != mActiveDiagramLayers.end(); ++dit )
{
if ( dit.key() && dit.key()->id().append( "d" ) == ( *it )->getLayerName() )
if ( dit.key() && dit.key()->id().append( "d" ) == layerNameUtf8 )
{
QgsPoint outPt = xform->transform(( *it )->getX(), ( *it )->getY() );
dit.value().renderer->renderDiagram( palGeometry->diagramAttributes(), context, QPointF( outPt.x(), outPt.y() ) );
@@ -1030,14 +1032,14 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
if ( mLabelSearchTree )
{
//for diagrams, remove the additional 'd' at the end of the layer id
QString layerId = ( *it )->getLayerName();
QString layerId = layerNameUtf8;
layerId.chop( 1 );
mLabelSearchTree->insertLabel( *it, QString( palGeometry->strId() ).toInt(), layerId, true );
}
continue;
}

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

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

QString text = (( QgsPalGeometry* )label->getFeaturePart()->getUserGeometry() )->text();
QString txt = ( label->getPartId() == -1 ? text : QString( text[label->getPartId()] ) );
@@ -176,7 +176,20 @@ scalar_exp:
| scalar_exp '-' scalar_exp { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opMINUS,$1, $3); joinTmpNodes($$,$1,$3); }
| '(' scalar_exp ')' { $$ = $2; }
| '+' scalar_exp %prec UMINUS { $$ = $2; }
| '-' scalar_exp %prec UMINUS { $$ = $2; if ($$->type() == QgsSearchTreeNode::tNumber) $$->setNumber(- $$->number()); }
| '-' scalar_exp %prec UMINUS
{
if ( $2->type() == QgsSearchTreeNode::tNumber )
{
$$ = $2;
$$->setNumber(- $$->number());
}
else
{
QgsSearchTreeNode *null = new QgsSearchTreeNode( 0.0 );
$$ = new QgsSearchTreeNode( QgsSearchTreeNode::opMINUS, null, $2);
joinTmpNodes($$, $2, 0);
}
}
| scalar_exp CONCAT scalar_exp { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opCONCAT, $1, $3); joinTmpNodes($$, $1, $3); }
| ROWNUM { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opROWNUM, 0, 0); addToTmpNodes($$); }
| AREA { $$ = new QgsSearchTreeNode(QgsSearchTreeNode::opAREA, 0, 0); addToTmpNodes($$); }
0 src/core/qgssearchtreenode.cpp 100755 → 100644
No changes.
@@ -27,7 +27,7 @@ class QDomElement;
class QImage;
class QPicture;

struct QgsSvgCacheEntry
struct CORE_EXPORT QgsSvgCacheEntry
{
QgsSvgCacheEntry();
QgsSvgCacheEntry( const QString& file, double size, double outlineWidth, double widthScaleFactor, double rasterScaleFctor, const QColor& fill, const QColor& outline );
@@ -58,7 +58,7 @@ struct QgsSvgCacheEntry
/**A cache for images / pictures derived from svg files. This class supports parameter replacement in svg files
according to the svg params specification (http://www.w3.org/TR/2009/WD-SVGParamPrimer-20090616/). Supported are
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)"*/
class QgsSvgCache
class CORE_EXPORT QgsSvgCache
{
public:

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

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

void containsElemParams( const QDomElement& elem, bool& hasFillParam, QColor& defaultFill, bool& hasOutlineParam, QColor& defaultOutline,
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const;
bool& hasOutlineWidthParam, double& defaultOutlineWidth ) const;

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

0 comments on commit 364df1c

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