Allow destroying Ui::Window on close.
This commit is contained in:
parent
91e1979da5
commit
52ac632bc4
3 changed files with 18 additions and 3 deletions
|
|
@ -79,6 +79,10 @@ const Emoji::One *Integration::defaultEmojiVariant(const Emoji::One *emoji) {
|
|||
return emoji;
|
||||
}
|
||||
|
||||
QWidget *Integration::modalWindowParent() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rpl::producer<> Integration::forcePopupMenuHideRequests() {
|
||||
return rpl::never<rpl::empty_value>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ public:
|
|||
[[nodiscard]] virtual const Emoji::One *defaultEmojiVariant(
|
||||
const Emoji::One *emoji);
|
||||
|
||||
[[nodiscard]] virtual QWidget *modalWindowParent();
|
||||
|
||||
[[nodiscard]] virtual rpl::producer<> forcePopupMenuHideRequests();
|
||||
|
||||
[[nodiscard]] virtual QString phraseContextCopyText();
|
||||
|
|
|
|||
|
|
@ -90,12 +90,16 @@ not_null<QWidget*> TitleControls::window() const {
|
|||
|
||||
void TitleControls::init(Fn<void(bool maximized)> maximize) {
|
||||
_minimize->setClickedCallback([=] {
|
||||
const auto weak = MakeWeak(_minimize.data());
|
||||
window()->setWindowState(
|
||||
window()->windowState() | Qt::WindowMinimized);
|
||||
_minimize->clearState();
|
||||
if (weak) {
|
||||
_minimize->clearState();
|
||||
}
|
||||
});
|
||||
_minimize->setPointerCursor(false);
|
||||
_maximizeRestore->setClickedCallback([=] {
|
||||
const auto weak = MakeWeak(_maximizeRestore.data());
|
||||
if (maximize) {
|
||||
maximize(!_maximizedState);
|
||||
} else {
|
||||
|
|
@ -103,12 +107,17 @@ void TitleControls::init(Fn<void(bool maximized)> maximize) {
|
|||
? Qt::WindowNoState
|
||||
: Qt::WindowMaximized);
|
||||
}
|
||||
_maximizeRestore->clearState();
|
||||
if (weak) {
|
||||
_maximizeRestore->clearState();
|
||||
}
|
||||
});
|
||||
_maximizeRestore->setPointerCursor(false);
|
||||
_close->setClickedCallback([=] {
|
||||
const auto weak = MakeWeak(_close.data());
|
||||
window()->close();
|
||||
_close->clearState();
|
||||
if (weak) {
|
||||
_close->clearState();
|
||||
}
|
||||
});
|
||||
_close->setPointerCursor(false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue