|
|
@ -51,6 +51,13 @@ UBGraphicsCompass::UBGraphicsCompass() |
|
|
|
, mDrewCenterCross(false) |
|
|
|
, mDrewCenterCross(false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
setRect(sDefaultRect); |
|
|
|
setRect(sDefaultRect); |
|
|
|
|
|
|
|
setBrush(QBrush(Qt::red)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO claudio: remove code duplication
|
|
|
|
|
|
|
|
QDesktopWidget* desktop = UBApplication::desktop(); |
|
|
|
|
|
|
|
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2; |
|
|
|
|
|
|
|
mPixelsPerMillimeter = qRound(dpiCommon / 25.4f); |
|
|
|
|
|
|
|
|
|
|
|
setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
setFlag(QGraphicsItem::ItemIsMovable, true); |
|
|
|
setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); |
|
|
|
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); |
|
|
@ -399,7 +406,7 @@ void UBGraphicsCompass::paintAngleDisplay(QPainter *painter) |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsCompass::paintRadiusDisplay(QPainter *painter) |
|
|
|
void UBGraphicsCompass::paintRadiusDisplay(QPainter *painter) |
|
|
|
{ |
|
|
|
{ |
|
|
|
qreal radiusInCentimeters = rect().width() / (sPixelsPerMillimeter * 10); |
|
|
|
qreal radiusInCentimeters = rect().width() / (mPixelsPerMillimeter * 10); |
|
|
|
QString format = rect().width() >= sDisplayRadiusUnitMinLength ? "%1 cm" : "%1"; |
|
|
|
QString format = rect().width() >= sDisplayRadiusUnitMinLength ? "%1 cm" : "%1"; |
|
|
|
QString radiusText = QString(format).arg(radiusInCentimeters, 0, 'f', 1); |
|
|
|
QString radiusText = QString(format).arg(radiusInCentimeters, 0, 'f', 1); |
|
|
|
|
|
|
|
|
|
|
|