43 #include "private/qscrollarea_p.h" 45 #ifndef QT_NO_SCROLLAREA 53 #include "private/qlayoutengine_p.h" 150 d->vbar->setSingleStep(20);
151 d->hbar->setSingleStep(20);
163 d->vbar->setSingleStep(20);
164 d->hbar->setSingleStep(20);
193 QSize m = q->maximumViewportSize();
215 hbar->setPageStep(p.
width());
217 vbar->setPageStep(p.
height());
218 updateWidgetPosition();
260 if (widget ==
d->widget || !widget)
265 d->hbar->setValue(0);
266 d->vbar->setValue(0);
272 d->widget->setAutoFillBackground(
true);
275 d->updateScrollBars();
303 d->updateScrollBars();
305 #ifdef QT_KEYPAD_NAVIGATION 306 else if (QApplication::keypadNavigationEnabled()) {
323 #ifdef QT_KEYPAD_NAVIGATION 325 && QApplication::keypadNavigationEnabled()) {
331 d->updateScrollBars();
342 d->updateScrollBars();
354 d->updateWidgetPosition();
384 d->resizable = resizable;
386 d->updateScrollBars();
395 int f = 2 *
d->frameWidth;
399 if (!
d->widgetSize.isValid())
400 d->widgetSize =
d->resizable ?
d->widget->sizeHint() :
d->widget->size();
403 sz +=
QSize(12 * h, 8 * h);
439 if (logicalX - xmargin < d->hbar->value()) {
440 d->hbar->setValue(
qMax(0, logicalX - xmargin));
441 }
else if (logicalX >
d->hbar->value() +
d->viewport->width() - xmargin) {
442 d->hbar->setValue(
qMin(logicalX -
d->viewport->width() + xmargin,
d->hbar->maximum()));
445 if (y - ymargin < d->vbar->value()) {
446 d->vbar->setValue(
qMax(0, y - ymargin));
447 }
else if (y >
d->vbar->value() +
d->viewport->height() - ymargin) {
448 d->vbar->setValue(
qMin(y -
d->viewport->height() + ymargin,
d->vbar->maximum()));
470 if (!
d->widget->isAncestorOf(childWidget))
474 const QRect defaultMicroFocus =
476 QRect focusRect = (microFocus != defaultMicroFocus)
479 const QRect visibleRect(-
d->widget->pos(),
d->viewport->size());
481 if (visibleRect.contains(focusRect))
484 focusRect.
adjust(-xmargin, -ymargin, xmargin, ymargin);
486 if (focusRect.
width() > visibleRect.width())
487 d->hbar->setValue(focusRect.
center().
x() -
d->viewport->width() / 2);
488 else if (focusRect.
right() > visibleRect.right())
489 d->hbar->setValue(focusRect.
right() -
d->viewport->width());
490 else if (focusRect.
left() < visibleRect.left())
491 d->hbar->setValue(focusRect.
left());
493 if (focusRect.
height() > visibleRect.height())
494 d->vbar->setValue(focusRect.
center().
y() -
d->viewport->height() / 2);
495 else if (focusRect.
bottom() > visibleRect.bottom())
496 d->vbar->setValue(focusRect.
bottom() -
d->viewport->height());
497 else if (focusRect.
top() < visibleRect.top())
498 d->vbar->setValue(focusRect.
top());
519 d->updateWidgetPosition();
530 #endif // QT_NO_SCROLLAREA
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos)
Returns the given logicalPosition converted to screen coordinates based on the specified direction...
Q_GUI_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy, Qt::Alignment align)
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
void setHeight(int h)
Sets the height to the given height.
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false...
The QObject class is the base class of all Qt objects.
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setWidth(int w)
Sets the width to the given width.
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool hasHeightForWidth() const
QSize size() const
Returns the size of the rectangle.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
The QResizeEvent class contains event parameters for resize events.
QPoint center() const
Returns the center point of the rectangle.
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
int top() const
Returns the y-coordinate of the rectangle's top edge.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
int right() const
Returns the x-coordinate of the rectangle's right edge.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
int y() const
Returns the y-coordinate of the rectangle's top edge.
QRect toRect() const
Returns the variant as a QRect if the variant has type() Rect ; otherwise returns an invalid QRect...
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
The QPoint class defines a point in the plane using integer precision.
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
int y() const
Returns the y coordinate of this point.
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
int height() const
Returns the height of the font.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.