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(
not_null<Window::SessionController*> controller,
QWidget *parent)
: TWidget(parent)
: RpWidget(parent)
, _controller(controller)
, _st(&st::botKbButton) {
setGeometry(0, 0, _st->margin, st::botKbScroll.deltat);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5187,7 +5187,7 @@ void HistoryWidget::updateOverStates(QPoint pos) {
}
void HistoryWidget::leaveToChildEvent(QEvent *e, QWidget *child) {
// e -- from enterEvent() of child TWidget
// e -- from enterEvent() of child RpWidget
if (hasMouseTracking()) {
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) {

View File

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

View File

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

View File

@ -80,7 +80,7 @@ Widget::Widget(
// 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.
// 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->setAttribute(Qt::WA_TransparentForMouseEvents);
forceRepaintOnScroll->show();

View File

@ -99,7 +99,7 @@ void Panel::updateControlsGeometry() {
if (scrollHeight > 0) {
_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);
}
}

View File

@ -109,15 +109,6 @@ public:
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 close();
void minimize();

View File

@ -12,7 +12,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
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)
, _subtitle(subtitle)
, _titleWidth(st::profileDropAreaTitleFont->width(_title))

View File

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

View File

@ -296,7 +296,7 @@ void FilterIconPanel::leaveEventHook(QEvent *e) {
} else {
_hideTimer.callOnce(kHideTimeoutMs);
}
return TWidget::leaveEventHook(e);
return RpWidget::leaveEventHook(e);
}
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_media_view.h"
class ColorEditor::Picker : public TWidget {
class ColorEditor::Picker : public Ui::RpWidget {
public:
Picker(QWidget *parent, Mode mode, QColor color);
@ -94,7 +94,7 @@ QCursor ColorEditor::Picker::generateCursor() {
}
ColorEditor::Picker::Picker(QWidget *parent, Mode mode, QColor color)
: TWidget(parent)
: RpWidget(parent)
, _mode(mode) {
setCursor(generateCursor());
@ -292,7 +292,7 @@ void ColorEditor::Picker::setFromColor(QColor color) {
}
}
class ColorEditor::Slider : public TWidget {
class ColorEditor::Slider : public Ui::RpWidget {
public:
enum class Direction {
Horizontal,
@ -365,7 +365,7 @@ ColorEditor::Slider::Slider(
Direction direction,
Type type,
QColor color)
: TWidget(parent)
: RpWidget(parent)
, _direction(direction)
, _type(type)
, _color(color.red(), color.green(), color.blue())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -431,7 +431,7 @@ void Controller::showBox(
_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));
}

View File

@ -79,7 +79,7 @@ public:
void showToast(TextWithEntities &&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(
object_ptr<Ui::BoxContent> content,

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