Skip to content

Commit

Permalink
Refactor constructors in DoubleSlider and FilterNumbers to support de…
Browse files Browse the repository at this point in the history
…fault parent parameter.
  • Loading branch information
przemek83 committed Jan 13, 2025
1 parent 62d67d3 commit 683a77a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/wble/DoubleSlider.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class WBLE_EXPORT DoubleSlider : public QSlider
/// @param min Minimum value of slider.
/// @param max Maximum value of slider.
/// @param parent Parent widget.
DoubleSlider(double min, double max, QWidget* parent = nullptr);
DoubleSlider(double min, double max, QWidget* parent);
DoubleSlider(double min, double max);

/// Get slider minimum value.
/// @return Slider minimum value.
Expand Down
4 changes: 2 additions & 2 deletions include/wble/FilterNumbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class WBLE_EXPORT FilterNumbers : public Filter
{
Q_OBJECT
public:
FilterNumbers(const QString& name, double from, double to,
QWidget* parent = nullptr);
FilterNumbers(const QString& name, double from, double to, QWidget* parent);
FilterNumbers(const QString& name, double from, double to);

~FilterNumbers() override;

Expand Down
5 changes: 5 additions & 0 deletions src/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ DoubleSlider::DoubleSlider(double min, double max, QWidget* parent)
setHandleRect();
}

DoubleSlider::DoubleSlider(double min, double max)
: DoubleSlider(min, max, nullptr)
{
}

double DoubleSlider::getCurrentMin() const { return currentMin_; }

double DoubleSlider::getCurrentMax() const { return currentMax_; }
Expand Down
10 changes: 6 additions & 4 deletions src/FilterNumbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ FilterNumbers::FilterNumbers(const QString& name, double from, double to,
setDisabled(true);
}

FilterNumbers::FilterNumbers(const QString& name, double from, double to)
: FilterNumbers(name, from, to, nullptr)
{
}

FilterNumbers::~FilterNumbers() = default;

void FilterNumbers::checkedStateChanged(bool checked)
Expand All @@ -54,10 +59,7 @@ void FilterNumbers::changeEvent(QEvent* event)
initColorForLineEdits();
}

int FilterNumbers::getDecimalPlaces() const
{
return decimalPlaces_;
}
int FilterNumbers::getDecimalPlaces() const { return decimalPlaces_; }

void FilterNumbers::initDoubleSlider()
{
Expand Down

0 comments on commit 683a77a

Please sign in to comment.