Qt 4.8
Public Functions | Public Variables | List of all members
QAbstractScrollAreaPrivate Class Reference

#include <qabstractscrollarea_p.h>

Inheritance diagram for QAbstractScrollAreaPrivate:
QFramePrivate QWidgetPrivate QObjectPrivate QObjectData QAbstractItemViewPrivate QGraphicsViewPrivate QMdiAreaPrivate QPlainTextEditPrivate QScrollAreaPrivate QTextEditPrivate QColumnViewPrivate QHeaderViewPrivate QListViewPrivate QTableViewPrivate QTreeViewPrivate QDeclarativeViewPrivate QTextBrowserPrivate QListWidgetPrivate QUndoViewPrivate QTableWidgetPrivate QTreeWidgetPrivate

Public Functions

void _q_hslide (int)
 
void _q_showOrHideScrollBars ()
 
void _q_vslide (int)
 
virtual QPoint contentsOffset () const
 
void init ()
 
void layoutChildren ()
 
 QAbstractScrollAreaPrivate ()
 
void replaceScrollBar (QScrollBar *scrollBar, Qt::Orientation orientation)
 
virtual void scrollBarPolicyChanged (Qt::Orientation, Qt::ScrollBarPolicy)
 
void setSingleFingerPanEnabled (bool on=true)
 
bool viewportEvent (QEvent *event)
 
- Public Functions inherited from QFramePrivate
void init ()
 
 QFramePrivate ()
 
void updateFrameWidth ()
 Updated the frameWidth parameter. More...
 
void updateStyledFrameWidths ()
 Updates the frame widths from the style. More...
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

int bottom
 
QRect cornerPaintingRect
 
QWidgetcornerWidget
 
QScrollBarhbar
 
Qt::ScrollBarPolicy hbarpolicy
 
int left
 
QRect reverseCornerPaintingRect
 
int right
 
QAbstractScrollAreaScrollBarContainerscrollBarContainers [Qt::Vertical+1]
 
bool singleFingerPanEnabled
 
int top
 
QScrollBarvbar
 
Qt::ScrollBarPolicy vbarpolicy
 
QWidgetviewport
 
QScopedPointer< QObjectviewportFilter
 
int xoffset
 
int yoffset
 
- Public Variables inherited from QFramePrivate
short bottomFrameWidth
 
int frameStyle
 
short frameWidth
 
QRect frect
 
short leftFrameWidth
 
short lineWidth
 
short midLineWidth
 
short rightFrameWidth
 
short topFrameWidth
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Detailed Description

Definition at line 65 of file qabstractscrollarea_p.h.

Constructors and Destructors

◆ QAbstractScrollAreaPrivate()

QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate ( )

Definition at line 161 of file qabstractscrollarea.cpp.

163  viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0),
164  xoffset(0), yoffset(0), viewportFilter(0)
165 #ifdef Q_WS_WIN
166  , singleFingerPanEnabled(false)
167 #endif
168 {
169 }
QScopedPointer< QObject > viewportFilter

Functions

◆ _q_hslide()

void QAbstractScrollAreaPrivate::_q_hslide ( int  x)

Definition at line 1350 of file qabstractscrollarea.cpp.

1351 {
1353  int dx = xoffset - x;
1354  xoffset = x;
1355  q->scrollContentsBy(dx, 0);
1356 }
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ _q_showOrHideScrollBars()

void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars ( )

Definition at line 1366 of file qabstractscrollarea.cpp.

Referenced by QTextEditPrivate::_q_adjustScrollbars().

1367 {
1368  layoutChildren();
1369 #ifdef Q_WS_WIN
1370  // Need to re-subscribe to gestures as the content changes to make sure we
1371  // enable/disable panning when needed.
1373  if (dd)
1374  dd->winSetupGestures();
1375 #endif // Q_WS_WIN
1376 }
static QObjectPrivate * get(QObject *o)
Definition: qobject_p.h:177

◆ _q_vslide()

void QAbstractScrollAreaPrivate::_q_vslide ( int  y)

Definition at line 1358 of file qabstractscrollarea.cpp.

1359 {
1361  int dy = yoffset - y;
1362  yoffset = y;
1363  q->scrollContentsBy(0, dy);
1364 }
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
#define Q_Q(Class)
Definition: qglobal.h:2483

◆ contentsOffset()

QPoint QAbstractScrollAreaPrivate::contentsOffset ( ) const
virtual

Reimplemented in QAbstractItemViewPrivate.

Definition at line 1378 of file qabstractscrollarea.cpp.

Referenced by QStyleSheetStyle::drawPrimitive(), and QWidgetPrivate::paintBackground().

1379 {
1380  Q_Q(const QAbstractScrollArea);
1381  QPoint offset;
1382  if (vbar->isVisible())
1383  offset.setY(vbar->value());
1384  if (hbar->isVisible()) {
1385  if (q->isRightToLeft())
1386  offset.setX(hbar->maximum() - hbar->value());
1387  else
1388  offset.setX(hbar->value());
1389  }
1390  return offset;
1391 }
bool isVisible() const
Definition: qwidget.h:1005
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
#define Q_Q(Class)
Definition: qglobal.h:2483
int value() const
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qpoint.h:137
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int maximum() const
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qpoint.h:134

◆ init()

void QAbstractScrollAreaPrivate::init ( )

Definition at line 280 of file qabstractscrollarea.cpp.

281 {
283  viewport = new QWidget(q);
284  viewport->setObjectName(QLatin1String("qt_scrollarea_viewport"));
288  scrollBarContainers[Qt::Horizontal]->setObjectName(QLatin1String("qt_scrollarea_hcontainer"));
290  hbar->setRange(0,0);
292  QObject::connect(hbar, SIGNAL(valueChanged(int)), q, SLOT(_q_hslide(int)));
295  scrollBarContainers[Qt::Vertical]->setObjectName(QLatin1String("qt_scrollarea_vcontainer"));
297  vbar->setRange(0,0);
299  QObject::connect(vbar, SIGNAL(valueChanged(int)), q, SLOT(_q_vslide(int)));
304  q->setFocusPolicy(Qt::WheelFocus);
305  q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
307  layoutChildren();
308 #ifndef Q_WS_MAC
309 #ifndef QT_NO_GESTURES
311 #endif
312 #endif
313 }
T * data() const
Returns the value of the pointer referenced by this object.
QScopedPointer< QObject > viewportFilter
#define SLOT(a)
Definition: qobjectdefs.h:226
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
void setRange(int min, int max)
Sets the slider&#39;s minimum to min and its maximum to max.
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags())
Subscribes the widget to a given gesture with specific flags.
Definition: qwidget.cpp:12964
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void setBackgroundRole(QPalette::ColorRole)
Sets the background role of the widget to role.
Definition: qwidget.cpp:4708
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
void setAutoFillBackground(bool enabled)
Definition: qwidget.cpp:631
void setFocusProxy(QWidget *)
Sets the widget&#39;s focus proxy to widget w.
Definition: qwidget.cpp:6537
QAbstractScrollAreaScrollBarContainer * scrollBarContainers[Qt::Vertical+1]
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070

◆ layoutChildren()

void QAbstractScrollAreaPrivate::layoutChildren ( )

Definition at line 325 of file qabstractscrollarea.cpp.

Referenced by QListViewPrivate::doItemsLayout().

326 {
328  bool needh = (hbarpolicy == Qt::ScrollBarAlwaysOn
330 
331  bool needv = (vbarpolicy == Qt::ScrollBarAlwaysOn
333 
334 #ifdef Q_WS_MAC
335  QWidget * const window = q->window();
336 
337  // Use small scroll bars for tool windows, to match the native size grip.
338  bool hbarIsSmall = hbar->testAttribute(Qt::WA_MacSmallSize);
339  bool vbarIsSmall = vbar->testAttribute(Qt::WA_MacSmallSize);
340  const Qt::WindowType windowType = window->windowType();
341  if (windowType == Qt::Tool) {
342  if (!hbarIsSmall) {
346  }
347  if (!vbarIsSmall) {
351  }
352  } else {
353  if (hbarIsSmall) {
357  }
358  if (vbarIsSmall) {
362  }
363  }
364 #endif
365 
366  const int hsbExt = hbar->sizeHint().height();
367  const int vsbExt = vbar->sizeHint().width();
368  const QPoint extPoint(vsbExt, hsbExt);
369  const QSize extSize(vsbExt, hsbExt);
370 
371  const QRect widgetRect = q->rect();
372  QStyleOption opt(0);
373  opt.init(q);
374 
375  const bool hasCornerWidget = (cornerWidget != 0);
376 
377 // If the scroll bars are at the very right and bottom of the window we
378 // move their positions to be aligned with the size grip.
379 #ifdef Q_WS_MAC
380  // Check if a native sizegrip is present.
381  bool hasMacReverseSizeGrip = false;
382  bool hasMacSizeGrip = false;
383  bool nativeGripPresent = false;
384  if (q->testAttribute(Qt::WA_WState_Created))
385  nativeGripPresent = qt_mac_checkForNativeSizeGrip(q);
386 
387  if (nativeGripPresent) {
388  // Look for a native size grip at the visual window bottom right and at the
389  // absolute window bottom right. In reverse mode, the native size grip does not
390  // swich side, so we need to check if it is on the "wrong side".
391  const QPoint scrollAreaBottomRight = q->mapTo(window, widgetRect.bottomRight() - QPoint(frameWidth, frameWidth));
392  const QPoint windowBottomRight = window->rect().bottomRight();
393  const QPoint visualWindowBottomRight = QStyle::visualPos(opt.direction, opt.rect, windowBottomRight);
394  const QPoint offset = windowBottomRight - scrollAreaBottomRight;
395  const QPoint visualOffset = visualWindowBottomRight - scrollAreaBottomRight;
396  hasMacSizeGrip = (visualOffset.manhattanLength() < vsbExt);
397  hasMacReverseSizeGrip = (hasMacSizeGrip == false && (offset.manhattanLength() < hsbExt));
398  }
399 #endif
400 
401  QPoint cornerOffset(needv ? vsbExt : 0, needh ? hsbExt : 0);
402  QRect controlsRect;
403  QRect viewportRect;
404 
405  // In FrameOnlyAroundContents mode the frame is drawn between the controls and
406  // the viewport, else the frame rect is equal to the widget rect.
407  if ((frameStyle != QFrame::NoFrame) &&
408  q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)) {
409  controlsRect = widgetRect;
411  const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0);
412  QRect frameRect = widgetRect;
413  frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y());
414  q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, frameRect));
415  // The frame rect needs to be in logical coords, however we need to flip
416  // the contentsRect back before passing it on to the viewportRect
417  // since the viewportRect has its logical coords calculated later.
418  viewportRect = QStyle::visualRect(opt.direction, opt.rect, q->contentsRect());
419  } else {
420  q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, widgetRect));
421  controlsRect = q->contentsRect();
422  viewportRect = QRect(controlsRect.topLeft(), controlsRect.bottomRight() - cornerOffset);
423  }
424 
425  // If we have a corner widget and are only showing one scroll bar, we need to move it
426  // to make room for the corner widget.
427  if (hasCornerWidget && (needv || needh))
428  cornerOffset = extPoint;
429 
430 #ifdef Q_WS_MAC
431  // Also move the scroll bars if they are covered by the native Mac size grip.
432  if (hasMacSizeGrip)
433  cornerOffset = extPoint;
434 #endif
435 
436  // The corner point is where the scroll bar rects, the corner widget rect and the
437  // viewport rect meets.
438  const QPoint cornerPoint(controlsRect.bottomRight() + QPoint(1, 1) - cornerOffset);
439 
440  // Some styles paints the corner if both scorllbars are showing and there is
441  // no corner widget. Also, on the Mac we paint if there is a native
442  // (transparent) sizegrip in the area where a corner widget would be.
443  if ((needv && needh && hasCornerWidget == false)
444  || ((needv || needh)
445 #ifdef Q_WS_MAC
446  && hasMacSizeGrip
447 #endif
448  )
449  ) {
450  cornerPaintingRect = QStyle::visualRect(opt.direction, opt.rect, QRect(cornerPoint, extSize));
451  } else {
453  }
454 
455 #ifdef Q_WS_MAC
456  if (hasMacReverseSizeGrip)
457  reverseCornerPaintingRect = QRect(controlsRect.bottomRight() + QPoint(1, 1) - extPoint, extSize);
458  else
460 #endif
461 
462  if (needh) {
463  QRect horizontalScrollBarRect(QPoint(controlsRect.left(), cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom()));
464 #ifdef Q_WS_MAC
465  if (hasMacReverseSizeGrip)
466  horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0);
467 #endif
468  scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect));
470  }
471 
472  if (needv) {
473  const QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top()), QPoint(controlsRect.right(), cornerPoint.y() - 1));
474  scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect));
476  }
477 
478  if (cornerWidget) {
479  const QRect cornerWidgetRect(cornerPoint, controlsRect.bottomRight());
480  cornerWidget->setGeometry(QStyle::visualRect(opt.direction, opt.rect, cornerWidgetRect));
481  }
482 
485 
486  if (q->isRightToLeft())
487  viewportRect.adjust(right, top, -left, -bottom);
488  else
489  viewportRect.adjust(left, top, -right, -bottom);
490 
491  viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); // resize the viewport last
492 }
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...
Definition: qstyle.cpp:2109
int minimum() const
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
WindowType
Definition: qnamespace.h:270
QPointer< QStyle > style
Definition: qwidget_p.h:256
#define Q_Q(Class)
Definition: qglobal.h:2483
NSWindow * window
int width() const
Returns the width.
Definition: qsize.h:126
short frameWidth
Definition: qframe_p.h:74
QPoint bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:291
The QStyleOption class stores the parameters used by QStyle functions.
Definition: qstyleoption.h:67
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
int manhattanLength() const
Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" ...
Definition: qpoint.cpp:489
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:434
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
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...
Definition: qstyle.cpp:2087
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
QSize sizeHint() const
Reimplemented Function
Definition: qscrollbar.cpp:490
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
QAbstractScrollAreaScrollBarContainer * scrollBarContainers[Qt::Vertical+1]
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWExtra * extra
Definition: qwidget_p.h:700
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
int frameStyle
Definition: qframe_p.h:71
int maximum() const
bool qt_mac_checkForNativeSizeGrip(const QWidget *widget)
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ replaceScrollBar()

void QAbstractScrollAreaPrivate::replaceScrollBar ( QScrollBar scrollBar,
Qt::Orientation  orientation 
)
Warning
This function is not part of the public interface.

Definition at line 245 of file qabstractscrollarea.cpp.

247 {
249 
251  bool horizontal = (orientation == Qt::Horizontal);
252  QScrollBar *oldBar = horizontal ? hbar : vbar;
253  if (horizontal)
254  hbar = scrollBar;
255  else
256  vbar = scrollBar;
257  scrollBar->setParent(container);
258  container->scrollBar = scrollBar;
259  container->layout->removeWidget(oldBar);
260  container->layout->insertWidget(0, scrollBar);
261  scrollBar->setVisible(oldBar->isVisibleTo(container));
262  scrollBar->setInvertedAppearance(oldBar->invertedAppearance());
263  scrollBar->setInvertedControls(oldBar->invertedControls());
264  scrollBar->setRange(oldBar->minimum(), oldBar->maximum());
265  scrollBar->setOrientation(oldBar->orientation());
266  scrollBar->setPageStep(oldBar->pageStep());
267  scrollBar->setSingleStep(oldBar->singleStep());
268  scrollBar->setSliderDown(oldBar->isSliderDown());
269  scrollBar->setSliderPosition(oldBar->sliderPosition());
270  scrollBar->setTracking(oldBar->hasTracking());
271  scrollBar->setValue(oldBar->value());
272  delete oldBar;
273 
274  QObject::connect(scrollBar, SIGNAL(valueChanged(int)),
275  q, horizontal ? SLOT(_q_hslide(int)) : SLOT(_q_vslide(int)));
276  QObject::connect(scrollBar, SIGNAL(rangeChanged(int,int)),
278 }
bool hasTracking() const
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
int minimum() const
int sliderPosition() const
bool isVisibleTo(QWidget *) const
Returns true if this widget would become visible if ancestor is shown; otherwise returns false...
Definition: qwidget.cpp:8371
#define SLOT(a)
Definition: qobjectdefs.h:226
The QAbstractScrollArea widget provides a scrolling area with on-demand scroll bars.
void setInvertedAppearance(bool)
void setRange(int min, int max)
Sets the slider&#39;s minimum to min and its maximum to max.
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
bool isSliderDown() const
void setInvertedControls(bool)
The QScrollBar widget provides a vertical or horizontal scroll bar.
Definition: qscrollbar.h:59
int value() const
void insertWidget(int index, QWidget *widget, int stretch=0, Qt::Alignment alignment=0)
Inserts widget at position index, with stretch factor stretch and alignment alignment.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
Qt::Orientation orientation() const
bool invertedControls() const
bool invertedAppearance() const
void setSliderDown(bool)
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
QAbstractScrollAreaScrollBarContainer * scrollBarContainers[Qt::Vertical+1]
void setSliderPosition(int)
int singleStep() const
void setOrientation(Qt::Orientation)
void setTracking(bool enable)
int maximum() const
int pageStep() const
void removeWidget(QWidget *w)
Removes the widget widget from the layout.
Definition: qlayout.cpp:1516

◆ scrollBarPolicyChanged()

virtual void QAbstractScrollAreaPrivate::scrollBarPolicyChanged ( Qt::Orientation  ,
Qt::ScrollBarPolicy   
)
inlinevirtual

Reimplemented in QMdiAreaPrivate.

Definition at line 91 of file qabstractscrollarea_p.h.

91 {}

◆ setSingleFingerPanEnabled()

void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled ( bool  on = true)

Definition at line 316 of file qabstractscrollarea.cpp.

Referenced by QTextEditPrivate::init(), and QPlainTextEditPrivate::init().

317 {
320  if (dd)
321  dd->winSetupGestures();
322 }
static QObjectPrivate * get(QObject *o)
Definition: qobject_p.h:177

◆ viewportEvent()

bool QAbstractScrollAreaPrivate::viewportEvent ( QEvent event)
inline

Definition at line 99 of file qabstractscrollarea_p.h.

100  { return q_func()->viewportEvent(event); }

Properties

◆ bottom

int QAbstractScrollAreaPrivate::bottom

◆ cornerPaintingRect

QRect QAbstractScrollAreaPrivate::cornerPaintingRect

Definition at line 80 of file qabstractscrollarea_p.h.

◆ cornerWidget

QWidget* QAbstractScrollAreaPrivate::cornerWidget

Definition at line 79 of file qabstractscrollarea_p.h.

◆ hbar

QScrollBar* QAbstractScrollAreaPrivate::hbar

◆ hbarpolicy

Qt::ScrollBarPolicy QAbstractScrollAreaPrivate::hbarpolicy

◆ left

int QAbstractScrollAreaPrivate::left

◆ reverseCornerPaintingRect

QRect QAbstractScrollAreaPrivate::reverseCornerPaintingRect

Definition at line 82 of file qabstractscrollarea_p.h.

◆ right

int QAbstractScrollAreaPrivate::right

◆ scrollBarContainers

QAbstractScrollAreaScrollBarContainer* QAbstractScrollAreaPrivate::scrollBarContainers[Qt::Vertical+1]

Definition at line 74 of file qabstractscrollarea_p.h.

◆ singleFingerPanEnabled

bool QAbstractScrollAreaPrivate::singleFingerPanEnabled

Definition at line 104 of file qabstractscrollarea_p.h.

◆ top

int QAbstractScrollAreaPrivate::top

◆ vbar

QScrollBar * QAbstractScrollAreaPrivate::vbar

◆ vbarpolicy

Qt::ScrollBarPolicy QAbstractScrollAreaPrivate::vbarpolicy

◆ viewport

QWidget* QAbstractScrollAreaPrivate::viewport

Definition at line 78 of file qabstractscrollarea_p.h.

Referenced by QTextBrowserPrivate::_q_activateAnchor(), QTextEditPrivate::_q_adjustScrollbars(), QPlainTextEditPrivate::_q_adjustScrollbars(), QTextEditPrivate::_q_ensureVisible(), QTextBrowserPrivate::_q_highlightLink(), QTextEditPrivate::_q_repaintContents(), QPlainTextEditPrivate::_q_repaintContents(), QGraphicsViewPrivate::_q_setViewportCursor(), QGraphicsViewPrivate::_q_unsetViewportCursor(), QMdiAreaPrivate::appendChild(), QGraphicsViewPrivate::centerView(), QListView::currentChanged(), QIconModeViewBase::doDynamicLayout(), QColumnViewPrivate::doLayout(), QListModeViewBase::doStaticLayout(), QIconModeViewBase::filterDragLeaveEvent(), QIconModeViewBase::filterDragMoveEvent(), QIconModeViewBase::filterDropEvent(), QIconModeViewBase::filterStartDrag(), QMdiAreaPrivate::highlightNextSubWindow(), QListModeViewBase::indexToListViewItem(), QTextBrowserPrivate::init(), QTextEditPrivate::init(), QAbstractItemViewPrivate::init(), QPlainTextEditPrivate::init(), QMdiAreaPrivate::internalRaise(), QListModeViewBase::mapToViewport(), QGraphicsScenePrivate::markDirty(), QGraphicsViewPrivate::mouseMoveEventHandler(), QPlainTextEditPrivate::pageUpDown(), QGraphicsViewPrivate::populateSceneDragDropEvent(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QGraphicsViewPrivate::processPendingUpdates(), QMdiAreaPrivate::rearrange(), QMdiAreaPrivate::resizeToMinimumTileSize(), QIconModeViewBase::scrollContentsBy(), QListView::selectionChanged(), QTextEditPrivate::sendControlEvent(), QAbstractItemViewPrivate::setHoverIndex(), QTextBrowserPrivate::setSource(), QMdiAreaPrivate::subWindowList(), QCommonListViewBase::updateHorizontalScrollBar(), QListModeViewBase::updateHorizontalScrollBar(), QGraphicsViewPrivate::updateLastCenterPoint(), QGraphicsItemPrivate::updatePaintedViewBoundingRects(), QGraphicsViewPrivate::updateRect(), QGraphicsViewPrivate::updateRegion(), QMdiAreaPrivate::updateScrollBars(), QCommonListViewBase::updateVerticalScrollBar(), and QListModeViewBase::updateVerticalScrollBar().

◆ viewportFilter

QScopedPointer<QObject> QAbstractScrollAreaPrivate::viewportFilter

Definition at line 101 of file qabstractscrollarea_p.h.

◆ xoffset

int QAbstractScrollAreaPrivate::xoffset

Definition at line 86 of file qabstractscrollarea_p.h.

◆ yoffset

int QAbstractScrollAreaPrivate::yoffset

Definition at line 86 of file qabstractscrollarea_p.h.


The documentation for this class was generated from the following files: