mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
parent
8eb7664b21
commit
55a1778b68
42
src/app/composer/qgscomposer.cpp
Normal file → Executable file
42
src/app/composer/qgscomposer.cpp
Normal file → Executable file
@ -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,36 @@ 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
|
||||
| QPaintEngine::RasterOpModes
|
||||
| QPaintEngine::PaintOutsidePaintEvent
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
void QgsComposer::on_mActionExportAsPDF_triggered()
|
||||
{
|
||||
QSettings myQSettings; // where we keep last used filter in persistent state
|
||||
@ -521,6 +549,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 );
|
||||
}
|
||||
|
||||
|
40
src/mapserver/qgswmsserver.cpp
Normal file → Executable file
40
src/mapserver/qgswmsserver.cpp
Normal file → Executable file
@ -51,6 +51,7 @@
|
||||
#include <QPrinter>
|
||||
#include <QSvgGenerator>
|
||||
#include <QUrl>
|
||||
#include <QPaintEngine>
|
||||
|
||||
QgsWMSServer::QgsWMSServer( std::map<QString, QString> parameters, QgsMapRenderer* renderer )
|
||||
: mParameterMap( parameters )
|
||||
@ -337,6 +338,36 @@ QDomDocument QgsWMSServer::getStyle()
|
||||
return mConfigParser->getStyle( styleName, layerName );
|
||||
}
|
||||
|
||||
// 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
|
||||
| QPaintEngine::RasterOpModes
|
||||
| QPaintEngine::PaintOutsidePaintEvent
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
QByteArray* QgsWMSServer::getPrint( const QString& formatString )
|
||||
{
|
||||
QStringList layersList, stylesList, layerIdList;
|
||||
@ -429,6 +460,15 @@ QByteArray* QgsWMSServer::getPrint( const QString& formatString )
|
||||
printer.setPaperSize( QSizeF( c->paperWidth(), c->paperHeight() ), QPrinter::Millimeter );
|
||||
QRectF paperRectMM = printer.pageRect( QPrinter::Millimeter );
|
||||
QRectF paperRectPixel = printer.pageRect( QPrinter::DevicePixel );
|
||||
|
||||
QPaintEngine *engine = printer.paintEngine();
|
||||
if ( engine->hasFeature( QPaintEngine::PatternTransform ) )
|
||||
{
|
||||
QgsPaintEngineHack *hack = static_cast<QgsPaintEngineHack*>( engine );
|
||||
hack->fixFlags();
|
||||
Q_ASSERT( !engine->hasFeature( QPaintEngine::PatternTransform ) );
|
||||
}
|
||||
|
||||
QPainter p( &printer );
|
||||
if ( c->printAsRaster() ) //embed one raster into the pdf
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user