mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Remove twidget header.
This commit is contained in:
@@ -736,7 +736,7 @@ void Application::registerLeaveSubscription(QWidget *widget) {
|
||||
#ifdef Q_OS_MAC
|
||||
if (const auto topLevel = widget->window()) {
|
||||
if (topLevel == _window->widget()) {
|
||||
auto weak = make_weak(widget);
|
||||
auto weak = Ui::MakeWeak(widget);
|
||||
auto subscription = _window->widget()->leaveEvents(
|
||||
) | rpl::start_with_next([weak] {
|
||||
if (const auto window = weak.data()) {
|
||||
@@ -862,3 +862,11 @@ Application &App() {
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
namespace Ui {
|
||||
|
||||
void PostponeCall(FnMut<void()> &&callable) {
|
||||
Core::App().postponeCall(std::move(callable));
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
@@ -47,7 +47,7 @@ auto QtSignalProducer(Object *object, Signal signal) {
|
||||
NoArgument,
|
||||
rpl::empty_value,
|
||||
std::remove_const_t<std::decay_t<Value>>>;
|
||||
const auto guarded = make_weak(object);
|
||||
const auto guarded = QPointer<Object>(object);
|
||||
return rpl::make_producer<Produced>([=](auto consumer) {
|
||||
if (!guarded) {
|
||||
return rpl::lifetime();
|
||||
@@ -59,7 +59,7 @@ auto QtSignalProducer(Object *object, Signal signal) {
|
||||
signal,
|
||||
listener,
|
||||
std::forward<decltype(handler)>(handler));
|
||||
const auto weak = make_weak(listener);
|
||||
const auto weak = QPointer<QObject>(listener);
|
||||
return rpl::lifetime([=] {
|
||||
if (weak) {
|
||||
delete weak;
|
||||
|
@@ -513,7 +513,7 @@ bool Sandbox::notify(QObject *receiver, QEvent *e) {
|
||||
|
||||
const auto wrap = createEventNestingLevel();
|
||||
if (e->type() == QEvent::UpdateRequest) {
|
||||
const auto weak = make_weak(receiver);
|
||||
const auto weak = QPointer<QObject>(receiver);
|
||||
_widgetUpdateRequests.fire({});
|
||||
if (!weak) {
|
||||
return true;
|
||||
|
@@ -25,17 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace base {
|
||||
|
||||
template <typename D, typename T>
|
||||
inline constexpr D up_cast(T object) {
|
||||
using DV = std::decay_t<decltype(*D())>;
|
||||
using TV = std::decay_t<decltype(*T())>;
|
||||
if constexpr (std::is_base_of_v<DV, TV>) {
|
||||
return object;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
using set_of_unique_ptr = std::set<std::unique_ptr<T>, base::pointer_comparator<T>>;
|
||||
|
||||
|
Reference in New Issue
Block a user