• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
  • widgets
scrollwidget.h
Go to the documentation of this file.
1/*
2 * Copyright 2009 Marco Martin <notmart@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_SCROLLWIDGET_H
21#define PLASMA_SCROLLWIDGET_H
22
23#include <QtCore/QAbstractAnimation>
24#include <QtGui/QGraphicsWidget>
25
26#include <plasma/plasma_export.h>
27
28
29namespace Plasma
30{
31
32class ScrollWidgetPrivate;
33
43class PLASMA_EXPORT ScrollWidget : public QGraphicsWidget
44{
45 Q_OBJECT
46 Q_PROPERTY(QGraphicsWidget *widget READ widget WRITE setWidget)
47 Q_PROPERTY(Qt::ScrollBarPolicy horizontalScrollBarPolicy READ horizontalScrollBarPolicy WRITE setHorizontalScrollBarPolicy)
48 Q_PROPERTY(Qt::ScrollBarPolicy verticalScrollBarPolicy READ verticalScrollBarPolicy WRITE setVerticalScrollBarPolicy)
49 Q_PROPERTY(bool overflowBordersVisible READ overflowBordersVisible WRITE setOverflowBordersVisible)
50 Q_PROPERTY(QPointF scrollPosition READ scrollPosition WRITE setScrollPosition)
51 Q_PROPERTY(QSizeF contentsSize READ contentsSize)
52 Q_PROPERTY(QRectF viewportGeometry READ viewportGeometry)
53 Q_PROPERTY(QSizeF snapSize READ snapSize WRITE setSnapSize)
54 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
55 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
56 Q_PROPERTY(bool overShoot READ hasOverShoot WRITE setOverShoot)
57
58public:
59
65 explicit ScrollWidget(QGraphicsWidget *parent = 0);
66 explicit ScrollWidget(QGraphicsItem *parent);
67 ~ScrollWidget();
68
79 void setWidget(QGraphicsWidget *widget);
80
84 QGraphicsWidget *widget() const;
85
92 void setAlignment(Qt::Alignment align);
93
98 Qt::Alignment alignment() const;
99
106 void setOverShoot(bool enable);
107
112 bool hasOverShoot() const;
113
119 void setHorizontalScrollBarPolicy(const Qt::ScrollBarPolicy policy);
120
124 Qt::ScrollBarPolicy horizontalScrollBarPolicy() const;
125
131 void setVerticalScrollBarPolicy(const Qt::ScrollBarPolicy policy);
132
136 Qt::ScrollBarPolicy verticalScrollBarPolicy() const;
137
143 bool overflowBordersVisible() const;
144
152 void setOverflowBordersVisible(const bool visible);
153
160 Q_INVOKABLE void ensureRectVisible(const QRectF &rect);
161
168 Q_INVOKABLE void ensureItemVisible(QGraphicsItem *item);
169
184#ifndef KDE_NO_DEPRECATED
185 KDE_DEPRECATED Q_INVOKABLE void registerAsDragHandle(QGraphicsWidget *item);
186#endif
187
196#ifndef KDE_NO_DEPRECATED
197 KDE_DEPRECATED Q_INVOKABLE void unregisterAsDragHandle(QGraphicsWidget *item);
198#endif
199
204 QRectF viewportGeometry() const;
205
206
211 QSizeF contentsSize() const;
212
217 void setScrollPosition(const QPointF &position);
218
223 QPointF scrollPosition() const;
224
232 void setSnapSize(const QSizeF &size);
233
238 QSizeF snapSize() const;
239
245 void setStyleSheet(const QString &stylesheet);
246
250 QString styleSheet() const;
251
255 QWidget *nativeWidget() const;
256
257Q_SIGNALS:
262 void scrollStateChanged(QAbstractAnimation::State newState,
263 QAbstractAnimation::State oldState);
264
270 void viewportGeometryChanged(const QRectF &geomety);
271
272protected:
273
274 void resizeEvent(QGraphicsSceneResizeEvent *event);
275
276 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
277 void mousePressEvent(QGraphicsSceneMouseEvent *event);
278 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
279 void keyPressEvent(QKeyEvent *event);
280 void wheelEvent(QGraphicsSceneWheelEvent *event);
281 bool eventFilter(QObject *watched, QEvent *event);
282 void focusInEvent(QFocusEvent *event);
283 QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint) const;
284 bool sceneEventFilter(QGraphicsItem *i, QEvent *e);
285
286private:
287 ScrollWidgetPrivate * const d;
288
289 Q_PRIVATE_SLOT(d, void verticalScroll(int value))
290 Q_PRIVATE_SLOT(d, void horizontalScroll(int value))
291 Q_PRIVATE_SLOT(d, void makeRectVisible())
292 Q_PRIVATE_SLOT(d, void makeItemVisible())
293 Q_PRIVATE_SLOT(d, void adjustScrollbars())
294 Q_PRIVATE_SLOT(d, void fixupX())
295 Q_PRIVATE_SLOT(d, void fixupY())
296 Q_PRIVATE_SLOT(d, void setScrollX())
297 Q_PRIVATE_SLOT(d, void setScrollY())
298
299 friend class ScrollWidgetPrivate;
300};
301
302} // namespace Plasma
303
304#endif // multiple inclusion guard
Plasma::ScrollWidget
A container of widgets that can have scrollbars.
Definition: scrollwidget.h:44
Plasma::ScrollWidget::scrollStateChanged
void scrollStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
The widget started or stopped an animated scroll.
Plasma::ScrollWidget::viewportGeometryChanged
void viewportGeometryChanged(const QRectF &geomety)
The viewport geomety changed, for instance due a widget resize.
QGraphicsWidget
QObject
QWidget
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal