PixelPaint: Specify histogram height in GML

The histogram is perfectly fine with being drawn at any size, but the
code currently fixes its height to 65. Once the histogram is in a
subclass and several GML things around it change, the fixed height
breaks, so we move the height specification to GML. Additionally, the
container is specified to shrink as much as possible, alleviating a
hard-coded UI size. The user can now change histogram height in GML,
which is a lot more obvious.
This commit is contained in:
kleines Filmröllchen 2022-08-28 16:26:23 +02:00 committed by Linus Groh
parent b2203e6417
commit 8b60305698
Notes: sideshowbarker 2024-07-17 07:32:32 +09:00
3 changed files with 3 additions and 8 deletions

View File

@ -16,11 +16,6 @@ REGISTER_WIDGET(PixelPaint, HistogramWidget);
namespace PixelPaint {
HistogramWidget::HistogramWidget()
{
set_height(65);
}
HistogramWidget::~HistogramWidget()
{
if (m_image)

View File

@ -24,7 +24,7 @@ public:
void set_color_at_mouseposition(Color);
private:
HistogramWidget();
HistogramWidget() = default;
virtual void paint_event(GUI::PaintEvent&) override;

View File

@ -66,14 +66,14 @@
@GUI::GroupBox {
title: "Histogram"
max_height: 90
preferred_height: "shrink"
layout: @GUI::VerticalBoxLayout {
margins: [6]
}
@PixelPaint::HistogramWidget {
name: "histogram_widget"
max_height: 65
min_height: 65
}
}