2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 10:17:10 +00:00

Merge TWidget* into Ui::RpWidget*.

This commit is contained in:
John Preston 2025-08-11 13:54:52 +04:00
parent cc98f7da36
commit d60bfa238f
29 changed files with 49 additions and 53 deletions

View File

@ -126,7 +126,7 @@ int Style::minButtonWidth(HistoryMessageMarkupButton::Type type) const {
BotKeyboard::BotKeyboard( BotKeyboard::BotKeyboard(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
QWidget *parent) QWidget *parent)
: TWidget(parent) : RpWidget(parent)
, _controller(controller) , _controller(controller)
, _st(&st::botKbButton) { , _st(&st::botKbButton) {
setGeometry(0, 0, _st->margin, st::botKbScroll.deltat); setGeometry(0, 0, _st->margin, st::botKbScroll.deltat);

View File

@ -21,7 +21,7 @@ class SessionController;
} // namespace Window } // namespace Window
class BotKeyboard class BotKeyboard
: public TWidget : public Ui::RpWidget
, public Ui::AbstractTooltipShower , public Ui::AbstractTooltipShower
, public ClickHandlerHost { , public ClickHandlerHost {
public: public:
@ -44,7 +44,7 @@ public:
void step_selected(crl::time ms, bool timer); void step_selected(crl::time ms, bool timer);
void resizeToWidth(int newWidth, int maxOuterHeight) { void resizeToWidth(int newWidth, int maxOuterHeight) {
_maxOuterHeight = maxOuterHeight; _maxOuterHeight = maxOuterHeight;
return TWidget::resizeToWidth(newWidth); return RpWidget::resizeToWidth(newWidth);
} }
[[nodiscard]] bool maximizeSize() const; [[nodiscard]] bool maximizeSize() const;

View File

@ -704,12 +704,12 @@ void SuggestionsWidget::enterEventHook(QEnterEvent *e) {
if (!inner().contains(mapToInner(QCursor::pos()))) { if (!inner().contains(mapToInner(QCursor::pos()))) {
clearMouseSelection(); clearMouseSelection();
} }
return TWidget::enterEventHook(e); return RpWidget::enterEventHook(e);
} }
void SuggestionsWidget::leaveEventHook(QEvent *e) { void SuggestionsWidget::leaveEventHook(QEvent *e) {
clearMouseSelection(); clearMouseSelection();
return TWidget::leaveEventHook(e); return RpWidget::leaveEventHook(e);
} }
SuggestionsController::SuggestionsController( SuggestionsController::SuggestionsController(

View File

@ -277,7 +277,7 @@ void TabbedPanel::leaveEventHook(QEvent *e) {
} else { } else {
_hideTimer.callOnce(kHideTimeoutMs); _hideTimer.callOnce(kHideTimeoutMs);
} }
return TWidget::leaveEventHook(e); return RpWidget::leaveEventHook(e);
} }
void TabbedPanel::otherEnter() { void TabbedPanel::otherEnter() {

View File

@ -1008,7 +1008,7 @@ void InnerWidget::itemsAdded(Direction direction, int addedCount) {
} }
void InnerWidget::updateSize() { void InnerWidget::updateSize() {
TWidget::resizeToWidth(width()); RpWidget::resizeToWidth(width());
restoreScrollPosition(); restoreScrollPosition();
updateVisibleTopItem(); updateVisibleTopItem();
checkPreloadMore(); checkPreloadMore();
@ -1684,7 +1684,7 @@ void InnerWidget::mouseReleaseEvent(QMouseEvent *e) {
void InnerWidget::enterEventHook(QEnterEvent *e) { void InnerWidget::enterEventHook(QEnterEvent *e) {
mouseActionUpdate(QCursor::pos()); mouseActionUpdate(QCursor::pos());
return TWidget::enterEventHook(e); return RpWidget::enterEventHook(e);
} }
void InnerWidget::leaveEventHook(QEvent *e) { void InnerWidget::leaveEventHook(QEvent *e) {
@ -1698,7 +1698,7 @@ void InnerWidget::leaveEventHook(QEvent *e) {
_cursor = style::cur_default; _cursor = style::cur_default;
setCursor(_cursor); setCursor(_cursor);
} }
return TWidget::leaveEventHook(e); return RpWidget::leaveEventHook(e);
} }
void InnerWidget::mouseActionStart(const QPoint &screenPos, Qt::MouseButton button) { void InnerWidget::mouseActionStart(const QPoint &screenPos, Qt::MouseButton button) {

View File

@ -77,7 +77,7 @@ public:
void resizeToWidth(int newWidth, int minHeight) { void resizeToWidth(int newWidth, int minHeight) {
_minHeight = minHeight; _minHeight = minHeight;
return TWidget::resizeToWidth(newWidth); return RpWidget::resizeToWidth(newWidth);
} }
void saveState(not_null<SectionMemento*> memento); void saveState(not_null<SectionMemento*> memento);

View File

@ -37,7 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace AdminLog { namespace AdminLog {
class FixedBar final : public TWidget { class FixedBar final : public Ui::RpWidget {
public: public:
FixedBar( FixedBar(
QWidget *parent, QWidget *parent,
@ -109,7 +109,8 @@ object_ptr<Window::SectionWidget> SectionMemento::createWidget(
FixedBar::FixedBar( FixedBar::FixedBar(
QWidget *parent, QWidget *parent,
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
not_null<ChannelData*> channel) : TWidget(parent) not_null<ChannelData*> channel)
: RpWidget(parent)
, _controller(controller) , _controller(controller)
, _channel(channel) , _channel(channel)
, _field(this, st::defaultMultiSelectSearchField, tr::lng_dlg_filter()) , _field(this, st::defaultMultiSelectSearchField, tr::lng_dlg_filter())
@ -276,7 +277,7 @@ void FixedBar::mousePressEvent(QMouseEvent *e) {
if (e->button() == Qt::LeftButton) { if (e->button() == Qt::LeftButton) {
goBack(); goBack();
} else { } else {
TWidget::mousePressEvent(e); RpWidget::mousePressEvent(e);
} }
} }

View File

@ -3732,7 +3732,7 @@ void HistoryInner::setShownPinned(HistoryItem *item) {
void HistoryInner::enterEventHook(QEnterEvent *e) { void HistoryInner::enterEventHook(QEnterEvent *e) {
_mouseActive = true; _mouseActive = true;
mouseActionUpdate(QCursor::pos()); mouseActionUpdate(QCursor::pos());
return TWidget::enterEventHook(e); return RpWidget::enterEventHook(e);
} }
void HistoryInner::leaveEventHook(QEvent *e) { void HistoryInner::leaveEventHook(QEvent *e) {
@ -3748,7 +3748,7 @@ void HistoryInner::leaveEventHook(QEvent *e) {
setCursor(_cursor); setCursor(_cursor);
} }
_mouseActive = false; _mouseActive = false;
return TWidget::leaveEventHook(e); return RpWidget::leaveEventHook(e);
} }
HistoryInner::~HistoryInner() { HistoryInner::~HistoryInner() {
@ -3770,7 +3770,7 @@ HistoryInner::~HistoryInner() {
bool HistoryInner::focusNextPrevChild(bool next) { bool HistoryInner::focusNextPrevChild(bool next) {
if (_selected.empty()) { if (_selected.empty()) {
return TWidget::focusNextPrevChild(next); return RpWidget::focusNextPrevChild(next);
} else { } else {
clearSelected(); clearSelected();
return true; return true;

View File

@ -5187,7 +5187,7 @@ void HistoryWidget::updateOverStates(QPoint pos) {
} }
void HistoryWidget::leaveToChildEvent(QEvent *e, QWidget *child) { void HistoryWidget::leaveToChildEvent(QEvent *e, QWidget *child) {
// e -- from enterEvent() of child TWidget // e -- from enterEvent() of child RpWidget
if (hasMouseTracking()) { if (hasMouseTracking()) {
updateOverStates(mapFromGlobal(QCursor::pos())); updateOverStates(mapFromGlobal(QCursor::pos()));
} }
@ -5367,7 +5367,7 @@ bool HistoryWidget::eventFilter(QObject *obj, QEvent *e) {
} }
} }
} }
return TWidget::eventFilter(obj, e); return RpWidget::eventFilter(obj, e);
} }
bool HistoryWidget::floatPlayerHandleWheelEvent(QEvent *e) { bool HistoryWidget::floatPlayerHandleWheelEvent(QEvent *e) {

View File

@ -1993,7 +1993,7 @@ void ListWidget::updateSize() {
void ListWidget::resizeToWidth(int newWidth, int minHeight) { void ListWidget::resizeToWidth(int newWidth, int minHeight) {
_minHeight = minHeight; _minHeight = minHeight;
TWidget::resizeToWidth(newWidth); RpWidget::resizeToWidth(newWidth);
restoreScrollPosition(); restoreScrollPosition();
} }
@ -3205,7 +3205,7 @@ rpl::producer<bool> ListWidget::touchMaybeSelectingValue() const {
void ListWidget::enterEventHook(QEnterEvent *e) { void ListWidget::enterEventHook(QEnterEvent *e) {
_mouseActive = true; _mouseActive = true;
mouseActionUpdate(QCursor::pos()); mouseActionUpdate(QCursor::pos());
return TWidget::enterEventHook(e); return RpWidget::enterEventHook(e);
} }
void ListWidget::leaveEventHook(QEvent *e) { void ListWidget::leaveEventHook(QEvent *e) {
@ -3225,7 +3225,7 @@ void ListWidget::leaveEventHook(QEvent *e) {
setCursor(_cursor); setCursor(_cursor);
} }
_mouseActive = false; _mouseActive = false;
return TWidget::leaveEventHook(e); return RpWidget::leaveEventHook(e);
} }
void ListWidget::updateDragSelection() { void ListWidget::updateDragSelection() {

View File

@ -233,7 +233,7 @@ private:
object_ptr<Ui::IconButton> _menuToggle; object_ptr<Ui::IconButton> _menuToggle;
base::unique_qptr<Ui::PopupMenu> _menu; base::unique_qptr<Ui::PopupMenu> _menu;
object_ptr<TWidget> _membersShowArea = { nullptr }; object_ptr<RpWidget> _membersShowArea = { nullptr };
rpl::event_stream<bool> _membersShowAreaActive; rpl::event_stream<bool> _membersShowAreaActive;
float64 _narrowRatio = 0.; float64 _narrowRatio = 0.;

View File

@ -80,7 +80,7 @@ Widget::Widget(
// Inner widget has OpaquePaintEvent attribute so it doesn't repaint on scroll. // Inner widget has OpaquePaintEvent attribute so it doesn't repaint on scroll.
// But we should force it to repaint so that GIFs will continue to animate without update() calls. // But we should force it to repaint so that GIFs will continue to animate without update() calls.
// We do that by creating a transparent widget above our _inner. // We do that by creating a transparent widget above our _inner.
auto forceRepaintOnScroll = object_ptr<TWidget>(this); auto forceRepaintOnScroll = object_ptr<RpWidget>(this);
forceRepaintOnScroll->setGeometry(innerRect().x() + st::roundRadiusSmall, innerRect().y() + st::roundRadiusSmall, st::roundRadiusSmall, st::roundRadiusSmall); forceRepaintOnScroll->setGeometry(innerRect().x() + st::roundRadiusSmall, innerRect().y() + st::roundRadiusSmall, st::roundRadiusSmall, st::roundRadiusSmall);
forceRepaintOnScroll->setAttribute(Qt::WA_TransparentForMouseEvents); forceRepaintOnScroll->setAttribute(Qt::WA_TransparentForMouseEvents);
forceRepaintOnScroll->show(); forceRepaintOnScroll->show();

View File

@ -99,7 +99,7 @@ void Panel::updateControlsGeometry() {
if (scrollHeight > 0) { if (scrollHeight > 0) {
_scroll->setGeometryToRight(contentRight(), scrollTop, width, scrollHeight); _scroll->setGeometryToRight(contentRight(), scrollTop, width, scrollHeight);
} }
if (const auto widget = static_cast<TWidget*>(_scroll->widget())) { if (const auto widget = static_cast<RpWidget*>(_scroll->widget())) {
widget->resizeToWidth(width); widget->resizeToWidth(width);
} }
} }

View File

@ -109,15 +109,6 @@ public:
void show(OpenRequest request); void show(OpenRequest request);
//void leaveToChildEvent(QEvent *e, QWidget *child) override {
// // e -- from enterEvent() of child TWidget
// updateOverState(Over::None);
//}
//void enterFromChildEvent(QEvent *e, QWidget *child) override {
// // e -- from leaveEvent() of child TWidget
// updateOver(mapFromGlobal(QCursor::pos()));
//}
void activateControls(); void activateControls();
void close(); void close();
void minimize(); void minimize();

View File

@ -12,7 +12,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Profile { namespace Profile {
CoverDropArea::CoverDropArea(QWidget *parent, const QString &title, const QString &subtitle) : TWidget(parent) CoverDropArea::CoverDropArea(
QWidget *parent,
const QString &title,
const QString &subtitle)
: RpWidget(parent)
, _title(title) , _title(title)
, _subtitle(subtitle) , _subtitle(subtitle)
, _titleWidth(st::profileDropAreaTitleFont->width(_title)) , _titleWidth(st::profileDropAreaTitleFont->width(_title))

View File

@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Profile { namespace Profile {
class CoverDropArea : public TWidget { class CoverDropArea : public Ui::RpWidget {
public: public:
CoverDropArea(QWidget *parent, const QString &title, const QString &subtitle); CoverDropArea(QWidget *parent, const QString &title, const QString &subtitle);

View File

@ -296,7 +296,7 @@ void FilterIconPanel::leaveEventHook(QEvent *e) {
} else { } else {
_hideTimer.callOnce(kHideTimeoutMs); _hideTimer.callOnce(kHideTimeoutMs);
} }
return TWidget::leaveEventHook(e); return RpWidget::leaveEventHook(e);
} }
void FilterIconPanel::otherEnter() { void FilterIconPanel::otherEnter() {

View File

@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_media_view.h" #include "styles/style_media_view.h"
class ColorEditor::Picker : public TWidget { class ColorEditor::Picker : public Ui::RpWidget {
public: public:
Picker(QWidget *parent, Mode mode, QColor color); Picker(QWidget *parent, Mode mode, QColor color);
@ -94,7 +94,7 @@ QCursor ColorEditor::Picker::generateCursor() {
} }
ColorEditor::Picker::Picker(QWidget *parent, Mode mode, QColor color) ColorEditor::Picker::Picker(QWidget *parent, Mode mode, QColor color)
: TWidget(parent) : RpWidget(parent)
, _mode(mode) { , _mode(mode) {
setCursor(generateCursor()); setCursor(generateCursor());
@ -292,7 +292,7 @@ void ColorEditor::Picker::setFromColor(QColor color) {
} }
} }
class ColorEditor::Slider : public TWidget { class ColorEditor::Slider : public Ui::RpWidget {
public: public:
enum class Direction { enum class Direction {
Horizontal, Horizontal,
@ -365,7 +365,7 @@ ColorEditor::Slider::Slider(
Direction direction, Direction direction,
Type type, Type type,
QColor color) QColor color)
: TWidget(parent) : RpWidget(parent)
, _direction(direction) , _direction(direction)
, _type(type) , _type(type)
, _color(color.red(), color.green(), color.blue()) , _color(color.red(), color.green(), color.blue())

View File

@ -409,7 +409,7 @@ void Item::setOver(bool over) {
} // namespace } // namespace
class MultiSelect::Inner : public TWidget { class MultiSelect::Inner : public RpWidget {
public: public:
using ScrollCallback = Fn<void(int activeTop, int activeBottom)>; using ScrollCallback = Fn<void(int activeTop, int activeBottom)>;
Inner( Inner(
@ -652,7 +652,7 @@ MultiSelect::Inner::Inner(
rpl::producer<QString> placeholder, rpl::producer<QString> placeholder,
const QString &query, const QString &query,
ScrollCallback callback) ScrollCallback callback)
: TWidget(parent) : RpWidget(parent)
, _st(st) , _st(st)
, _scrollCallback(std::move(callback)) , _scrollCallback(std::move(callback))
, _field(this, _st.field, std::move(placeholder), query) , _field(this, _st.field, std::move(placeholder), query)

View File

@ -995,7 +995,7 @@ bool MainWindow::minimizeToTray() {
return true; return true;
} }
void MainWindow::showRightColumn(object_ptr<TWidget> widget) { void MainWindow::showRightColumn(object_ptr<Ui::RpWidget> widget) {
const auto wasWidth = width(); const auto wasWidth = width();
const auto wasRightWidth = _rightColumn ? _rightColumn->width() : 0; const auto wasRightWidth = _rightColumn ? _rightColumn->width() : 0;
_rightColumn = std::move(widget); _rightColumn = std::move(widget);

View File

@ -100,7 +100,7 @@ public:
} }
void positionUpdated(); void positionUpdated();
void showRightColumn(object_ptr<TWidget> widget); void showRightColumn(object_ptr<Ui::RpWidget> widget);
int maximalExtendBy() const; int maximalExtendBy() const;
bool canExtendNoMove(int extendBy) const; bool canExtendNoMove(int extendBy) const;
@ -215,7 +215,7 @@ private:
object_ptr<Ui::PlainShadow> _titleShadow = { nullptr }; object_ptr<Ui::PlainShadow> _titleShadow = { nullptr };
object_ptr<Ui::RpWidget> _outdated; object_ptr<Ui::RpWidget> _outdated;
object_ptr<Ui::RpWidget> _body; object_ptr<Ui::RpWidget> _body;
object_ptr<TWidget> _rightColumn = { nullptr }; object_ptr<Ui::RpWidget> _rightColumn = { nullptr };
bool _isActive = false; bool _isActive = false;

View File

@ -621,7 +621,7 @@ QPoint Widget::computePosition(int height) const {
return QPoint(_startPosition.x(), _startPosition.y() + realShift); return QPoint(_startPosition.x(), _startPosition.y() + realShift);
} }
Background::Background(QWidget *parent) : TWidget(parent) { Background::Background(QWidget *parent) : RpWidget(parent) {
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
} }

View File

@ -190,7 +190,7 @@ private:
}; };
class Background : public TWidget { class Background : public Ui::RpWidget {
public: public:
Background(QWidget *parent); Background(QWidget *parent);

View File

@ -47,7 +47,7 @@ struct ParsedTheme {
[[nodiscard]] Data::CloudTheme ReadCloudFromText(const QByteArray &text); [[nodiscard]] Data::CloudTheme ReadCloudFromText(const QByteArray &text);
[[nodiscard]] QByteArray StripCloudTextFields(const QByteArray &text); [[nodiscard]] QByteArray StripCloudTextFields(const QByteArray &text);
class Editor : public TWidget { class Editor : public Ui::RpWidget {
public: public:
Editor( Editor(
QWidget*, QWidget*,

View File

@ -26,7 +26,7 @@ constexpr int kWaitBeforeRevertMs = 15999;
} // namespace } // namespace
WarningWidget::WarningWidget(QWidget *parent) WarningWidget::WarningWidget(QWidget *parent)
: TWidget(parent) : RpWidget(parent)
, _timer([=] { handleTimer(); }) , _timer([=] { handleTimer(); })
, _secondsLeft(kWaitBeforeRevertMs / 1000) , _secondsLeft(kWaitBeforeRevertMs / 1000)
, _keepChanges(this, tr::lng_theme_keep_changes(), st::defaultBoxButton) , _keepChanges(this, tr::lng_theme_keep_changes(), st::defaultBoxButton)

View File

@ -19,7 +19,7 @@ class RoundButton;
namespace Window { namespace Window {
namespace Theme { namespace Theme {
class WarningWidget : public TWidget { class WarningWidget : public Ui::RpWidget {
public: public:
WarningWidget(QWidget *parent); WarningWidget(QWidget *parent);

View File

@ -431,7 +431,7 @@ void Controller::showBox(
_widget.showOrHideBoxOrLayer(std::move(content), options, animated); _widget.showOrHideBoxOrLayer(std::move(content), options, animated);
} }
void Controller::showRightColumn(object_ptr<TWidget> widget) { void Controller::showRightColumn(object_ptr<Ui::RpWidget> widget) {
_widget.showRightColumn(std::move(widget)); _widget.showRightColumn(std::move(widget));
} }

View File

@ -79,7 +79,7 @@ public:
void showToast(TextWithEntities &&text, crl::time duration = 0); void showToast(TextWithEntities &&text, crl::time duration = 0);
void showToast(const QString &text, crl::time duration = 0); void showToast(const QString &text, crl::time duration = 0);
void showRightColumn(object_ptr<TWidget> widget); void showRightColumn(object_ptr<Ui::RpWidget> widget);
void showBox( void showBox(
object_ptr<Ui::BoxContent> content, object_ptr<Ui::BoxContent> content,

@ -1 +1 @@
Subproject commit 7d1c15838960b77d49401104404d2e637f476c2c Subproject commit 7a21118ca0964dc66673df7a2241f846ec094860