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) {
174 max =
QSize(m_hfw.width(),
qMax(m_hfw.height(),
h));
176 min =
QSize(p_hfw.width(),
qMax(p_hfw.height(),
h));
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);
249 d->updateScrollBars();
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)
457 ?
QRect(childWidget->
mapTo(
d->widget, microFocus.topLeft()), microFocus.size())
459 const QRect visibleRect(-
d->widget->pos(),
d->viewport->size());
461 if (visibleRect.contains(focusRect))
464 focusRect.adjust(-xmargin, -ymargin, xmargin, ymargin);
466 if (focusRect.width() > visibleRect.width())
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());
473 if (focusRect.height() > visibleRect.height())
474 d->vbar->setValue(focusRect.center().y() -
d->viewport->height() / 2);
475 else if (focusRect.bottom() > visibleRect.bottom())
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.
Type type() const
Returns the event type.
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.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
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 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.
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)