Qt bug fix for markers

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@3371 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
rabla 2005-05-13 15:40:26 +00:00
parent bd562d0327
commit 5bdb63fa02
3 changed files with 19 additions and 9 deletions

View File

@ -88,13 +88,13 @@ QgsMarkerCatalogue *QgsMarkerCatalogue::instance()
return QgsMarkerCatalogue::mMarkerCatalogue;
}
QPicture QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrush brush, int oversampling )
QPicture QgsMarkerCatalogue::marker ( QString fullName, int size, QPen pen, QBrush brush, int oversampling, bool qtBug )
{
//std::cerr << "QgsMarkerCatalogue::marker" << std::endl;
QPicture picture;
if ( fullName.left(5) == "hard:" ) {
return hardMarker ( fullName.mid(5), size, pen, brush, oversampling );
return hardMarker ( fullName.mid(5), size, pen, brush, oversampling, qtBug );
} else if ( fullName.left(4) == "svg:" ) {
return svgMarker ( fullName.mid(4), size, oversampling );
}
@ -136,7 +136,7 @@ QPicture QgsMarkerCatalogue::svgMarker ( QString name, int s, int oversampling )
return picture;
}
QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush brush, int oversampling )
QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush brush, int oversampling, bool qtBug )
{
// Size of polygon symbols is calculated so that the area is equal to circle with
// diameter mPointSize
@ -184,7 +184,12 @@ QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush
// -> reset boundingRect for cross, cross2
else if ( name == "cross" )
{
int add = 1; // lw always > 0
int add;
if ( qtBug ) {
add = 1; // lw always > 0
} else {
add = 0;
}
picpainter.drawLine(0, half, size-1+add, half); // horizontal
picpainter.drawLine(half, 0, half, size-1+add); // vertical
@ -195,7 +200,12 @@ QPicture QgsMarkerCatalogue::hardMarker ( QString name, int s, QPen pen, QBrush
half = (int) floor( s/2/sqrt(2));
size = 2*half + 1;
int add = 1; // lw always > 0
int add;
if ( qtBug ) {
add = 1; // lw always > 0
} else {
add = 0;
}
int addwidth = (int) ( 0.5 * lw ); // width correction, cca lw/2 * cos(45)

View File

@ -43,7 +43,7 @@ public:
/** Returns picture of the marker
* \param fullName full name, e.g. hard:circle, svg:/home/usr1/marker1.svg
*/
QPicture marker ( QString fullName, int size, QPen pen, QBrush brush, int oversampling = 1 );
QPicture marker ( QString fullName, int size, QPen pen, QBrush brush, int oversampling = 1, bool qtBug = true );
private:
@ -56,7 +56,7 @@ private:
QStringList mList;
/** Hard coded */
QPicture hardMarker ( QString name, int size, QPen pen, QBrush brush, int oversampling = 1 );
QPicture hardMarker ( QString name, int size, QPen pen, QBrush brush, int oversampling = 1, bool qtBug = true );
/** Hard coded */
QPicture svgMarker ( QString name, int size, int oversampling = 1 );

View File

@ -230,14 +230,14 @@ void QgsSymbol::cache2( double widthScale, QColor selectionColor )
mPointSymbolPicture2 = QgsMarkerCatalogue::instance()->marker ( mPointSymbolName, mPointSize,
pen, mBrush, 1 );
pen, mBrush, 1, false );
QBrush brush = mBrush;
brush.setColor ( selectionColor );
pen.setColor ( selectionColor );
mPointSymbolPictureSelected2 = QgsMarkerCatalogue::instance()->marker (
mPointSymbolName, mPointSize, pen, brush, 1 );
mPointSymbolName, mPointSize, pen, brush, 1, false );
mSelectionColor2 = selectionColor;