ScrollView extends the QAbstractScrollArea by features like automatic scaling of scrollbars, signals when the visible are was moved and so on.
More...
#include <widgets/ScrollView.h>
ScrollView extends the QAbstractScrollArea by features like automatic scaling of scrollbars, signals when the visible are was moved and so on.
It therefore defines a content area (rect) within a scroll viewport and provides several functions to modify this area. For example it allows synchronization of multiple scroll views showing the same data (in a different way) by connecting the contentsMoving signal of one view to a slot that calls setContentsPos with the respective coordinates in another view.
◆ ScrollView()
◆ contentsX()
The x coordinate of the content area.
◆ contentsY()
The y coordinate of the content area.
◆ contentsHeight()
int contentsHeight |
( |
| ) |
const |
|
inline |
The height of the content area.
◆ contentsWidth()
int contentsWidth |
( |
| ) |
const |
|
inline |
The width of the content area.
◆ setContentsPos()
void setContentsPos |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Set the position of the content area.
◆ resizeContents()
void resizeContents |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
◆ ensureVisible()
void ensureVisible |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
marginX = 50 , |
|
|
int |
marginY = 50 |
|
) |
| |
Ensures that the position given by x and y with the specified margins is within the content area by scrolling to the respective position.
It is not guaranteed that the margins will be strictly adhered. E.g. if x < marginX or y + marginY > viewport.heigth().
◆ viewportToContents()
QPoint viewportToContents |
( |
const QPoint & |
pos | ) |
const |
Converts viewport coordinates to content area coordinates.
◆ contentsToViewport()
QPoint contentsToViewport |
( |
const QPoint & |
pos | ) |
const |
Converts content area coordinates to viewport coordinates.
◆ contentsMoving
void contentsMoving |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
signal |
Signal emitted when the position of the content area changed.
◆ updateScrollBars()
void updateScrollBars |
( |
| ) |
|
|
protected |
◆ scrollContentsBy()
virtual void scrollContentsBy |
( |
int |
dX, |
|
|
int |
dY |
|
) |
| |
|
protectedvirtual |
◆ resizeEvent()
virtual void resizeEvent |
( |
QResizeEvent * |
resizeEvent | ) |
|
|
protectedvirtual |
◆ paintEvent()
virtual void paintEvent |
( |
QPaintEvent * |
paintEvent | ) |
|
|
protectedvirtual |
◆ wheelEvent()
virtual void wheelEvent |
( |
QWheelEvent * |
wheelEvent | ) |
|
|
protectedvirtual |
◆ drawContents()
virtual void drawContents |
( |
QPainter * |
painter, |
|
|
const QRect & |
rect |
|
) |
| |
|
protectedpure virtual |
Overload this method in derived classes to draw the content of the content area.
◆ updateContents() [1/2]
virtual void updateContents |
( |
const QRect & |
rect | ) |
|
|
protectedvirtual |
Call this method to schedule an update of the content area for the given rect.
Can be overwritten in derived class to do additional update work.
◆ updateContents() [2/2]
virtual void updateContents |
( |
| ) |
|
|
protectedvirtual |
Call this method to schedule an update of the content area.
Can be overwritten in derived class to do additional update work.
◆ mContentsRect
The documentation for this class was generated from the following file: