src/RangedSlider.cpp

changeset 99
053c0578cf58
parent 97
8283bbf95806
child 100
d11a3e713e3b
--- a/src/RangedSlider.cpp	Fri Apr 01 14:58:57 2022 +0200
+++ b/src/RangedSlider.cpp	Fri Apr 01 16:52:25 2022 +0200
@@ -38,8 +38,7 @@
 
 #include <QDebug>
 
-RangedSlider::RangedSlider(QWidget* parent)
-   : QWidget(parent),
+RangedSlider::RangedSlider(QWidget* parent) : QWidget(parent),
     _min(0.0),
     _max(1.0),
     _prefMin(0.25),
@@ -52,12 +51,10 @@
     _prefRangePen(Qt::NoPen),
     _markerBrush(QColor(255,255,255)),
     _markerTextIsValue(false),
-    indicatorTextFont("Arial",
-                       10,
-                       QFont::Normal) // Previously we just did the indicator text in 'default' font
+    indicatorTextFont("Arial", 10, QFont::Normal) // Previously we just did the indicator text in 'default' font
 {
-   // Ensure this->heightInPixels is properly initialised
-   this->recalculateHeightInPixels();
+    // Ensure this->heightInPixels is properly initialised
+//    this->recalculateHeightInPixels();
 
    // In principle we want to set our min/max sizes etc here.  However, if, say, a maximumSize property has been set
    // for this object in a Designer UI File (eg ui/mainWindow.ui) then that setting will override this one, because it
@@ -94,7 +91,7 @@
 
 void RangedSlider::setRange(QPair<double,double> minmax)
 {
-   setRange( minmax.first, minmax.second );
+    setRange( minmax.first, minmax.second );
 }
 
 
@@ -198,16 +195,13 @@
    // could end up painting us into a corner.
    //
    //QFontMetrics indicatorTextFontMetrics(this->indicatorTextFont);
-   this->heightInPixels = this->height(); //indicatorTextFontMetrics.lineSpacing();
+//   this->heightInPixels = this->height();
    return;
 }
 
 void RangedSlider::setSizes() {
-   // Caller's responsibility to have recently called this->recalculateHeightInPixels().  (See comment in that function
-   // for how we choose minimum width.)
-//   this->setMinimumSize(2 * this->heightInPixels, this->heightInPixels);
+   // Fixed minimum size.
    this->setMinimumSize(60, 20);
-
    this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
 
    // There no particular reason to limit our horizontal size, so, in principle, this call asks that there be no such
@@ -217,11 +211,11 @@
    return;
 }
 
-QSize RangedSlider::sizeHint() const
-{
-   this->recalculateHeightInPixels();
-   return QSize(4 * this->heightInPixels, this->heightInPixels);
-}
+//QSize RangedSlider::sizeHint() const
+//{
+//   this->recalculateHeightInPixels();
+//   return QSize(4 * this->heightInPixels, this->heightInPixels);
+//}
 
 void RangedSlider::mouseMoveEvent(QMouseEvent* event)
 {

mercurial