5#include "private/qscrollarea_p.h"
13#include "private/qapplication_p.h"
14#include "private/qlayoutengine_p.h"
108 d->vbar->setSingleStep(20);
109 d->hbar->setSingleStep(20);
117 : QAbstractScrollArea(dd,
parent)
121 d->vbar->setSingleStep(20);
122 d->hbar->setSingleStep(20);
151 QSize m =
q->maximumViewportSize();
164 int vbarWidth = vbar->sizeHint().width();
168 while (
h >
m.height() && vbarWidth) {
180 if ((
resizable &&
m.expandedTo(min) ==
m &&
m.boundedTo(max) ==
m)
188 hbar->setRange(0,
v.width() -
p.width());
189 hbar->setPageStep(
p.width());
190 vbar->setRange(0,
v.height() -
p.height());
191 vbar->setPageStep(
p.height());
239 d->hbar->setValue(0);
240 d->vbar->setValue(0);
246 d->widget->setAutoFillBackground(
true);
249 d->updateScrollBars();
266 w->setParent(
nullptr);
277 d->updateScrollBars();
279#ifdef QT_KEYPAD_NAVIGATION
280 else if (QApplicationPrivate::keypadNavigationEnabled()) {
287 return QAbstractScrollArea::event(
e);
297#ifdef QT_KEYPAD_NAVIGATION
299 && QApplicationPrivate::keypadNavigationEnabled()) {
300 if (
o->isWidgetType())
305 d->updateScrollBars();
307 return QAbstractScrollArea::eventFilter(
o,
e);
316 d->updateScrollBars();
328 d->updateWidgetPosition();
355 d->resizable = resizable;
357 d->updateScrollBars();
366 int f = 2 *
d->frameWidth;
370 if (!
d->widgetSize.isValid())
371 d->widgetSize =
d->resizable ?
d->widget->sizeHint() :
d->widget->size();
390 return d->resizable ?
d->widget->sizeHint() :
d->widget->size();
403 if (
QWidget *fw = focusWidget())
422 if (logicalX - xmargin < d->hbar->value()) {
423 d->hbar->setValue(
qMax(0, logicalX - xmargin));
424 }
else if (logicalX >
d->hbar->value() +
d->viewport->width() - xmargin) {
425 d->hbar->setValue(
qMin(logicalX -
d->viewport->width() + xmargin,
d->hbar->maximum()));
428 if (
y - ymargin < d->vbar->value()) {
429 d->vbar->setValue(
qMax(0,
y - ymargin));
430 }
else if (
y >
d->vbar->value() +
d->viewport->height() - ymargin) {
431 d->vbar->setValue(
qMin(
y -
d->viewport->height() + ymargin,
d->vbar->maximum()));
450 if (!
d->widget->isAncestorOf(childWidget))
454 const QRect defaultMicroFocus =
456 QRect focusRect = (microFocus != defaultMicroFocus)
459 const QRect visibleRect(-
d->widget->pos(),
d->viewport->size());
461 if (visibleRect.
contains(focusRect))
464 focusRect.
adjust(-xmargin, -ymargin, xmargin, ymargin);
467 d->hbar->setValue(focusRect.
center().
x() -
d->viewport->width() / 2);
468 else if (focusRect.
right() > visibleRect.
right())
469 d->hbar->setValue(focusRect.
right() -
d->viewport->width() + 1);
470 else if (focusRect.
left() < visibleRect.
left())
471 d->hbar->setValue(focusRect.
left());
474 d->vbar->setValue(focusRect.
center().
y() -
d->viewport->height() / 2);
476 d->vbar->setValue(focusRect.
bottom() -
d->viewport->height() + 1);
477 else if (focusRect.
top() < visibleRect.
top())
478 d->vbar->setValue(focusRect.
top());
505 d->updateWidgetPosition();
516#include "moc_qscrollarea.cpp"
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false.
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QResizeEvent class contains event parameters for resize events.
constexpr bool hasHeightForWidth() const noexcept
Returns true if the widget's preferred height depends on its width; otherwise returns false.
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
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...
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.
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.
QRect toRect() const
Returns the variant as a QRect if the variant has userType() \l QMetaType::QRect; otherwise returns a...
Combined button and popup list for selecting options.
Q_WIDGETS_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
Q_WIDGETS_EXPORT QSize qSmartMaxSize(const QSize &sizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy, Qt::Alignment align)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
Int aligned(Int v, Int byteAlign)
view viewport() -> scroll(dx, dy, deviceRect)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent