Skip to content

Commit

Permalink
Snap the DPI Y value to the current X value if the box was checked
Browse files Browse the repository at this point in the history
  • Loading branch information
z3ntu committed May 4, 2024
1 parent d9f742f commit 8348b59
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/devicewidget/dpisliderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ DpiSliderWidget::DpiSliderWidget(QWidget *parent, libopenrazer::Device *device)
connect(dpiSyncCheckbox, &QCheckBox::clicked, this, [=](bool checked) {
syncDpi = checked;
updateXYVisibility();

/* Snap the Y value to the current X value when the box is checked */
if (checked) {
dpiYSlider->setValue(dpiXSlider->value());
/* Set DPI on the device manually, the dpiChanged function doesn't
* do that for just setting Y with syncDpi=true */
ushort dpi = dpiXSlider->value() * 100;
device->setDPI({ dpi, dpi });
}
});

verticalLayout->addLayout(dpiHeaderHBox);
Expand Down

0 comments on commit 8348b59

Please sign in to comment.