Make showing a slider for an IntEntry optional

This commit is contained in:
Martín Capello 2025-09-26 08:53:37 -03:00
parent 8c1fa31abd
commit 26cf154198
2 changed files with 37 additions and 29 deletions

View File

@ -175,6 +175,7 @@ void IntEntry::openPopup()
{
m_slider->setValue(getValue());
if (m_useSlider) {
// We weren't able to reproduce it, but there are crash reports
// where this openPopup() function is called and the popup is still
// alive, with the slider inside (we have to remove it before
@ -212,6 +213,7 @@ void IntEntry::openPopup()
m_popupWindow->setHotRegion(rgn);
m_popupWindow->openWindow();
}
}
void IntEntry::closePopup()

View File

@ -27,6 +27,10 @@ public:
virtual int getValue() const;
virtual void setValue(int value);
// If useSlider is false, then it won't show the slider popup to change its
// value.
void useSlider(bool useSlider) { m_useSlider = useSlider; }
protected:
bool onProcessMessage(Message* msg) override;
void onInitTheme(InitThemeEvent& ev) override;
@ -42,6 +46,8 @@ protected:
int m_max;
std::unique_ptr<PopupWindow> m_popupWindow;
bool m_changeFromSlider;
// If true a slider can be used to modify the value.
bool m_useSlider = true;
std::unique_ptr<Slider> m_slider;
private: