Allow setting heightMin in ResizeFitChild.
This commit is contained in:
parent
a3c52c2cfe
commit
552db4b24f
2 changed files with 7 additions and 3 deletions
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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<
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue