Skip to content

Commit

Permalink
Reduce max thickness
Browse files Browse the repository at this point in the history
The thickness slider is fairly small, so it's difficult to make small
adjustments. The max value of the thickness slider is currently 100, which
is actually pretty huge.

Since most common use cases involve smaller pixel values (closer to the
0-10 range, I suspect), reduce the maximum slider value to 25, allowing for
easier fine grained control of the drawing thickness.

Although fine grained control is already possible via the scroll wheel,
this change improves the overall usability of the tool, especially for new
users who many not know that thickness can be adjusted with the scroll
wheel (or for users who don't have a scroll wheel).
  • Loading branch information
mgalgs committed Oct 6, 2021
1 parent 48c9d47 commit 3be7a2b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/widgets/capture/capturewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ void CaptureWidget::moveSelection(QPoint p)

void CaptureWidget::updateThickness(int thickness)
{
m_context.thickness = qBound(1, thickness, 100);
m_context.thickness = qBound(1, thickness, maxDrawThickness);

QPoint topLeft =
QGuiAppCurrentScreen().currentScreen()->geometry().topLeft();
Expand Down Expand Up @@ -1290,7 +1290,7 @@ void CaptureWidget::removeToolObject(int index)

void CaptureWidget::setDrawThickness(const int& t)
{
m_context.thickness = qBound(1, t, 100);
m_context.thickness = qBound(1, t, maxDrawThickness);
// save draw thickness for text and other tool separately
if (m_activeButton) {
if (m_activeButton->tool() &&
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/panel/sidepanelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)

QFormLayout* colorForm = new QFormLayout();
m_thicknessSlider = new QSlider(Qt::Horizontal);
m_thicknessSlider->setRange(1, 100);
m_thicknessSlider->setRange(1, maxDrawThickness);
m_thicknessSlider->setValue(m_thickness);
m_colorLabel = new QLabel();
m_colorLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
Expand Down Expand Up @@ -105,7 +105,7 @@ void SidePanelWidget::updateColorNoWheel(const QColor& c)

void SidePanelWidget::updateThickness(const int& t)
{
m_thickness = qBound(0, t, 100);
m_thickness = qBound(0, t, maxDrawThickness);
m_thicknessSlider->setValue(m_thickness);
}

Expand Down
2 changes: 2 additions & 0 deletions src/widgets/panel/sidepanelwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ColorGrabWidget;
class QColorPickingEventFilter;
class QSlider;

constexpr int maxDrawThickness = 50;

class SidePanelWidget : public QWidget
{
Q_OBJECT
Expand Down

0 comments on commit 3be7a2b

Please sign in to comment.