remove unused member variables, label color, minor reformatting

preferencesAboutTextFull
letsfindaway 3 years ago
parent e0c5832200
commit 0b4df26e81
  1. 6
      src/gui/UBBackgroundPalette.cpp
  2. 16
      src/tools/UBGraphicsAxes.cpp
  3. 12
      src/tools/UBGraphicsAxes.h

@ -189,9 +189,15 @@ void UBBackgroundPalette::backgroundChanged()
bool dark = UBApplication::boardController->activeScene()->isDarkBackground();
if (dark)
{
mSliderLabel->setStyleSheet("QLabel { color : white; }");
mIntermediateLinesLabel->setStyleSheet("QLabel { color : white; }");
}
else
{
mSliderLabel->setStyleSheet("QLabel { color : black; }");
mIntermediateLinesLabel->setStyleSheet("QLabel { color : black; }");
}
}
void UBBackgroundPalette::refresh()

@ -210,20 +210,20 @@ void UBGraphicsAxes::paintGraduations(QPainter *painter)
QFontMetricsF fontMetrics(painter->font());
// Update the width of one "centimeter" to correspond to the width of the background grid (whether it is displayed or not)
sPixelsPerCentimeter = UBApplication::boardController->activeScene()->backgroundGridSize();
mPixelsPerCentimeter = UBApplication::boardController->activeScene()->backgroundGridSize();
// When a "centimeter" is too narrow, we only display every 5th number
double numbersWidth = fontMetrics.boundingRect("-00").width();
bool shouldDisplayAllNumbers = (numbersWidth <= (sPixelsPerCentimeter - 5));
bool shouldDisplayAllNumbers = (numbersWidth <= (mPixelsPerCentimeter - 5));
// draw numbers on x axis
int fromX = (xAxis().x1() + sMargin) / sPixelsPerCentimeter;
int toX = (xAxis().x2() - sMargin) / sPixelsPerCentimeter;
int fromX = (xAxis().x1() + sMargin) / mPixelsPerCentimeter;
int toX = (xAxis().x2() - sMargin) / mPixelsPerCentimeter;
for (int centimeters(fromX); centimeters <= toX; centimeters++)
{
bool isImportant = abs(centimeters) == 1 || abs(centimeters) % 5 == 0;
double graduationX = sPixelsPerCentimeter * centimeters;
double graduationX = mPixelsPerCentimeter * centimeters;
double graduationHeight = UBGeometryUtils::millimeterGraduationHeight;
painter->drawLine(QLineF(graduationX, graduationHeight, graduationX, -graduationHeight));
@ -244,13 +244,13 @@ void UBGraphicsAxes::paintGraduations(QPainter *painter)
}
// draw numbers on y axis
int fromY = (-yAxis().y1() + sMargin) / sPixelsPerCentimeter;
int toY = (-yAxis().y2() - sMargin) / sPixelsPerCentimeter;
int fromY = (-yAxis().y1() + sMargin) / mPixelsPerCentimeter;
int toY = (-yAxis().y2() - sMargin) / mPixelsPerCentimeter;
for (int centimeters(fromY); centimeters <= toY; centimeters++)
{
bool isImportant = abs(centimeters) == 1 || abs(centimeters) % 5 == 0;
double graduationY = - sPixelsPerCentimeter * centimeters;
double graduationY = - mPixelsPerCentimeter * centimeters;
double graduationHeight = UBGeometryUtils::millimeterGraduationHeight;
painter->drawLine(QLineF(graduationHeight, graduationY, - graduationHeight, graduationY));

@ -114,14 +114,15 @@ class UBGraphicsAxes : public QObject, public QGraphicsPolygonItem, public UBIte
bool mShowButtons;
bool mShowNumbers;
QCursor mResizeCursorH;
QCursor mResizeCursorV;
int drawLineDirection;
qreal mAntiScaleRatio;
qreal mPixelsPerCentimeter;
QRectF mBounds;
// Constants
static const QRect sDefaultRect;
static const QRect sDefaultRect;
static const int sMinLength = 50; // 1sm
static const int sMaxLength = 35000; // 700sm
@ -132,11 +133,6 @@ class UBGraphicsAxes : public QObject, public QGraphicsPolygonItem, public UBIte
static const int sDrawTransparency = 255;
static const QColor sLightBackgroundDrawColor;
static const QColor sDarkBackgroundDrawColor;
qreal mStrokeWidth;
qreal mAntiScaleRatio;
qreal sPixelsPerCentimeter;
QRectF mBounds;
};
#endif // UBGRAPHICSAXES_H

Loading…
Cancel
Save