Allow setting heightMin in ResizeFitChild.

This commit is contained in:
John Preston 2023-08-23 11:22:34 +02:00
parent a3c52c2cfe
commit 552db4b24f
2 changed files with 7 additions and 3 deletions

View file

@ -80,7 +80,8 @@ void ToggleChildrenVisibility(not_null<QWidget*> widget, bool visible) {
void ResizeFitChild( void ResizeFitChild(
not_null<RpWidget*> parent, not_null<RpWidget*> parent,
not_null<RpWidget*> child) { not_null<RpWidget*> child,
int heightMin) {
parent->widthValue( parent->widthValue(
) | rpl::start_with_next([=](int width) { ) | rpl::start_with_next([=](int width) {
child->resizeToWidth(width); child->resizeToWidth(width);
@ -88,7 +89,7 @@ void ResizeFitChild(
child->heightValue( child->heightValue(
) | rpl::start_with_next([=](int height) { ) | rpl::start_with_next([=](int height) {
parent->resize(parent->width(), height); parent->resize(parent->width(), std::max(height, heightMin));
}, child->lifetime()); }, child->lifetime());
} }

View file

@ -261,7 +261,10 @@ namespace Ui {
class RpWidget; class RpWidget;
void ResizeFitChild(not_null<RpWidget*> parent, not_null<RpWidget*> child); void ResizeFitChild(
not_null<RpWidget*> parent,
not_null<RpWidget*> child,
int heightMin = 0);
template <typename Widget> template <typename Widget>
using RpWidgetParent = std::conditional_t< using RpWidgetParent = std::conditional_t<