remove unused member variables, label color, minor reformatting

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

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

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

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

Loading…
Cancel
Save