mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
Fix tabbed section / panel render glitches.
This commit is contained in:
parent
507b7d7193
commit
1791b251ad
4 changed files with 26 additions and 15 deletions
|
@ -665,6 +665,22 @@ HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*>
|
|||
onPreviewCheck();
|
||||
}
|
||||
}));
|
||||
subscribe(controller->widgetGrabbed(), [this] {
|
||||
// Qt bug workaround: QWidget::render() for an arbitrary widget calls
|
||||
// sendPendingMoveAndResizeEvents(true, true) for the whole window,
|
||||
// which does something like:
|
||||
//
|
||||
// setAttribute(Qt::WA_UpdatesDisabled);
|
||||
// sendEvent(QResizeEvent);
|
||||
// setAttribute(Qt::WA_UpdatesDisabled, false);
|
||||
//
|
||||
// So if we create TabbedSection widget in HistoryWidget::resizeEvent()
|
||||
// it will get an enabled Qt::WA_UpdatesDisabled from its parent and it
|
||||
// will never be rendered, because no one will ever remove that attribute.
|
||||
//
|
||||
// So we force HistoryWidget::resizeEvent() here, without WA_UpdatesDisabled.
|
||||
myEnsureResized(this);
|
||||
});
|
||||
|
||||
orderWidgets();
|
||||
}
|
||||
|
@ -3971,6 +3987,7 @@ void HistoryWidget::updateTabbedSelectorSectionShown() {
|
|||
updateControlsVisibility();
|
||||
} else {
|
||||
_tabbedPanel.create(this, controller(), _tabbedSection->takeSelector());
|
||||
_tabbedPanel->hide();
|
||||
_tabbedSelectorToggle->installEventFilter(_tabbedPanel);
|
||||
_tabbedSection.destroy();
|
||||
_tabbedSelectorToggle->setColorOverrides(nullptr, nullptr, nullptr);
|
||||
|
|
|
@ -2567,21 +2567,6 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
|
|||
return false;
|
||||
};
|
||||
|
||||
// Qt bug workaround: QWidget::render() for an arbitrary widget calls
|
||||
// sendPendingMoveAndResizeEvents(true, true) for the whole window,
|
||||
// which does something like:
|
||||
//
|
||||
// setAttribute(Qt::WA_UpdatesDisabled);
|
||||
// sendEvent(QResizeEvent);
|
||||
// setAttribute(Qt::WA_UpdatesDisabled, false);
|
||||
//
|
||||
// So if we create TabbedSection widget in HistoryWidget::resizeEvent()
|
||||
// it will get an enabled Qt::WA_UpdatesDisabled from its parent and it
|
||||
// will never be rendered, because no one will ever remove that attribute.
|
||||
//
|
||||
// So we force HistoryWidget::resizeEvent() here, without WA_UpdatesDisabled.
|
||||
myEnsureResized(_history);
|
||||
|
||||
auto animationParams = animatedShow() ? prepareHistoryAnimation(peerId) : Window::SectionSlideParams();
|
||||
|
||||
if (_history->peer() && _history->peer()->id != peerId && way != Ui::ShowWay::Forward) {
|
||||
|
|
|
@ -18,8 +18,11 @@ to link the code of portions of this program with the OpenSSL library.
|
|||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "twidget.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "mainwindow.h"
|
||||
#include "window/window_controller.h"
|
||||
|
||||
namespace Fonts {
|
||||
namespace {
|
||||
|
@ -153,6 +156,8 @@ QPixmap myGrab(TWidget *target, QRect rect, QColor bg) {
|
|||
result.fill(bg);
|
||||
}
|
||||
|
||||
App::wnd()->controller()->widgetGrabbed().notify(true);
|
||||
|
||||
target->grabStart();
|
||||
target->render(&result, QPoint(0, 0), rect, QWidget::DrawChildren | QWidget::IgnoreMask);
|
||||
target->grabFinish();
|
||||
|
|
|
@ -68,6 +68,9 @@ public:
|
|||
base::Observable<void> &floatPlayerAreaUpdated() {
|
||||
return _floatPlayerAreaUpdated;
|
||||
}
|
||||
base::Observable<void> &widgetGrabbed() {
|
||||
return _widgetGrabbed;
|
||||
}
|
||||
|
||||
struct ColumnLayout {
|
||||
int bodyWidth;
|
||||
|
@ -108,6 +111,7 @@ private:
|
|||
GifPauseReasons _gifPauseReasons = { 0 };
|
||||
base::Observable<void> _gifPauseLevelChanged;
|
||||
base::Observable<void> _floatPlayerAreaUpdated;
|
||||
base::Observable<void> _widgetGrabbed;
|
||||
|
||||
base::Variable<float64> _dialogsWidthRatio = { kDefaultDialogsWidthRatio };
|
||||
base::Variable<bool> _dialogsListFocused = { false };
|
||||
|
|
Loading…
Add table
Reference in a new issue