QmlMaterial 0.1.0
Loading...
Searching...
No Matches
popup_surface.hpp
1#pragma once
2
3#include "qml_material/control/popup.hpp"
4#include <QWheelEvent>
5
6namespace qml_material
7{
8template<typename Base>
9class PopupSurface final : public Base {
10public:
11 explicit PopupSurface(Popup* popup): m_popup(popup) {}
12
13 bool contains(const QPointF& point) const override {
14 // The layout surface can be larger than the interactive popup (e.g. a bottom sheet).
15 if (m_popup->popupItem() == this) return Base::contains(point);
16 return m_popup->containsScenePoint(this->mapToScene(point));
17 }
18
19protected:
20 void wheelEvent(QWheelEvent* event) override { event->accept(); }
21
22private:
23 Popup* m_popup;
24};
25} // namespace qml_material