Removed Q_OBJECT from InnerDropdown.
This commit is contained in:
parent
093e3129ab
commit
897bea2baf
2 changed files with 14 additions and 21 deletions
|
|
@ -20,11 +20,9 @@ InnerDropdown::InnerDropdown(
|
|||
: RpWidget(parent)
|
||||
, _st(st)
|
||||
, _roundRect(ImageRoundRadius::Small, _st.bg)
|
||||
, _hideTimer([=] { hideAnimated(); })
|
||||
, _scroll(this, _st.scroll) {
|
||||
_hideTimer.setSingleShot(true);
|
||||
connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(onHideAnimated()));
|
||||
|
||||
connect(_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||
connect(_scroll, &ScrollArea::scrolled, [=] { scrolled(); });
|
||||
|
||||
hide();
|
||||
|
||||
|
|
@ -89,11 +87,11 @@ void InnerDropdown::resizeEvent(QResizeEvent *e) {
|
|||
_scroll->setGeometry(rect().marginsRemoved(_st.padding).marginsRemoved(_st.scrollMargin));
|
||||
if (auto widget = static_cast<TWidget*>(_scroll->widget())) {
|
||||
widget->resizeToWidth(_scroll->width());
|
||||
onScroll();
|
||||
scrolled();
|
||||
}
|
||||
}
|
||||
|
||||
void InnerDropdown::onScroll() {
|
||||
void InnerDropdown::scrolled() {
|
||||
if (auto widget = static_cast<TWidget*>(_scroll->widget())) {
|
||||
int visibleTop = _scroll->scrollTop();
|
||||
int visibleBottom = visibleTop + _scroll->height();
|
||||
|
|
@ -140,7 +138,7 @@ void InnerDropdown::leaveEventHook(QEvent *e) {
|
|||
if (_a_show.animating() || _a_opacity.animating()) {
|
||||
hideAnimated();
|
||||
} else {
|
||||
_hideTimer.start(300);
|
||||
_hideTimer.callOnce(300);
|
||||
}
|
||||
}
|
||||
return RpWidget::leaveEventHook(e);
|
||||
|
|
@ -157,7 +155,7 @@ void InnerDropdown::otherLeave() {
|
|||
if (_a_show.animating() || _a_opacity.animating()) {
|
||||
hideAnimated();
|
||||
} else {
|
||||
_hideTimer.start(0);
|
||||
_hideTimer.callOnce(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -172,7 +170,7 @@ void InnerDropdown::showAnimated(PanelAnimation::Origin origin) {
|
|||
}
|
||||
|
||||
void InnerDropdown::showAnimated() {
|
||||
_hideTimer.stop();
|
||||
_hideTimer.cancel();
|
||||
showStarted();
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +181,7 @@ void InnerDropdown::hideAnimated(HideOption option) {
|
|||
}
|
||||
if (_hiding) return;
|
||||
|
||||
_hideTimer.stop();
|
||||
_hideTimer.cancel();
|
||||
startOpacityAnimation(true);
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +201,7 @@ void InnerDropdown::finishAnimating() {
|
|||
}
|
||||
|
||||
void InnerDropdown::showFast() {
|
||||
_hideTimer.stop();
|
||||
_hideTimer.cancel();
|
||||
finishAnimating();
|
||||
if (isHidden()) {
|
||||
showChildren();
|
||||
|
|
@ -215,7 +213,7 @@ void InnerDropdown::showFast() {
|
|||
void InnerDropdown::hideFast() {
|
||||
if (isHidden()) return;
|
||||
|
||||
_hideTimer.stop();
|
||||
_hideTimer.cancel();
|
||||
finishAnimating();
|
||||
_hiding = false;
|
||||
hideFinished();
|
||||
|
|
|
|||
|
|
@ -12,15 +12,13 @@
|
|||
#include "ui/effects/animations.h"
|
||||
#include "ui/effects/panel_animation.h"
|
||||
#include "base/object_ptr.h"
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include "base/timer.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class ScrollArea;
|
||||
|
||||
class InnerDropdown : public RpWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InnerDropdown(QWidget *parent, const style::InnerDropdown &st = st::defaultInnerDropdown);
|
||||
|
|
@ -81,11 +79,6 @@ protected:
|
|||
|
||||
int resizeGetHeight(int newWidth) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onHideAnimated() {
|
||||
hideAnimated();
|
||||
}
|
||||
void onScroll();
|
||||
|
||||
private:
|
||||
QPointer<RpWidget> doSetOwnedWidget(object_ptr<RpWidget> widget);
|
||||
|
|
@ -103,6 +96,8 @@ private:
|
|||
|
||||
void updateHeight();
|
||||
|
||||
void scrolled();
|
||||
|
||||
const style::InnerDropdown &_st;
|
||||
|
||||
RoundRect _roundRect;
|
||||
|
|
@ -115,7 +110,7 @@ private:
|
|||
QPixmap _cache;
|
||||
Animations::Simple _a_opacity;
|
||||
|
||||
QTimer _hideTimer;
|
||||
base::Timer _hideTimer;
|
||||
bool _ignoreShowEvents = false;
|
||||
Fn<void()> _showStartCallback;
|
||||
Fn<void()> _hideStartCallback;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue