Support hidden custom title on macOS.
This commit is contained in:
parent
3d5108a878
commit
c45b62084c
3 changed files with 14 additions and 0 deletions
|
|
@ -197,6 +197,9 @@ WindowHelper::WindowHelper(not_null<RpWidget*> window)
|
|||
_private->customTitleHeight())
|
||||
: nullptr)
|
||||
, _body(Ui::CreateChild<RpWidget>(window.get())) {
|
||||
if (_title->shouldBeHidden()) {
|
||||
toggleCustomTitle(false);
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
@ -218,10 +221,16 @@ void WindowHelper::setTitle(const QString &title) {
|
|||
void WindowHelper::setTitleStyle(const style::WindowTitle &st) {
|
||||
if (_title) {
|
||||
_title->setStyle(st);
|
||||
if (_title->shouldBeHidden()) {
|
||||
toggleCustomTitle(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WindowHelper::toggleCustomTitle(bool visible) {
|
||||
if (_title->shouldBeHidden()) {
|
||||
visible = false;
|
||||
}
|
||||
if (!_title || _title->isHidden() != visible) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public:
|
|||
void setText(const QString &text);
|
||||
void setStyle(const style::WindowTitle &st);
|
||||
[[nodiscard]] QString text() const;
|
||||
[[nodiscard]] bool shouldBeHidden() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ void TitleWidget::setStyle(const style::WindowTitle &st) {
|
|||
update();
|
||||
}
|
||||
|
||||
bool TitleWidget::shouldBeHidden() const {
|
||||
return !_st->height;
|
||||
}
|
||||
|
||||
QString TitleWidget::text() const {
|
||||
return _text;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue