qscroller.sip 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // qscroller.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtWidgets Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QScroller : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qscroller.h>
  25. %End
  26. public:
  27. enum State
  28. {
  29. Inactive,
  30. Pressed,
  31. Dragging,
  32. Scrolling,
  33. };
  34. enum ScrollerGestureType
  35. {
  36. TouchGesture,
  37. LeftMouseButtonGesture,
  38. RightMouseButtonGesture,
  39. MiddleMouseButtonGesture,
  40. };
  41. enum Input
  42. {
  43. InputPress,
  44. InputMove,
  45. InputRelease,
  46. };
  47. static bool hasScroller(QObject *target);
  48. static QScroller *scroller(QObject *target);
  49. static Qt::GestureType grabGesture(QObject *target, QScroller::ScrollerGestureType scrollGestureType = QScroller::TouchGesture);
  50. static Qt::GestureType grabbedGesture(QObject *target);
  51. static void ungrabGesture(QObject *target);
  52. static QList<QScroller *> activeScrollers();
  53. QObject *target() const;
  54. QScroller::State state() const;
  55. bool handleInput(QScroller::Input input, const QPointF &position, qint64 timestamp = 0);
  56. void stop();
  57. QPointF velocity() const;
  58. QPointF finalPosition() const;
  59. QPointF pixelPerMeter() const;
  60. QScrollerProperties scrollerProperties() const;
  61. void setSnapPositionsX(const QList<qreal> &positions);
  62. void setSnapPositionsX(qreal first, qreal interval);
  63. void setSnapPositionsY(const QList<qreal> &positions);
  64. void setSnapPositionsY(qreal first, qreal interval);
  65. public slots:
  66. void setScrollerProperties(const QScrollerProperties &prop);
  67. void scrollTo(const QPointF &pos);
  68. void scrollTo(const QPointF &pos, int scrollTime);
  69. void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin);
  70. void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin, int scrollTime);
  71. void resendPrepareEvent();
  72. signals:
  73. void stateChanged(QScroller::State newstate);
  74. void scrollerPropertiesChanged(const QScrollerProperties &);
  75. private:
  76. QScroller(QObject *target);
  77. virtual ~QScroller();
  78. };