Make use of "using std::xxx" at smallest possible scope.
This commit is contained in:
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "BarcodeStyle.h"
|
#include "BarcodeStyle.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
@@ -152,9 +154,11 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
QString BarcodeStyle::exampleDigits( int n ) const
|
QString BarcodeStyle::exampleDigits( int n ) const
|
||||||
{
|
{
|
||||||
|
using std::max;
|
||||||
|
|
||||||
if ( mCanFreeform )
|
if ( mCanFreeform )
|
||||||
{
|
{
|
||||||
return QString( std::max( n, 1 ), QChar('0') );
|
return QString( max( n, 1 ), QChar('0') );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
#define glabels_BarcodeStyle_h
|
#define glabels_BarcodeStyle_h
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
namespace glabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-4
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "LabelModel.h"
|
#include "LabelModel.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "LabelModelObject.h"
|
#include "LabelModelObject.h"
|
||||||
@@ -151,10 +152,13 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
void LabelModel::selectRegion( const LabelRegion ®ion )
|
void LabelModel::selectRegion( const LabelRegion ®ion )
|
||||||
{
|
{
|
||||||
double rX1 = std::min( region.x1(), region.x2() );
|
using std::min;
|
||||||
double rY1 = std::min( region.y1(), region.y2() );
|
using std::max;
|
||||||
double rX2 = std::max( region.x1(), region.x2() );
|
|
||||||
double rY2 = std::max( region.y1(), region.y2() );
|
double rX1 = min( region.x1(), region.x2() );
|
||||||
|
double rY1 = min( region.y1(), region.y2() );
|
||||||
|
double rX2 = max( region.x1(), region.x2() );
|
||||||
|
double rY2 = max( region.y1(), region.y2() );
|
||||||
|
|
||||||
foreach ( LabelModelObject* object, mObjectList )
|
foreach ( LabelModelObject* object, mObjectList )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <QTransform>
|
#include <QTransform>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "ColorNode.h"
|
#include "ColorNode.h"
|
||||||
#include "TextNode.h"
|
#include "TextNode.h"
|
||||||
@@ -836,6 +837,9 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
LabelRegion LabelModelObject::getExtent()
|
LabelRegion LabelModelObject::getExtent()
|
||||||
{
|
{
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
|
||||||
QPointF a1( - lineWidth()/2, - lineWidth()/2 );
|
QPointF a1( - lineWidth()/2, - lineWidth()/2 );
|
||||||
QPointF a2( mW + lineWidth()/2, - lineWidth()/2 );
|
QPointF a2( mW + lineWidth()/2, - lineWidth()/2 );
|
||||||
QPointF a3( mW + lineWidth()/2, mH + lineWidth()/2 );
|
QPointF a3( mW + lineWidth()/2, mH + lineWidth()/2 );
|
||||||
@@ -847,10 +851,10 @@ namespace glabels
|
|||||||
a4 = mMatrix.map( a4 );
|
a4 = mMatrix.map( a4 );
|
||||||
|
|
||||||
LabelRegion region;
|
LabelRegion region;
|
||||||
region.setX1( std::min( a1.x(), std::min( a2.x(), std::min( a3.x(), a4.x() ) ) ) + mX0 );
|
region.setX1( min( a1.x(), min( a2.x(), min( a3.x(), a4.x() ) ) ) + mX0 );
|
||||||
region.setY1( std::min( a1.y(), std::min( a2.y(), std::min( a3.y(), a4.y() ) ) ) + mY0 );
|
region.setY1( min( a1.y(), min( a2.y(), min( a3.y(), a4.y() ) ) ) + mY0 );
|
||||||
region.setX2( std::max( a1.x(), std::max( a2.x(), std::max( a3.x(), a4.x() ) ) ) + mX0 );
|
region.setX2( max( a1.x(), max( a2.x(), max( a3.x(), a4.x() ) ) ) + mX0 );
|
||||||
region.setY2( std::max( a1.y(), std::max( a2.y(), std::max( a3.y(), a4.y() ) ) ) + mY0 );
|
region.setY2( max( a1.y(), max( a2.y(), max( a3.y(), a4.y() ) ) ) + mY0 );
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -25,6 +25,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QGraphicsLineItem>
|
#include <QGraphicsLineItem>
|
||||||
#include <QGraphicsDropShadowEffect>
|
#include <QGraphicsDropShadowEffect>
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -194,13 +195,16 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
void View::zoomToFit()
|
void View::zoomToFit()
|
||||||
{
|
{
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
|
||||||
double x_scale = (72.0/physicalDpiX()) * ( width() - ZOOM_TO_FIT_PAD ) / mModel->w();
|
double x_scale = (72.0/physicalDpiX()) * ( width() - ZOOM_TO_FIT_PAD ) / mModel->w();
|
||||||
double y_scale = (72.0/physicalDpiY()) * ( height() - ZOOM_TO_FIT_PAD ) / mModel->h();
|
double y_scale = (72.0/physicalDpiY()) * ( height() - ZOOM_TO_FIT_PAD ) / mModel->h();
|
||||||
double newZoom = std::min( x_scale, y_scale );
|
double newZoom = min( x_scale, y_scale );
|
||||||
|
|
||||||
// Limits
|
// Limits
|
||||||
newZoom = std::min( newZoom, zoomLevels[0] );
|
newZoom = min( newZoom, zoomLevels[0] );
|
||||||
newZoom = std::max( newZoom, zoomLevels[nZoomLevels-1] );
|
newZoom = max( newZoom, zoomLevels[nZoomLevels-1] );
|
||||||
|
|
||||||
setZoomReal( newZoom, true );
|
setZoomReal( newZoom, true );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user