Q3ScrollView Class Reference

#include <q3scrollview.h>

Inheritance diagram for Q3ScrollView:

Inheritance graph
[legend]
Collaboration diagram for Q3ScrollView:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Q3ScrollView widget provides a scrolling area with on-demand scroll bars.

The Q3ScrollView is a large canvas - potentially larger than the coordinate system normally supported by the underlying window system. This is important because it is quite easy to go beyond these limitations (e.g. many web pages are more than 32000 pixels high). Additionally, the Q3ScrollView can have QWidgets positioned on it that scroll around with the drawn content. These sub-widgets can also have positions outside the normal coordinate range (but they are still limited in size).

To provide content for the widget, inherit from Q3ScrollView, reimplement drawContents() and use resizeContents() to set the size of the viewed area. Use addChild() and moveChild() to position widgets on the view.

To use Q3ScrollView effectively it is important to understand its widget structure in the three styles of use: a single large child widget, a large panning area with some widgets and a large panning area with many widgets.

\img qscrollview-vp2.png The first, simplest usage of Q3ScrollView (depicted above), is appropriate for scrolling areas that are never more than about 4000 pixels in either dimension (this is about the maximum reliable size on X11 servers). In this usage, you just make one large child in the Q3ScrollView. The child should be a child of the viewport() of the scrollview and be added with addChild(): @code Q3ScrollView* sv = new Q3ScrollView(...); QVBoxWidget* big_box = new QVBoxWidget(sv->viewport()); sv->addChild(big_box); \endcode You can go on to add arbitrary child widgets to the single child in the scrollview as you would with any widget: @code QLabel* child1 = new QLabel("CHILD", big_box); QLabel* child2 = new QLabel("CHILD", big_box); QLabel* child3 = new QLabel("CHILD", big_box); ... \endcode Here the Q3ScrollView has four children: the viewport(), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The viewport() has one child: the big QVBoxWidget. The QVBoxWidget has the three QLabel objects as child widgets. When the view is scrolled, the QVBoxWidget is moved; its children move with it as child widgets normally do. @section Using a Very Big View with Some Widgets \img qscrollview-vp.png The second usage of Q3ScrollView (depicted above) is appropriate when few, if any, widgets are on a very large scrolling area that is potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You may also add some widgets by making them children of the viewport() and adding them with addChild() (this is the same as the process for the single large widget in the previous example): @code Q3ScrollView* sv = new Q3ScrollView(...); QLabel* child1 = new QLabel("CHILD", sv->viewport()); sv->addChild(child1); QLabel* child2 = new QLabel("CHILD", sv->viewport()); sv->addChild(child2); QLabel* child3 = new QLabel("CHILD", sv->viewport()); sv->addChild(child3); \endcode Here, the Q3ScrollView has the same four children: the viewport(), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The viewport() has the three QLabel objects as child widgets. When the view is scrolled, the scrollview moves the child widgets individually. @section Using a Very Big View with Many Widgets \img qscrollview-cl.png The final usage of Q3ScrollView (depicted above) is appropriate when many widgets are on a very large scrolling area that is potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You then call enableClipper(true) and add widgets, again by making them children of the viewport(), and adding them with addChild(): @code Q3ScrollView* sv = new Q3ScrollView(...); sv->enableClipper(true); QLabel* child1 = new QLabel("CHILD", sv->viewport()); sv->addChild(child1); QLabel* child2 = new QLabel("CHILD", sv->viewport()); sv->addChild(child2); QLabel* child3 = new QLabel("CHILD", sv->viewport()); sv->addChild(child3); \endcode Here, the Q3ScrollView has four children: the clipper() (not the viewport() this time), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The clipper() has one child: the viewport(). The viewport() has the same three labels as child widgets. When the view is scrolled the viewport() is moved; its children move with it as child widgets normally do. \target allviews @section Details Relevant for All Views Normally you will use the first or third method if you want any child widgets in the view. Note that the widget you see in the scrolled area is the viewport() widget, not the Q3ScrollView itself. So to turn mouse tracking on, for example, use viewport()->setMouseTracking(true). To enable drag-and-drop, you would setAcceptDrops(true) on the Q3ScrollView (because drag-and-drop events propagate to the parent). But to work out the logical position in the view, you would need to map the drop co-ordinate from being relative to the Q3ScrollView to being relative to the contents; use the function viewportToContents() for this. To handle mouse events on the scrolling area, subclass scrollview as you would subclass other widgets, but rather than reimplementing mousePressEvent(), reimplement contentsMousePressEvent() instead. The contents specific event handlers provide translated events in the coordinate system of the scrollview. If you reimplement mousePressEvent(), you'll get called only when part of the Q3ScrollView is clicked: and the only such part is the "corner" (if you don't set a cornerWidget()) and the frame; everything else is covered up by the viewport, clipper or scroll bars. When you construct a Q3ScrollView, some of the window flags apply to the viewport() instead of being sent to the QWidget constructor for the Q3ScrollView. \list \i An image-manipulation widget would use \c WNoAutoErase|WStaticContents because the widget draws all pixels itself, and when its size increases, it only needs a paint event for the new part because the old part remains unchanged. \i A scrolling game widget in which the background scrolls as the characters move might use \c WNoAutoErase (in addition to \c WStaticContents) so that the window system background does not flash in and out during scrolling. \i A word processing widget might use \c WNoAutoErase and repaint itself line by line to get a less-flickery resizing. If the widget is in a mode in which no text justification can take place, it might use \c WStaticContents too, so that it would only get a repaint for the newly visible parts. \endlist Child widgets may be moved using addChild() or moveChild(). Use childX() and childY() to get the position of a child widget. A widget may be placed in the corner between the vertical and horizontal scrollbars with setCornerWidget(). You can get access to the scrollbars using horizontalScrollBar() and verticalScrollBar(), and to the viewport with viewport(). The scroll view can be scrolled using scrollBy(), ensureVisible(), setContentsPos() or center(). The visible area is given by visibleWidth() and visibleHeight(), and the contents area by contentsWidth() and contentsHeight(). The contents may be repainted using one of the repaintContents() or updateContents() functions. Coordinate conversion is provided by contentsToViewport() and viewportToContents(). The contentsMoving() signal is emitted just before the contents are moved Definition at line 36 of file q3scrollview.h.

Public Types

enum  ResizePolicy
enum  ScrollBarMode

Public Slots

virtual void resizeContents (int w, int h)
void scrollBy (int dx, int dy)
virtual void setContentsPos (int x, int y)
void ensureVisible (int x, int y)
void ensureVisible (int x, int y, int xmargin, int ymargin)
void center (int x, int y)
void center (int x, int y, float xmargin, float ymargin)
void updateScrollBars ()
void setEnabled (bool enable)

Signals

void contentsMoving (int x, int y)
void horizontalSliderPressed ()
void horizontalSliderReleased ()
void verticalSliderPressed ()
void verticalSliderReleased ()

Public Member Functions

 Q3ScrollView (QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0)
 ~Q3ScrollView ()
virtual void setResizePolicy (ResizePolicy)
ResizePolicy resizePolicy () const
void styleChange (QStyle &)
void removeChild (QWidget *child)
virtual void addChild (QWidget *child, int x=0, int y=0)
virtual void moveChild (QWidget *child, int x, int y)
int childX (QWidget *child)
int childY (QWidget *child)
bool childIsVisible (QWidget *child)
void showChild (QWidget *child, bool yes=true)
ScrollBarMode vScrollBarMode () const
virtual void setVScrollBarMode (ScrollBarMode)
ScrollBarMode hScrollBarMode () const
virtual void setHScrollBarMode (ScrollBarMode)
QWidgetcornerWidget () const
virtual void setCornerWidget (QWidget *)
QScrollBarhorizontalScrollBar () const
QScrollBarverticalScrollBar () const
QWidgetviewport () const
QWidgetclipper () const
int visibleWidth () const
int visibleHeight () const
int contentsWidth () const
int contentsHeight () const
int contentsX () const
int contentsY () const
void resize (int w, int h)
void resize (const QSize &)
void setVisible (bool visible)
void updateContents (int x, int y, int w, int h)
void updateContents (const QRect &r)
void updateContents ()
void repaintContents (int x, int y, int w, int h, bool erase=true)
void repaintContents (const QRect &r, bool erase=true)
void repaintContents (bool erase=true)
void contentsToViewport (int x, int y, int &vx, int &vy) const
void viewportToContents (int vx, int vy, int &x, int &y) const
QPoint contentsToViewport (const QPoint &) const
QPoint viewportToContents (const QPoint &) const
void enableClipper (bool y)
void setStaticBackground (bool y)
bool hasStaticBackground () const
QSize viewportSize (int, int) const
QSize sizeHint () const
QSize minimumSizeHint () const
void removeChild (QObject *child)
bool isHorizontalSliderPressed ()
bool isVerticalSliderPressed ()
virtual void setDragAutoScroll (bool b)
bool dragAutoScroll () const
virtual void setMargins (int left, int top, int right, int bottom)
int leftMargin () const
int topMargin () const
int rightMargin () const
int bottomMargin () const
void disableSizeHintCaching ()

Protected Member Functions

virtual void drawContents (QPainter *, int cx, int cy, int cw, int ch)
virtual void drawContentsOffset (QPainter *, int ox, int oy, int cx, int cy, int cw, int ch)
virtual void contentsMousePressEvent (QMouseEvent *)
virtual void contentsMouseReleaseEvent (QMouseEvent *)
virtual void contentsMouseDoubleClickEvent (QMouseEvent *)
virtual void contentsMouseMoveEvent (QMouseEvent *)
virtual void contentsDragEnterEvent (QDragEnterEvent *)
virtual void contentsDragMoveEvent (QDragMoveEvent *)
virtual void contentsDragLeaveEvent (QDragLeaveEvent *)
virtual void contentsDropEvent (QDropEvent *)
virtual void contentsWheelEvent (QWheelEvent *)
virtual void contentsContextMenuEvent (QContextMenuEvent *)
virtual void viewportPaintEvent (QPaintEvent *)
virtual void viewportResizeEvent (QResizeEvent *)
virtual void viewportMousePressEvent (QMouseEvent *)
virtual void viewportMouseReleaseEvent (QMouseEvent *)
virtual void viewportMouseDoubleClickEvent (QMouseEvent *)
virtual void viewportMouseMoveEvent (QMouseEvent *)
virtual void viewportDragEnterEvent (QDragEnterEvent *)
virtual void viewportDragMoveEvent (QDragMoveEvent *)
virtual void viewportDragLeaveEvent (QDragLeaveEvent *)
virtual void viewportDropEvent (QDropEvent *)
virtual void viewportWheelEvent (QWheelEvent *)
virtual void viewportContextMenuEvent (QContextMenuEvent *)
void frameChanged ()
bool focusNextPrevChild (bool next)
virtual void setHBarGeometry (QScrollBar &hbar, int x, int y, int w, int h)
virtual void setVBarGeometry (QScrollBar &vbar, int x, int y, int w, int h)
void resizeEvent (QResizeEvent *)
void mousePressEvent (QMouseEvent *)
void mouseReleaseEvent (QMouseEvent *)
void mouseDoubleClickEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
void wheelEvent (QWheelEvent *)
void contextMenuEvent (QContextMenuEvent *)
bool eventFilter (QObject *, QEvent *e)
void setCachedSizeHint (const QSize &sh) const
QSize cachedSizeHint () const
void fontChange (const QFont &)

Private Slots

void hslide (int)
void vslide (int)
void hbarIsPressed ()
void hbarIsReleased ()
void vbarIsPressed ()
void vbarIsReleased ()
void doDragAutoScroll ()
void startDragAutoScroll ()
void stopDragAutoScroll ()

Private Member Functions

void drawContents (QPainter *)
void moveContents (int x, int y)
void changeFrameRect (const QRect &)

Private Attributes

Q3ScrollViewDatad


Member Enumeration Documentation

enum Q3ScrollView::ResizePolicy

This enum type is used to control a Q3ScrollView's reaction to resize events.

Default the Q3ScrollView selects one of the other settings automatically when it has to. In this version of Qt, Q3ScrollView changes to Manual if you resize the contents with resizeContents() and to AutoOne if a child is added.

Manual the contents stays the size set by resizeContents().

AutoOne if there is only one child widget the contents stays the size of that widget. Otherwise the behavior is undefined.

AutoOneFit if there is only one child widget the contents stays the size of that widget's sizeHint(). If the scrollview is resized larger than the child's sizeHint(), the child will be resized to fit. If there is more than one child, the behavior is undefined.

Definition at line 55 of file q3scrollview.h.

enum Q3ScrollView::ScrollBarMode

This enum type describes the various modes of Q3ScrollView's scroll bars.

Auto Q3ScrollView shows a scroll bar when the content is too large to fit and not otherwise. This is the default.

AlwaysOff Q3ScrollView never shows a scroll bar.

AlwaysOn Q3ScrollView always shows a scroll bar.

(The modes for the horizontal and vertical scroll bars are independent.)

Definition at line 68 of file q3scrollview.h.

00068 { Auto, AlwaysOff, AlwaysOn };


Constructor & Destructor Documentation

Q3ScrollView::Q3ScrollView ( QWidget parent = 0,
const char *  name = 0,
Qt::WindowFlags  f = 0 
)

Constructs a Q3ScrollView called name with parent parent and widget flags f.

The widget flags WStaticContents, WNoAutoErase and WPaintClever are propagated to the viewport() widget. The other widget flags are propagated to the parent constructor as usual.

Definition at line 558 of file q3scrollview.cpp.

References Q3ScrollViewData::autoscroll_timer, QObject::connect(), d, doDragAutoScroll(), QSizePolicy::Expanding, flags, Q3ScrollViewData::hbar, hbarIsPressed(), hbarIsReleased(), hslide(), QObject::installEventFilter(), QStyle::PM_DefaultFrameWidth, Q3ScrollViewData::scrollbar_timer, QFrame::setFrameStyle(), QFrame::setLineWidth(), QWidget::setSizePolicy(), SIGNAL, SLOT, QWidget::style(), QFrame::StyledPanel, QFrame::Sunken, updateScrollBars(), Q3ScrollViewData::vbar, vbarIsPressed(), vbarIsReleased(), Q3ScrollViewData::viewport, and vslide().

00558                                                                              :
00559     Q3Frame(parent, name, f & (~WStaticContents) & (~WNoAutoErase) & (~WResizeNoErase))
00560 {
00561     WindowFlags flags = WResizeNoErase | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents);
00562     d = new Q3ScrollViewData(this, flags);
00563 
00564 #ifndef QT_NO_DRAGANDDROP
00565     connect(&d->autoscroll_timer, SIGNAL(timeout()),
00566              this, SLOT(doDragAutoScroll()));
00567 #endif
00568 
00569     connect(d->hbar, SIGNAL(valueChanged(int)),
00570         this, SLOT(hslide(int)));
00571     connect(d->vbar, SIGNAL(valueChanged(int)),
00572         this, SLOT(vslide(int)));
00573 
00574     connect(d->hbar, SIGNAL(sliderPressed()), this, SLOT(hbarIsPressed()));
00575     connect(d->hbar, SIGNAL(sliderReleased()), this, SLOT(hbarIsReleased()));
00576     connect(d->vbar, SIGNAL(sliderPressed()), this, SLOT(vbarIsPressed()));
00577     connect(d->vbar, SIGNAL(sliderReleased()), this, SLOT(vbarIsReleased()));
00578 
00579 
00580     d->viewport->installEventFilter(this);
00581 
00582     connect(&d->scrollbar_timer, SIGNAL(timeout()),
00583              this, SLOT(updateScrollBars()));
00584 
00585     setFrameStyle(Q3Frame::StyledPanel | Q3Frame::Sunken);
00586     setLineWidth(style()->pixelMetric(QStyle::PM_DefaultFrameWidth));
00587     setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
00588 }

Here is the call graph for this function:

Q3ScrollView::~Q3ScrollView (  ) 

Destroys the Q3ScrollView. Any children added with addChild() will be deleted.

Definition at line 595 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, d, Q3ScrollViewData::hbar, QObject::removeEventFilter(), Q3ScrollViewData::vbar, and Q3ScrollViewData::viewport.

00596 {
00597     // Be careful not to get all those useless events...
00598     if (d->clipped_viewport)
00599         d->clipped_viewport->removeEventFilter(this);
00600     else
00601         d->viewport->removeEventFilter(this);
00602 
00603     // order is important
00604     // ~QWidget may cause a WM_ERASEBKGND on Windows
00605     delete d->vbar;
00606     d->vbar = 0;
00607     delete d->hbar;
00608     d->hbar = 0;
00609     delete d->viewport;
00610     d->viewport = 0;
00611     delete d;
00612     d = 0;
00613 }

Here is the call graph for this function:


Member Function Documentation

void Q3ScrollView::setResizePolicy ( ResizePolicy   )  [virtual]

Definition at line 1304 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::policy.

Referenced by addChild(), Q3Table::init(), and resizeContents().

01305 {
01306     d->policy = r;
01307 }

Q3ScrollView::ResizePolicy Q3ScrollView::resizePolicy (  )  const

Definition at line 1317 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::policy.

01318 {
01319     return d->policy;
01320 }

void Q3ScrollView::styleChange ( QStyle old  )  [virtual]

Reimplemented from QWidget.

Definition at line 678 of file q3scrollview.cpp.

References Q3ScrollViewData::cachedSizeHint, d, QWidget::styleChange(), and updateScrollBars().

00679 {
00680     QWidget::styleChange(old);
00681     updateScrollBars();
00682     d->cachedSizeHint = QSize();
00683 }

Here is the call graph for this function:

void Q3ScrollView::removeChild ( QWidget child  ) 

Removes the child widget from the scrolled area. Note that this happens automatically if the child is deleted.

Definition at line 1334 of file q3scrollview.cpp.

References d, Q3ScrollViewData::deleteChildRec(), and Q3ScrollViewData::rec().

Referenced by eventFilter().

01335 {
01336     if (!d || !child) // First check in case we are destructing
01337         return;
01338 
01339     QSVChildRec *r = d->rec(child);
01340     if (r) d->deleteChildRec(r);
01341 }

Here is the call graph for this function:

void Q3ScrollView::addChild ( QWidget child,
int  x = 0,
int  y = 0 
) [virtual]

Inserts the widget, child, into the scrolled area positioned at (x, y). The position defaults to (0, 0). If the child is already in the view, it is just moved.

You may want to call enableClipper(true) if you add a large number of widgets.

Definition at line 1359 of file q3scrollview.cpp.

References Q3ScrollViewData::addChildRec(), AutoOne, Q3ScrollViewData::autoResize(), Q3ScrollViewData::autoResizeHint(), Q3ScrollViewData::children, Q3ScrollViewData::clipped_viewport, d, Default, QSVChildRec::hideOrShow(), QObject::installEventFilter(), Q3PtrList< type >::isEmpty(), Manual, QSVChildRec::moveTo(), QWidget::parentWidget(), Q3ScrollViewData::policy, qWarning(), Q3ScrollViewData::rec(), QObject::removeEventFilter(), setResizePolicy(), and viewport().

Referenced by Q3ListView::handleSizeChange(), moveChild(), Q3TableHeader::Q3TableHeader(), Q3IconViewItem::rename(), Q3ListViewItem::startRename(), and Q3ListView::viewportResizeEvent().

01360 {
01361     if (!child) {
01362 #if defined(QT_CHECK_NULL)
01363         qWarning("Q3ScrollView::addChild(): Cannot add null child");
01364 #endif
01365         return;
01366     }
01367     child->polish();
01368     child->setBackgroundOrigin(WidgetOrigin);
01369 
01370     if (child->parentWidget() == viewport()) {
01371         // May already be there
01372         QSVChildRec *r = d->rec(child);
01373         if (r) {
01374             r->moveTo(this,x,y,d->clipped_viewport);
01375             if (d->policy > Manual) {
01376                 d->autoResizeHint(this);
01377                 d->autoResize(this); // #### better to just deal with this one widget!
01378             }
01379             return;
01380         }
01381     }
01382 
01383     if (d->children.isEmpty() && d->policy != Manual) {
01384         if (d->policy == Default)
01385             setResizePolicy(AutoOne);
01386         child->installEventFilter(this);
01387     } else if (d->policy == AutoOne) {
01388         child->removeEventFilter(this); //#### ?????
01389         setResizePolicy(Manual);
01390     }
01391     if (child->parentWidget() != viewport()) {
01392             child->reparent(viewport(), 0, QPoint(0,0), false);
01393     }
01394     d->addChildRec(child,x,y)->hideOrShow(this, d->clipped_viewport);
01395 
01396     if (d->policy > Manual) {
01397         d->autoResizeHint(this);
01398         d->autoResize(this); // #### better to just deal with this one widget!
01399     }
01400 }

Here is the call graph for this function:

void Q3ScrollView::moveChild ( QWidget child,
int  x,
int  y 
) [virtual]

Repositions the child widget to (x, y). This function is the same as addChild().

Definition at line 1406 of file q3scrollview.cpp.

References addChild().

Referenced by Q3Table::drawContents(), Q3TableHeader::sectionWidthChanged(), Q3Table::setCellWidget(), Q3Table::updateColWidgets(), and Q3Table::updateRowWidgets().

01407 {
01408     addChild(child,x,y);
01409 }

Here is the call graph for this function:

int Q3ScrollView::childX ( QWidget child  ) 

Returns the X position of the given child widget. Use this rather than QWidget::x() for widgets added to the view.

This function returns 0 if child has not been added to the view.

Definition at line 1417 of file q3scrollview.cpp.

References d, Q3ScrollViewData::rec(), and QSVChildRec::x.

01418 {
01419     QSVChildRec *r = d->rec(child);
01420     return r ? r->x : 0;
01421 }

Here is the call graph for this function:

int Q3ScrollView::childY ( QWidget child  ) 

Returns the Y position of the given child widget. Use this rather than QWidget::y() for widgets added to the view.

This function returns 0 if child has not been added to the view.

Definition at line 1429 of file q3scrollview.cpp.

References d, Q3ScrollViewData::rec(), and QSVChildRec::y.

01430 {
01431     QSVChildRec *r = d->rec(child);
01432     return r ? r->y : 0;
01433 }

Here is the call graph for this function:

bool Q3ScrollView::childIsVisible ( QWidget child  )  [inline]

Returns true if child is visible. This is equivalent to child->isVisible().

Definition at line 65 of file q3scrollview.h.

References QWidget::isVisible().

00065 { return child->isVisible(); } // obsolete functions

Here is the call graph for this function:

void Q3ScrollView::showChild ( QWidget child,
bool  y = true 
) [inline]

Sets the visibility of child. Equivalent to QWidget::show() or QWidget::hide().

Definition at line 66 of file q3scrollview.h.

References QWidget::setVisible().

00066 { child->setVisible(yes); }

Q3ScrollView::ScrollBarMode Q3ScrollView::vScrollBarMode (  )  const

Definition at line 1195 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::vMode.

Referenced by Q3ListBox::autoScrollBar(), and Q3ListBox::scrollBar().

01196 {
01197     return d->vMode;
01198 }

void Q3ScrollView::setVScrollBarMode ( ScrollBarMode   )  [virtual]

Definition at line 1227 of file q3scrollview.cpp.

References d, updateScrollBars(), and Q3ScrollViewData::vMode.

Referenced by Q3ComboBox::popup(), Q3IconViewItemLineEdit::Q3IconViewItemLineEdit(), Q3ListBox::setAutoScrollBar(), Q3ComboBox::setListBox(), Q3ListBox::setScrollBar(), Q3DataTable::setSize(), and Q3ComboBox::setUpListBox().

01228 {
01229     if (d->vMode != mode) {
01230         d->vMode = mode;
01231         updateScrollBars();
01232     }
01233 }

Q3ScrollView::ScrollBarMode Q3ScrollView::hScrollBarMode (  )  const

Definition at line 1244 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::hMode.

Referenced by Q3ListBox::autoBottomScrollBar(), and Q3ListBox::bottomScrollBar().

01245 {
01246     return d->hMode;
01247 }

void Q3ScrollView::setHScrollBarMode ( ScrollBarMode   )  [virtual]

Definition at line 1249 of file q3scrollview.cpp.

References d, Q3ScrollViewData::hMode, and updateScrollBars().

Referenced by Q3IconViewItemLineEdit::Q3IconViewItemLineEdit(), Q3ListBox::setAutoBottomScrollBar(), Q3ListBox::setBottomScrollBar(), Q3ComboBox::setListBox(), and Q3ComboBox::setUpListBox().

01250 {
01251     if (d->hMode != mode) {
01252         d->hMode = mode;
01253         updateScrollBars();
01254     }
01255 }

QWidget * Q3ScrollView::cornerWidget (  )  const

Returns the widget in the corner between the two scroll bars.

By default, no corner widget is present.

Definition at line 1263 of file q3scrollview.cpp.

References Q3ScrollViewData::corner, and d.

Referenced by updateScrollBars().

01264 {
01265     return d->corner;
01266 }

void Q3ScrollView::setCornerWidget ( QWidget corner  )  [virtual]

Sets the widget in the corner between the two scroll bars.

You will probably also want to set at least one of the scroll bar modes to AlwaysOn.

Passing 0 shows no widget in the corner.

Any previous corner widget is hidden.

You may call setCornerWidget() with the same widget at different times.

All widgets set here will be deleted by the Q3ScrollView when it is destroyed unless you separately reparent the widget after setting some other corner widget (or 0).

Any newly set widget should have no current parent.

By default, no corner widget is present.

See also:
setVScrollBarMode(), setHScrollBarMode()

Definition at line 1291 of file q3scrollview.cpp.

References Q3ScrollViewData::corner, d, QWidget::hide(), QWidget::setParent(), QWidget::show(), and updateScrollBars().

01292 {
01293     QWidget* oldcorner = d->corner;
01294     if (oldcorner != corner) {
01295         if (oldcorner) oldcorner->hide();
01296         d->corner = corner;
01297         corner->setParent(this);
01298         updateScrollBars();
01299         if (corner) corner->show();
01300     }
01301 }

Here is the call graph for this function:

QScrollBar * Q3ScrollView::horizontalScrollBar (  )  const

Returns the component horizontal scroll bar. It is made available to allow accelerators, autoscrolling, etc.

It should not be used for other purposes.

This function never returns 0.

Definition at line 1889 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::hbar.

Referenced by Q3ListBox::doAutoScroll(), Q3TextEdit::drawContents(), Q3ListView::handleSizeChange(), Q3ListView::init(), Q3Table::init(), Q3ListView::keyPressEvent(), Q3ListBox::keyPressEvent(), Q3ListView::updateGeometries(), Q3Table::updateGeometries(), updateScrollBars(), viewportSize(), and wheelEvent().

01890 {
01891     return d->hbar;
01892 }

QScrollBar * Q3ScrollView::verticalScrollBar (  )  const

Returns the component vertical scroll bar. It is made available to allow accelerators, autoscrolling, etc.

It should not be used for other purposes.

This function never returns 0.

Definition at line 1902 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::vbar.

Referenced by Q3ListBox::doAutoScroll(), Q3TextEdit::drawContents(), Q3Table::init(), Q3DataTable::loadNextPage(), Q3DataTable::reset(), Q3DataTable::setSize(), Q3ListView::sizeHint(), Q3IconView::sizeHint(), Q3DataTable::sliderPressed(), Q3DataTable::sliderReleased(), Q3ListView::updateGeometries(), Q3Table::updateGeometries(), updateScrollBars(), viewportSize(), and wheelEvent().

01902                                                   {
01903     return d->vbar;
01904 }

QWidget * Q3ScrollView::viewport (  )  const

Returns the viewport widget of the scrollview. This is the widget containing the contents widget or which is the drawing area.

Definition at line 2375 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, d, and Q3ScrollViewData::viewport.

Referenced by Q3FileDialogQFileListView::acceptDrop(), QFileListBox::acceptDrop(), addChild(), Q3Canvas::addView(), Q3IconView::arrangeItemsInGrid(), Q3TextEdit::autoScrollTimerDone(), QFileListBox::cancelRename(), Q3FileDialogQFileListView::cancelRename(), Q3ListBox::changeEvent(), Q3ListView::changeEvent(), Q3ListView::clear(), Q3IconView::contentsContextMenuEvent(), Q3Table::contentsContextMenuEvent(), Q3ListView::contentsContextMenuEvent(), Q3IconView::contentsDragMoveEvent(), Q3TextEdit::contentsDropEvent(), Q3IconView::contentsDropEvent(), Q3ListView::contentsMouseDoubleClickEvent(), Q3TextEdit::contentsMouseMoveEvent(), Q3TextEdit::contentsMousePressEvent(), Q3IconView::contentsMousePressEventEx(), Q3ListView::contentsMousePressEventEx(), Q3TextEdit::contentsMouseReleaseEvent(), Q3IconView::contentsMouseReleaseEvent(), Q3ListView::contentsMouseReleaseEventEx(), contextMenuEvent(), Q3DataTable::createEditor(), Q3Table::createEditor(), Q3ListView::doAutoScroll(), Q3IconView::doAutoScroll(), Q3FileDialog::doMimeTypeLookup(), Q3ListBox::doRubberSelection(), Q3DataTable::doUpdateCurrent(), Q3IconView::dragObject(), Q3IconView::drawBackground(), Q3IconView::drawContents(), Q3Table::drawContents(), Q3ListView::drawContentsOffset(), Q3TextEdit::drawCursor(), Q3IconView::drawDragShapes(), Q3Canvas::drawViewArea(), Q3Table::endEdit(), Q3DataTable::endEdit(), Q3DataTable::endInsert(), Q3Table::ensureCellVisible(), Q3ListBox::ensureCurrentVisible(), Q3FileDialog::eventFilter(), Q3IconView::eventFilter(), Q3Table::eventFilter(), Q3ComboBox::eventFilter(), Q3TextEdit::eventFilter(), Q3ListView::eventFilter(), Q3TextEdit::find(), Q3ListView::focusInEvent(), Q3ListView::focusOutEvent(), getStyleOption(), Q3TextEdit::handleReadOnlyKeyEvent(), Q3ListView::handleSizeChange(), Q3ListView::init(), Q3FileDialog::init(), Q3TextEdit::init(), Q3Table::init(), Q3IconView::insertItem(), Q3ListBox::itemAt(), Q3TextEdit::keyPressEvent(), moveContents(), Q3TextEdit::moveCursor(), Q3TextEdit::optimAppend(), Q3TextEdit::optimDoAutoScroll(), Q3ListBox::paintCell(), Q3Table::paintCell(), Q3TextEdit::paintDocument(), Q3Table::paintEmptyArea(), Q3Table::paintFocus(), Q3ComboBox::popDownListBox(), Q3FileDialogQFileListView::Q3FileDialogQFileListView(), Q3GridView::Q3GridView(), Q3IconView::Q3IconView(), Q3ListBox::Q3ListBox(), Q3SyntaxHighlighter::Q3SyntaxHighlighter(), Q3TableHeader::Q3TableHeader(), Q3TextBrowser::Q3TextBrowser(), QFileListBox::QFileListBox(), Q3TextEdit::redo(), Q3DataTable::refresh(), Q3ListBox::refreshSlot(), Q3ListView::removeColumn(), Q3ListViewItem::removeRenameBox(), Q3IconViewItem::removeRenameBox(), Q3TextEdit::removeSelectedText(), Q3IconViewItem::rename(), Q3TextEdit::repaintChanged(), repaintContents(), Q3IconView::repaintSelectedItems(), Q3ListBox::resizeEvent(), Q3TableHeader::sectionWidthChanged(), Q3TextEdit::selectAll(), Q3IconView::selectAll(), Q3ListBox::selectRange(), Q3IconView::setArrangement(), Q3Canvas::setBackgroundColor(), Q3Table::setCellWidget(), Q3ListView::setColumnWidth(), Q3Table::setCurrentCell(), Q3ListBox::setCurrentItem(), Q3ListView::setCurrentItem(), Q3ListViewItem::setEnabled(), Q3SyntaxHighlighter::setFormat(), Q3ListViewItem::setOpen(), Q3TextEdit::setPaper(), Q3TextEdit::setReadOnly(), Q3ListBox::setSelected(), Q3ListViewItem::setSelected(), Q3ListView::setSorting(), Q3ListViewItem::setText(), Q3ListView::setTreeStepSize(), Q3CanvasView::setWorldMatrix(), QFileListBox::show(), Q3IconView::showEvent(), Q3IconView::slotUpdate(), Q3TextEdit::startDrag(), Q3IconView::startDrag(), Q3ListViewItem::startRename(), QFileListBox::startRename(), Q3FileDialogQFileListView::startRename(), Q3ListViewItem::takeItem(), Q3ListBox::toggleCurrentItem(), Q3TextEdit::undo(), Q3Canvas::update(), Q3Table::updateCell(), Q3IconView::updateContents(), updateContents(), Q3ListView::updateContents(), Q3TextEdit::updateCursor(), Q3ListView::updateDirtyItems(), Q3ListView::updateGeometries(), Q3ListBox::updateSelection(), QFileListBox::viewportMouseMoveEvent(), Q3FileDialogQFileListView::viewportMouseMoveEvent(), QFileListBox::viewportMousePressEvent(), Q3FileDialogQFileListView::viewportMousePressEvent(), viewportPaintEvent(), Q3ListBox::viewportPaintEvent(), and wheelEvent().

02376 {
02377     if (d->clipped_viewport)
02378         return  d->clipped_viewport;
02379     return d->viewport;
02380 }

QWidget * Q3ScrollView::clipper (  )  const

Returns the clipper widget. Contents in the scrollview are ultimately clipped to be inside the clipper widget.

You should not need to use this function.

See also:
visibleWidth(), visibleHeight()

Definition at line 2390 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::viewport.

Referenced by enableClipper(), moveContents(), resizeContents(), updateScrollBars(), visibleHeight(), and visibleWidth().

02391 {
02392     return d->viewport;
02393 }

int Q3ScrollView::visibleWidth (  )  const

Definition at line 2399 of file q3scrollview.cpp.

References clipper(), and QWidget::width().

Referenced by Q3IconView::arrangeItemsInGrid(), center(), Q3Table::columnIndexChanged(), Q3IconView::contentsContextMenuEvent(), Q3ListView::contentsContextMenuEvent(), Q3Table::contentsMouseMoveEvent(), Q3DataTable::deleteCurrent(), Q3ListBox::doAutoScroll(), Q3IconView::doAutoScroll(), Q3Table::doAutoScroll(), Q3TextEdit::documentWidthChanged(), doDragAutoScroll(), Q3TextEdit::doResize(), Q3Table::ensureCellVisible(), ensureVisible(), Q3IconView::eventFilter(), eventFilter(), Q3Table::finishContentsResze(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3ListView::handleSizeChange(), Q3TableHeader::indexChanged(), Q3DataTable::insertCurrent(), Q3IconView::insertInGrid(), Q3Table::insertRows(), Q3ListBox::itemRect(), Q3ListBox::itemVisible(), Q3ListView::keyPressEvent(), Q3IconView::keyPressEvent(), Q3IconView::makeRowLayout(), Q3ListBox::mouseMoveEvent(), Q3TableHeader::mouseReleaseEvent(), moveContents(), Q3ListBox::numItemsVisible(), Q3TextEdit::paintDocument(), Q3Table::paintEmptyArea(), Q3Table::rangeGeometry(), Q3ListBox::refreshSlot(), Q3TextEdit::removeSelectedText(), repaintContents(), Q3IconView::repaintItem(), Q3IconView::repaintSelectedItems(), resizeContents(), Q3ListView::resizeEvent(), Q3Table::rowHeightChanged(), Q3Table::rowIndexChanged(), Q3TableHeader::sectionWidthChanged(), Q3ListBox::setBottomItem(), setContentsPos(), Q3IconViewItem::setPicture(), Q3IconViewItem::setPixmap(), Q3IconViewItem::setText(), Q3ListBox::setTopItem(), Q3TextEdit::setWordWrap(), Q3TextEdit::setWrapColumnOrWidth(), Q3ListBox::sort(), Q3Table::sortColumn(), Q3ListViewItem::startRename(), Q3Canvas::update(), updateContents(), Q3ListView::updateGeometries(), Q3Table::updateGeometries(), updateScrollBars(), Q3ListView::viewportResizeEvent(), and Q3TextEdit::wrapColumnOrWidth().

02400 {
02401     return clipper()->width();
02402 }

Here is the call graph for this function:

int Q3ScrollView::visibleHeight (  )  const

Definition at line 2408 of file q3scrollview.cpp.

References clipper(), and QWidget::height().

Referenced by Q3TextEdit::append(), Q3IconView::arrangeItemsInGrid(), Q3DataTable::beginInsert(), Q3ListView::buildDrawableList(), center(), Q3Table::columnIndexChanged(), Q3Table::columnWidthChanged(), Q3IconView::contentsContextMenuEvent(), Q3ListView::contentsMouseMoveEvent(), Q3Table::contentsMouseMoveEvent(), Q3DataTable::deleteCurrent(), Q3ListBox::doAutoScroll(), Q3IconView::doAutoScroll(), Q3Table::doAutoScroll(), doDragAutoScroll(), Q3ListView::ensureItemVisible(), ensureVisible(), Q3IconView::eventFilter(), eventFilter(), Q3Table::finishContentsResze(), Q3TextEdit::focusNextPrevChild(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3TextEdit::handleMouseMove(), Q3TextEdit::handleReadOnlyKeyEvent(), Q3ListView::handleSizeChange(), Q3TableHeader::indexChanged(), Q3Table::insertColumns(), Q3DataTable::insertCurrent(), Q3IconView::insertInGrid(), Q3ListBox::itemRect(), Q3ListBox::itemVisible(), Q3Table::keyPressEvent(), Q3ListView::keyPressEvent(), Q3IconView::keyPressEvent(), Q3TextEdit::makeParagVisible(), Q3IconView::makeRowLayout(), Q3ListBox::mouseMoveEvent(), Q3TableHeader::mouseReleaseEvent(), moveContents(), Q3TextEdit::moveCursor(), Q3ListBox::numItemsVisible(), Q3TextEdit::optimAppend(), Q3TextEdit::paintDocument(), Q3Table::paintEmptyArea(), Q3Table::rangeGeometry(), Q3ListBox::refreshSlot(), Q3TextEdit::removeSelectedText(), repaintContents(), Q3IconView::repaintItem(), Q3IconView::repaintSelectedItems(), resizeContents(), Q3Table::rowHeightChanged(), Q3Table::rowIndexChanged(), Q3TextEdit::scrollToAnchor(), Q3TextEdit::scrollToBottom(), Q3TableHeader::sectionWidthChanged(), Q3ListBox::setBottomItem(), Q3IconViewItem::setPicture(), Q3IconViewItem::setPixmap(), Q3IconViewItem::setText(), Q3ListBox::sort(), Q3Table::sortColumn(), Q3Canvas::update(), updateContents(), Q3Table::updateGeometries(), and updateScrollBars().

02409 {
02410     return clipper()->height();
02411 }

Here is the call graph for this function:

int Q3ScrollView::contentsWidth (  )  const

Definition at line 2109 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsWidth(), and d.

Referenced by Q3Table::columnWidthChanged(), Q3IconView::contentsDropEvent(), Q3ListBox::doAutoScroll(), Q3IconView::doAutoScroll(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3Table::insertColumns(), Q3IconView::insertInGrid(), Q3ListView::itemAt(), Q3ListView::keyPressEvent(), Q3IconView::keyPressEvent(), Q3TextEdit::optimDrawContents(), Q3TextEdit::paintDocument(), Q3GridView::paintEmptyArea(), Q3ListBox::resizeEvent(), Q3IconView::showEvent(), Q3IconView::sizeHint(), Q3TextEdit::sync(), Q3ListBox::totalWidth(), Q3MultiLineEdit::totalWidth(), Q3CanvasView::updateContentsSize(), Q3IconView::updateItemContainer(), and updateScrollBars().

02110 {
02111     return d->contentsWidth();
02112 }

Here is the call graph for this function:

int Q3ScrollView::contentsHeight (  )  const

Definition at line 2118 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::vheight.

Referenced by Q3TextEdit::append(), Q3ListView::clear(), Q3IconView::contentsDropEvent(), Q3ListView::contentsMousePressEventEx(), Q3ListView::doAutoScroll(), Q3ListBox::doAutoScroll(), Q3IconView::doAutoScroll(), Q3TextEdit::documentWidthChanged(), ensureVisible(), Q3TextEdit::focusNextPrevChild(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3TextEdit::handleReadOnlyKeyEvent(), Q3IconView::insertInGrid(), Q3Table::insertRows(), Q3IconView::keyPressEvent(), Q3TextEdit::makeParagVisible(), moveContents(), Q3TextEdit::optimAppend(), Q3TextEdit::paintDocument(), Q3GridView::paintEmptyArea(), Q3TextEdit::removeSelectedText(), Q3ListBox::resizeEvent(), Q3Table::rowHeightChanged(), Q3TextEdit::scrollToAnchor(), Q3TextEdit::scrollToBottom(), Q3IconView::showEvent(), Q3IconView::sizeHint(), sizeHint(), Q3MultiLineEdit::totalHeight(), Q3ListBox::totalHeight(), Q3CanvasView::updateContentsSize(), Q3IconView::updateItemContainer(), and updateScrollBars().

02119 {
02120     return d->vheight;
02121 }

int Q3ScrollView::contentsX (  )  const

Definition at line 2090 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsX(), and d.

Referenced by Q3IconView::arrangeItemsInGrid(), Q3Table::columnIndexChanged(), Q3Table::columnWidthChanged(), Q3ListView::contentsMousePressEventEx(), Q3ListView::contentsMouseReleaseEventEx(), Q3Table::contentsToViewport2(), Q3DataTable::deleteCurrent(), Q3TableHeader::doAutoScroll(), Q3ListBox::doAutoScroll(), Q3Table::doAutoScroll(), Q3ListView::drawContentsOffset(), Q3TextEdit::drawCursor(), Q3ListView::ensureItemVisible(), Q3IconView::eventFilter(), Q3Table::finishContentsResze(), Q3TextEdit::focusNextPrevChild(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3TextEdit::handleReadOnlyKeyEvent(), Q3ListView::handleSizeChange(), QSVChildRec::hideOrShow(), Q3TableHeader::indexChanged(), Q3Table::inputMethodQuery(), Q3TextEdit::inputMethodQuery(), Q3Table::insertColumns(), Q3DataTable::insertCurrent(), Q3IconView::insertItem(), Q3Table::insertRows(), Q3ListView::itemAt(), Q3ListView::itemRect(), Q3ListBox::itemRect(), Q3ListBox::itemVisible(), Q3ListView::keyPressEvent(), Q3TextEdit::makeParagVisible(), Q3ListBox::mouseMoveEvent(), Q3TableHeader::mouseReleaseEvent(), Q3ListBox::numItemsVisible(), Q3TextEdit::optimAppend(), Q3TextEdit::optimDoAutoScroll(), Q3TextEdit::paintDocument(), Q3ComboBox::popup(), Q3Table::rangeGeometry(), Q3ListBox::refreshSlot(), Q3IconView::repaintItem(), Q3IconView::repaintSelectedItems(), Q3Table::rowHeightChanged(), Q3Table::rowIndexChanged(), Q3TextEdit::scrollToAnchor(), Q3TextEdit::scrollToBottom(), Q3TableHeader::sectionWidthChanged(), Q3ListBox::setBottomItem(), Q3TextEdit::setPaper(), Q3IconViewItem::setPicture(), Q3IconViewItem::setPixmap(), Q3IconViewItem::setText(), Q3ListBox::setTopItem(), Q3IconView::slotUpdate(), Q3ListBox::sort(), Q3Table::sortColumn(), Q3ListViewItem::startRename(), Q3ListBox::topItem(), Q3Canvas::update(), Q3FileDialogQFileListView::viewportMousePressEvent(), Q3ListBox::viewportPaintEvent(), Q3ListView::viewportResizeEvent(), and Q3Table::viewportToContents2().

02091 {
02092     return d->contentsX();
02093 }

Here is the call graph for this function:

int Q3ScrollView::contentsY (  )  const

Definition at line 2100 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsY(), and d.

Referenced by Q3TextEdit::append(), Q3IconView::arrangeItemsInGrid(), Q3DataTable::beginInsert(), Q3ListView::buildDrawableList(), Q3Table::columnIndexChanged(), Q3Table::columnWidthChanged(), Q3Table::contentsToViewport2(), Q3DataTable::deleteCurrent(), Q3ListView::doAutoScroll(), Q3TableHeader::doAutoScroll(), Q3ListBox::doAutoScroll(), Q3Table::doAutoScroll(), Q3TextEdit::drawCursor(), Q3ListView::ensureItemVisible(), Q3IconView::eventFilter(), Q3Table::finishContentsResze(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3TextEdit::handleMouseMove(), Q3TextEdit::handleReadOnlyKeyEvent(), QSVChildRec::hideOrShow(), Q3TableHeader::indexChanged(), Q3Table::inputMethodQuery(), Q3TextEdit::inputMethodQuery(), Q3Table::insertColumns(), Q3DataTable::insertCurrent(), Q3IconView::insertItem(), Q3Table::insertRows(), Q3ListView::itemAt(), Q3ListView::itemRect(), Q3ListBox::itemRect(), Q3ListBox::itemVisible(), Q3ListBox::mouseMoveEvent(), Q3TableHeader::mouseReleaseEvent(), Q3ListBox::numItemsVisible(), Q3TextEdit::optimAppend(), Q3TextEdit::optimDoAutoScroll(), Q3TextEdit::paintDocument(), Q3Table::rangeGeometry(), Q3ListBox::refreshSlot(), Q3IconView::repaintItem(), Q3IconView::repaintSelectedItems(), Q3Table::rowHeightChanged(), Q3Table::rowIndexChanged(), Q3TableHeader::sectionWidthChanged(), Q3TextEdit::setPaper(), Q3IconViewItem::setPicture(), Q3IconViewItem::setPixmap(), Q3IconViewItem::setText(), Q3IconView::slotUpdate(), Q3ListBox::sort(), Q3Table::sortColumn(), Q3ListBox::topItem(), Q3Canvas::update(), Q3ListBox::viewportPaintEvent(), Q3TextEdit::viewportResizeEvent(), and Q3Table::viewportToContents2().

02101 {
02102     return d->contentsY();
02103 }

Here is the call graph for this function:

void Q3ScrollView::resize ( int  w,
int  h 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This corresponds to resize(QSize(w, h)).

Reimplemented from QWidget.

Definition at line 1084 of file q3scrollview.cpp.

References QWidget::resize().

Referenced by Q3ComboBox::clear(), Q3Table::init(), Q3IconViewItemLineEdit::keyPressEvent(), Q3IconViewItemLineEdit::Q3IconViewItemLineEdit(), resize(), Q3ComboBox::resizeEvent(), Q3ComboBox::setListBox(), and Q3ComboBox::setUpListBox().

01085 {
01086     QWidget::resize(w, h);
01087 }

Here is the call graph for this function:

void Q3ScrollView::resize ( const QSize  ) 

Reimplemented from QWidget.

Definition at line 1092 of file q3scrollview.cpp.

References resize(), and s.

01093 {
01094     resize(s.width(), s.height());
01095 }

Here is the call graph for this function:

void Q3ScrollView::setVisible ( bool  visible  )  [virtual]

Reimplemented from QWidget.

Definition at line 1070 of file q3scrollview.cpp.

References d, Q3ScrollViewData::hideOrShowAll(), QWidget::isVisible(), QWidget::setVisible(), and updateScrollBars().

01071 {
01072     if (visible && !isVisible()) {
01073         QWidget::setVisible(visible);
01074         updateScrollBars();
01075         d->hideOrShowAll(this);
01076     } else {
01077         QWidget::setVisible(visible);
01078     }
01079 }

Here is the call graph for this function:

void Q3ScrollView::updateContents ( int  x,
int  y,
int  w,
int  h 
)

Calls update() on a rectangle defined by x, y, w, h, translated appropriately. If the rectangle is not visible, nothing is repainted.

See also:
repaintContents()

Definition at line 2177 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, QWidget::isVisible(), QWidget::update(), QWidget::updatesEnabled(), viewport(), visibleHeight(), visibleWidth(), QWidget::x(), and QWidget::y().

Referenced by Q3TableHeader::mouseReleaseEvent(), and Q3Canvas::setBackgroundPixmap().

02178 {
02179     if (!isVisible() || !updatesEnabled())
02180         return;
02181 
02182     QWidget* vp = viewport();
02183 
02184     // Translate
02185     x -= d->contentsX();
02186     y -= d->contentsY();
02187 
02188     if (x < 0) {
02189         w += x;
02190         x = 0;
02191     }
02192     if (y < 0) {
02193         h += y;
02194         y = 0;
02195     }
02196 
02197     if (w < 0 || h < 0)
02198         return;
02199     if (x > visibleWidth() || y > visibleHeight())
02200         return;
02201 
02202     if (w > visibleWidth())
02203         w = visibleWidth();
02204     if (h > visibleHeight())
02205         h = visibleHeight();
02206 
02207     if (d->clipped_viewport) {
02208         // Translate clipper() to viewport()
02209         x -= d->clipped_viewport->x();
02210         y -= d->clipped_viewport->y();
02211     }
02212 
02213     vp->update(x, y, w, h);
02214 }

Here is the call graph for this function:

void Q3ScrollView::updateContents ( const QRect r  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Updates the contents in rectangle r

Definition at line 2221 of file q3scrollview.cpp.

References QRect::height(), updateContents(), QRect::width(), QRect::x(), and QRect::y().

02222 {
02223     updateContents(r.x(), r.y(), r.width(), r.height());
02224 }

Here is the call graph for this function:

void Q3ScrollView::updateContents (  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 2229 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, visibleHeight(), and visibleWidth().

Referenced by Q3TextEdit::changeEvent(), Q3TextEdit::clear(), Q3Table::columnWidthChanged(), Q3TextEdit::formatMore(), Q3IconView::handleItemChange(), Q3Table::insertColumns(), Q3Table::insertRows(), Q3TextEdit::repaintChanged(), Q3Table::rowHeightChanged(), Q3IconView::selectAll(), Q3GridView::setCellHeight(), Q3GridView::setCellWidth(), Q3TextEdit::setPaper(), Q3Table::setShowGrid(), Q3TextEdit::setTabStopWidth(), Q3TextEdit::setText(), Q3TextEdit::setWordWrap(), Q3TextEdit::setWrapColumnOrWidth(), Q3TextEdit::setWrapPolicy(), Q3ListBox::sort(), Q3GridView::updateCell(), updateContents(), and Q3Table::windowActivationChange().

02230 {
02231     updateContents(d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight());
02232 }

Here is the call graph for this function:

void Q3ScrollView::repaintContents ( int  x,
int  y,
int  w,
int  h,
bool  erase = true 
)

Calls repaint() on a rectangle defined by x, y, w, h, translated appropriately. If the rectangle is not visible, nothing is repainted. If erase is true the background is cleared using the background color.

See also:
updateContents()

Definition at line 2266 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, QWidget::isVisible(), QWidget::repaint(), QWidget::updatesEnabled(), viewport(), visibleHeight(), visibleWidth(), QWidget::x(), and QWidget::y().

Referenced by Q3IconView::arrangeItemsInGrid(), Q3IconViewItem::cancelRenameItem(), Q3Table::clearSelection(), Q3Table::columnIndexChanged(), Q3Table::columnWidthChanged(), Q3IconView::contentsDropEvent(), Q3TextEdit::contentsMouseDoubleClickEvent(), Q3IconView::contentsMousePressEventEx(), Q3DataTable::deleteCurrent(), Q3IconView::doAutoScroll(), Q3TextEdit::doResize(), Q3Table::finishContentsResze(), Q3IconView::handleItemChange(), Q3TableHeader::indexChanged(), Q3DataTable::insertCurrent(), Q3TextEdit::optimDoAutoScroll(), Q3TextEdit::optimFind(), Q3TextEdit::optimInsert(), Q3TextEdit::optimMousePressEvent(), Q3TextEdit::optimMouseReleaseEvent(), Q3TextEdit::optimRemoveSelection(), Q3TextEdit::optimSelectAll(), Q3TextEdit::optimSetText(), Q3SyntaxHighlighter::rehighlight(), Q3TextEdit::removeSelectedText(), Q3Table::removeSelection(), Q3IconViewItem::renameItem(), Q3DataTable::repaintCell(), Q3Table::repaintCell(), Q3GridView::repaintCell(), repaintContents(), Q3IconView::repaintItem(), Q3Table::repaintSelections(), Q3Table::rowHeightChanged(), Q3Table::rowIndexChanged(), Q3TableHeader::sectionWidthChanged(), Q3TextEdit::setPaper(), Q3IconViewItem::setPicture(), Q3IconViewItem::setPixmap(), Q3TextEdit::setSelection(), Q3IconViewItem::setText(), Q3Table::sortColumn(), Q3IconView::takeItem(), Q3Table::takeItem(), Q3TextEdit::undo(), and Q3TableHeader::updateStretches().

02267 {
02268     if (!isVisible() || !updatesEnabled())
02269         return;
02270 
02271     QWidget* vp = viewport();
02272 
02273     // Translate logical to clipper()
02274     x -= d->contentsX();
02275     y -= d->contentsY();
02276 
02277     if (x < 0) {
02278         w += x;
02279         x = 0;
02280     }
02281     if (y < 0) {
02282         h += y;
02283         y = 0;
02284     }
02285 
02286     if (w < 0 || h < 0)
02287         return;
02288     if (w > visibleWidth())
02289         w = visibleWidth();
02290     if (h > visibleHeight())
02291         h = visibleHeight();
02292 
02293     if (d->clipped_viewport) {
02294         // Translate clipper() to viewport()
02295         x -= d->clipped_viewport->x();
02296         y -= d->clipped_viewport->y();
02297     }
02298 
02299     vp->repaint(x, y, w, h, erase);
02300 }

Here is the call graph for this function:

void Q3ScrollView::repaintContents ( const QRect r,
bool  erase = true 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Repaints the contents of rectangle r. If erase is true the background is cleared using the background color.

Definition at line 2240 of file q3scrollview.cpp.

References QRect::height(), repaintContents(), QRect::width(), QRect::x(), and QRect::y().

02241 {
02242     repaintContents(r.x(), r.y(), r.width(), r.height(), erase);
02243 }

Here is the call graph for this function:

void Q3ScrollView::repaintContents ( bool  erase = true  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Repaints the contents. If erase is true the background is cleared using the background color.

Definition at line 2252 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, repaintContents(), visibleHeight(), and visibleWidth().

02253 {
02254     repaintContents(d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight(), erase);
02255 }

Here is the call graph for this function:

void Q3ScrollView::contentsToViewport ( int  x,
int  y,
int &  vx,
int &  vy 
) const

Translates a point (x, y) in the contents to a point (vx, vy) on the viewport() widget.

Definition at line 2623 of file q3scrollview.cpp.

References QPoint::x(), and QPoint::y().

Referenced by Q3IconView::contentsContextMenuEvent(), Q3ListBox::contentsContextMenuEvent(), Q3Table::contentsContextMenuEvent(), Q3ListView::contentsContextMenuEvent(), Q3ListView::contentsDragEnterEvent(), Q3ListView::contentsDragMoveEvent(), Q3ListView::contentsDropEvent(), Q3ListView::contentsMouseDoubleClickEvent(), Q3ListView::contentsMouseMoveEvent(), Q3ListView::contentsMousePressEventEx(), Q3ListView::contentsMouseReleaseEventEx(), Q3IconView::doAutoScroll(), Q3IconView::drawContents(), Q3Table::drawContents(), Q3Canvas::drawViewArea(), Q3IconView::eventFilter(), Q3AccessibleTextEdit::itemRect(), Q3GridView::paintEmptyArea(), Q3TableHeader::sectionWidthChanged(), Q3Table::updateCell(), Q3CanvasView::updateContentsSize(), viewportDragEnterEvent(), viewportDragMoveEvent(), and viewportDropEvent().

02624 {
02625     const QPoint v = contentsToViewport(QPoint(x,y));
02626     vx = v.x();
02627     vy = v.y();
02628 }

Here is the call graph for this function:

void Q3ScrollView::viewportToContents ( int  vx,
int  vy,
int &  x,
int &  y 
) const

Translates a point (vx, vy) on the viewport() widget to a point (x, y) in the contents.

Definition at line 2634 of file q3scrollview.cpp.

References c.

Referenced by Q3TextEdit::autoScrollTimerDone(), Q3ListView::contentsMouseReleaseEventEx(), Q3IconView::doAutoScroll(), Q3IconView::eventFilter(), Q3ListView::eventFilter(), Q3ListView::handleSizeChange(), Q3ListBox::itemAt(), Q3AccessibleTextEdit::itemAt(), Q3ComboBox::popup(), Q3ListViewItem::startRename(), viewportContextMenuEvent(), viewportDragEnterEvent(), viewportDragMoveEvent(), viewportDropEvent(), viewportMouseDoubleClickEvent(), viewportMouseMoveEvent(), viewportMousePressEvent(), viewportMouseReleaseEvent(), Q3ListView::viewportResizeEvent(), and viewportWheelEvent().

02635 {
02636     const QPoint c = viewportToContents(QPoint(vx,vy));
02637     x = c.x();
02638     y = c.y();
02639 }

QPoint Q3ScrollView::contentsToViewport ( const QPoint p  )  const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the point p translated to a point on the viewport() widget.

Definition at line 2590 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, p, QWidget::x(), and QWidget::y().

02591 {
02592     if (d->clipped_viewport) {
02593         return QPoint(p.x() - d->contentsX() - d->clipped_viewport->x(),
02594                        p.y() - d->contentsY() - d->clipped_viewport->y());
02595     } else {
02596         return QPoint(p.x() - d->contentsX(),
02597                        p.y() - d->contentsY());
02598     }
02599 }

Here is the call graph for this function:

QPoint Q3ScrollView::viewportToContents ( const QPoint vp  )  const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the point on the viewport vp translated to a point in the contents.

Definition at line 2607 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, QPoint::x(), QWidget::x(), QPoint::y(), and QWidget::y().

02608 {
02609     if (d->clipped_viewport) {
02610         return QPoint(vp.x() + d->contentsX() + d->clipped_viewport->x(),
02611                        vp.y() + d->contentsY() + d->clipped_viewport->y());
02612     } else {
02613         return QPoint(vp.x() + d->contentsX(),
02614                        vp.y() + d->contentsY());
02615     }
02616 }

Here is the call graph for this function:

void Q3ScrollView::enableClipper ( bool  y  ) 

When a large numbers of child widgets are in a scrollview, especially if they are close together, the scrolling performance can suffer greatly. If y is true the scrollview will use an extra widget to group child widgets.

Note that you may only call enableClipper() prior to adding widgets.

Definition at line 2537 of file q3scrollview.cpp.

References Q3ScrollViewData::children, Q3ScrollViewData::clipped_viewport, clipper(), coord_limit, Q3PtrList< type >::count(), d, Q3ScrollViewData::flags, QObject::installEventFilter(), QObject::removeEventFilter(), QWidget::setGeometry(), QWidget::show(), and Q3ScrollViewData::viewport.

Referenced by Q3Table::init().

02538 {
02539     if (!d->clipped_viewport == !y)
02540         return;
02541     if (d->children.count())
02542         qFatal("May only call Q3ScrollView::enableClipper() before adding widgets");
02543     if (y) {
02544         d->clipped_viewport = new QClipperWidget(clipper(), "qt_clipped_viewport", QFlag(d->flags));
02545         d->clipped_viewport->setGeometry(-coord_limit/2,-coord_limit/2,
02546                                          coord_limit,coord_limit);
02547         d->clipped_viewport->setBackgroundMode(d->viewport->backgroundMode());
02548         d->viewport->setBackgroundMode(NoBackground); // no exposures for this
02549         d->viewport->removeEventFilter(this);
02550         d->clipped_viewport->installEventFilter(this);
02551         d->clipped_viewport->show();
02552     } else {
02553         delete d->clipped_viewport;
02554         d->clipped_viewport = 0;
02555     }
02556 }

Here is the call graph for this function:

void Q3ScrollView::setStaticBackground ( bool  y  ) 

Sets the scrollview to have a static background if y is true, or a scrolling background if y is false. By default, the background is scrolling.

Be aware that this mode is quite slow, as a full repaint of the visible area has to be triggered on every contents move.

See also:
hasStaticBackground()

Definition at line 2568 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::static_bg.

02569 {
02570     d->static_bg = y;
02571 }

bool Q3ScrollView::hasStaticBackground (  )  const

Returns true if Q3ScrollView uses a static background; otherwise returns false.

See also:
setStaticBackground()

Definition at line 2579 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::static_bg.

02580 {
02581     return d->static_bg;
02582 }

QSize Q3ScrollView::viewportSize ( int  x,
int  y 
) const

Returns the viewport size for size (x, y).

The viewport size depends on (x, y) (the size of the contents), the size of this widget and the modes of the horizontal and vertical scroll bars.

This function permits widgets that can trade vertical and horizontal space for each other to control scroll bar appearance better. For example, a word processor or web browser can control the width of the right margin accurately, whether or not there needs to be a vertical scroll bar.

Definition at line 760 of file q3scrollview.cpp.

References AlwaysOff, AlwaysOn, Q3ScrollViewData::anyVisibleChildren(), Auto, AutoOne, Q3ScrollViewData::b_marg, d, Q3Frame::frameWidth(), h, QWidget::height(), QSize::height(), Q3ScrollViewData::hMode, horizontalScrollBar(), Q3ScrollViewData::l_marg, Q3ScrollViewData::policy, Q3ScrollViewData::r_marg, QScrollBar::sizeHint(), Q3ScrollViewData::t_marg, verticalScrollBar(), Q3ScrollViewData::vMode, w, QSize::width(), and QWidget::width().

Referenced by Q3ListBox::doLayout(), and Q3ListBox::resizeEvent().

00761 {
00762     int fw = frameWidth();
00763     int lmarg = fw+d->l_marg;
00764     int rmarg = fw+d->r_marg;
00765     int tmarg = fw+d->t_marg;
00766     int bmarg = fw+d->b_marg;
00767 
00768     int w = width();
00769     int h = height();
00770 
00771     bool needh, needv;
00772     bool showh, showv;
00773     int hsbExt = horizontalScrollBar()->sizeHint().height();
00774     int vsbExt = verticalScrollBar()->sizeHint().width();
00775 
00776     if (d->policy != AutoOne || d->anyVisibleChildren()) {
00777         // Do we definitely need the scrollbar?
00778         needh = w-lmarg-rmarg < x;
00779         needv = h-tmarg-bmarg < y;
00780 
00781         // Do we intend to show the scrollbar?
00782         if (d->hMode == AlwaysOn)
00783             showh = true;
00784         else if (d->hMode == AlwaysOff)
00785             showh = false;
00786         else
00787             showh = needh;
00788 
00789         if (d->vMode == AlwaysOn)
00790             showv = true;
00791         else if (d->vMode == AlwaysOff)
00792             showv = false;
00793         else
00794             showv = needv;
00795 
00796         // Given other scrollbar will be shown, NOW do we need one?
00797         if (showh && h-vsbExt-tmarg-bmarg < y) {
00798             if (d->vMode == Auto)
00799                 showv=true;
00800         }
00801         if (showv && w-hsbExt-lmarg-rmarg < x) {
00802             if (d->hMode == Auto)
00803                 showh=true;
00804         }
00805     } else {
00806         // Scrollbars not needed, only show scrollbar that are always on.
00807         showh = d->hMode == AlwaysOn;
00808         showv = d->vMode == AlwaysOn;
00809     }
00810 
00811     return QSize(w-lmarg-rmarg - (showv ? vsbExt : 0),
00812                   h-tmarg-bmarg - (showh ? hsbExt : 0));
00813 }

Here is the call graph for this function:

QSize Q3ScrollView::sizeHint (  )  const [virtual]

Reimplemented from QFrame.

Definition at line 2644 of file q3scrollview.cpp.

References AlwaysOn, QSize::boundedTo(), Q3ScrollViewData::cachedSizeHint, QSVChildRec::child, Q3ScrollViewData::children, contentsHeight(), Q3ScrollViewData::contentsWidth(), d, QSize::expandedTo(), Q3PtrList< type >::first(), QWidget::fontMetrics(), Q3Frame::frameWidth(), h, Q3ScrollViewData::hbar, QFontMetrics::height(), QSize::height(), Q3ScrollViewData::hMode, QSize::isValid(), Manual, QWidget::maximumSize(), Q3ScrollViewData::policy, QSize::setHeight(), QSize::setWidth(), QWidget::size(), QScrollBar::sizeHint(), QWidget::sizeHint(), Q3ScrollViewData::use_cached_size_hint, Q3ScrollViewData::vbar, Q3ScrollViewData::vMode, and QSize::width().

Referenced by Q3Table::sizeHint(), Q3CanvasView::sizeHint(), and Q3IconView::sizeHint().

02645 {
02646     if (d->use_cached_size_hint && d->cachedSizeHint.isValid())
02647         return d->cachedSizeHint;
02648 
02649     constPolish();
02650     int f = 2 * frameWidth();
02651     int h = fontMetrics().height();
02652     QSize sz(f, f);
02653     if (d->policy > Manual) {
02654         QSVChildRec *r = d->children.first();
02655         if (r) {
02656             QSize cs = r->child->sizeHint();
02657             if (cs.isValid())
02658                 sz += cs.boundedTo(r->child->maximumSize());
02659             else
02660                 sz += r->child->size();
02661         }
02662     } else {
02663         sz += QSize(d->contentsWidth(), contentsHeight());
02664     }
02665     if (d->vMode == AlwaysOn)
02666         sz.setWidth(sz.width() + d->vbar->sizeHint().width());
02667     if (d->hMode == AlwaysOn)
02668         sz.setHeight(sz.height() + d->hbar->sizeHint().height());
02669     return sz.expandedTo(QSize(12 * h, 8 * h))
02670              .boundedTo(QSize(36 * h, 24 * h));
02671 }

Here is the call graph for this function:

QSize Q3ScrollView::minimumSizeHint (  )  const [virtual]

Reimplemented from QWidget.

Definition at line 2677 of file q3scrollview.cpp.

References QWidget::fontMetrics(), Q3Frame::frameWidth(), h, and QFontMetrics::height().

Referenced by Q3IconView::minimumSizeHint(), Q3ListView::minimumSizeHint(), and Q3ListBox::minimumSizeHint().

02678 {
02679     int h = fontMetrics().height();
02680     if (h < 10)
02681         h = 10;
02682     int f = 2 * frameWidth();
02683     return QSize((6 * h) + f, (4 * h) + f);
02684 }

Here is the call graph for this function:

void Q3ScrollView::removeChild ( QObject child  ) 

Definition at line 1346 of file q3scrollview.cpp.

01347 {
01348     Q3Frame::removeChild(child);
01349 }

bool Q3ScrollView::isHorizontalSliderPressed (  ) 

Returns true if horizontal slider is pressed by user; otherwise returns false.

Definition at line 650 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::hbarPressed.

Referenced by Q3TextEdit::ensureCursorVisible().

00651 {
00652     return d->hbarPressed;
00653 }

bool Q3ScrollView::isVerticalSliderPressed (  ) 

Returns true if vertical slider is pressed by user; otherwise returns false.

Definition at line 670 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::vbarPressed.

Referenced by Q3TextEdit::ensureCursorVisible().

00671 {
00672     return d->vbarPressed;
00673 }

void Q3ScrollView::setDragAutoScroll ( bool  b  )  [virtual]

Definition at line 2764 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::drag_autoscroll.

Referenced by Q3Table::init().

02765 {
02766     d->drag_autoscroll = b;
02767 }

bool Q3ScrollView::dragAutoScroll (  )  const

Definition at line 2769 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::drag_autoscroll.

02770 {
02771     return d->drag_autoscroll;
02772 }

void Q3ScrollView::contentsMoving ( int  x,
int  y 
) [signal]

This signal is emitted just before the contents are moved to position (x, y).

See also:
contentsX(), contentsY()

Referenced by moveContents(), Q3FileDialogQFileListView::Q3FileDialogQFileListView(), Q3IconView::Q3IconView(), and QFileListBox::QFileListBox().

void Q3ScrollView::horizontalSliderPressed (  )  [signal]

This signal is emitted whenever the user presses the horizontal slider.

Referenced by hbarIsPressed().

void Q3ScrollView::horizontalSliderReleased (  )  [signal]

This signal is emitted whenever the user releases the horizontal slider.

Referenced by hbarIsReleased(), and Q3TextEdit::init().

void Q3ScrollView::verticalSliderPressed (  )  [signal]

This signal is emitted whenever the user presses the vertical slider.

Referenced by vbarIsPressed().

void Q3ScrollView::verticalSliderReleased (  )  [signal]

This signal is emitted whenever the user releases the vertical slider.

Referenced by Q3TextEdit::init(), and vbarIsReleased().

void Q3ScrollView::resizeContents ( int  w,
int  h 
) [virtual, slot]

Sets the size of the contents area to w pixels wide and h pixels high and updates the viewport accordingly.

Definition at line 2127 of file q3scrollview.cpp.

References Q3ScrollViewData::children, clipper(), Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, Default, Q3PtrList< type >::isEmpty(), Manual, Q3ScrollViewData::policy, Q3ScrollViewData::scrollbar_timer, setResizePolicy(), QTimer::start(), t, QWidget::update(), Q3ScrollViewData::vheight, visibleHeight(), visibleWidth(), and Q3ScrollViewData::vwidth.

Referenced by Q3IconView::arrangeItemsInGrid(), Q3ScrollViewData::autoResize(), Q3ScrollViewData::autoResizeHint(), Q3TextEdit::changeEvent(), Q3ListView::clear(), Q3IconView::clear(), Q3Table::columnWidthChanged(), Q3IconView::contentsDropEvent(), Q3TextEdit::documentWidthChanged(), Q3TextEdit::doResize(), Q3Table::finishContentsResze(), Q3TextEdit::formatMore(), Q3TextEdit::init(), Q3IconView::insertInGrid(), Q3TextEdit::optimAppend(), Q3TextEdit::optimInsert(), Q3TextEdit::optimSetText(), Q3TextEdit::paintDocument(), Q3ListBox::resizeEvent(), Q3Table::rowHeightChanged(), Q3IconView::setArrangement(), Q3TextEdit::setText(), Q3TextEdit::setWrapColumnOrWidth(), Q3IconView::showEvent(), Q3Table::showEvent(), Q3IconView::slotUpdate(), Q3TextEdit::sync(), Q3CanvasView::updateContentsSize(), Q3ListView::updateGeometries(), Q3GridView::updateGrid(), Q3IconView::updateItemContainer(), and Q3TableHeader::updateWidgetStretches().

02128 {
02129     int ow = d->vwidth;
02130     int oh = d->vheight;
02131     d->vwidth = w;
02132     d->vheight = h;
02133 
02134     d->scrollbar_timer.start(0, true);
02135 
02136     if (d->children.isEmpty() && d->policy == Default)
02137         setResizePolicy(Manual);
02138 
02139     if (ow > w) {
02140         // Swap
02141         int t=w;
02142         w=ow;
02143         ow=t;
02144     }
02145     // Refresh area ow..w
02146     if (ow < visibleWidth() && w >= 0) {
02147         if (ow < 0)
02148             ow = 0;
02149         if (w > visibleWidth())
02150             w = visibleWidth();
02151         clipper()->update(d->contentsX()+ow, 0, w-ow, visibleHeight());
02152     }
02153 
02154     if (oh > h) {
02155         // Swap
02156         int t=h;
02157         h=oh;
02158         oh=t;
02159     }
02160     // Refresh area oh..h
02161     if (oh < visibleHeight() && h >= 0) {
02162         if (oh < 0)
02163             oh = 0;
02164         if (h > visibleHeight())
02165             h = visibleHeight();
02166         clipper()->update(0, d->contentsY()+oh, visibleWidth(), h-oh);
02167     }
02168 }

void Q3ScrollView::scrollBy ( int  dx,
int  dy 
) [slot]

Scrolls the content by dx to the left and dy upwards.

Definition at line 1995 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, and setContentsPos().

Referenced by doDragAutoScroll(), Q3Table::eventFilter(), resizeEvent(), and Q3ListViewItem::startRename().

01996 {
01997     setContentsPos(QMAX(d->contentsX()+dx, 0), QMAX(d->contentsY()+dy, 0));
01998 }

void Q3ScrollView::setContentsPos ( int  x,
int  y 
) [virtual, slot]

Scrolls the content so that the point (x, y) is in the top-left corner.

Definition at line 1974 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsWidth(), d, Q3ScrollViewData::hbar, moveContents(), QAbstractSlider::setValue(), Q3ScrollViewData::signal_choke, Q3ScrollViewData::vbar, and visibleWidth().

Referenced by Q3ScrollViewData::autoMove(), Q3TextEdit::clear(), Q3ListBox::clear(), Q3ListBox::doAutoScroll(), ensureVisible(), Q3TextEdit::focusNextPrevChild(), Q3TextEdit::handleReadOnlyKeyEvent(), Q3TextEdit::makeParagVisible(), Q3ComboBox::popup(), scrollBy(), Q3TextEdit::scrollToAnchor(), Q3TextEdit::scrollToBottom(), Q3ListBox::setBottomItem(), Q3ListView::setContentsPos(), Q3IconView::setContentsPos(), Q3TextBrowser::setSource(), Q3ListBox::setTopItem(), and Q3ListBox::sort().

01975 {
01976 #if 0
01977     // bounds checking...
01978     if (QApplication::reverseLayout())
01979         if (x > d->contentsWidth() - visibleWidth()) x = d->contentsWidth() - visibleWidth();
01980     else
01981 #endif
01982         if (x < 0) x = 0;
01983     if (y < 0) y = 0;
01984     // Choke signal handling while we update BOTH sliders.
01985     d->signal_choke=true;
01986     moveContents(-x, -y);
01987     d->vbar->setValue(y);
01988     d->hbar->setValue(x);
01989     d->signal_choke=false;
01990 }

void Q3ScrollView::ensureVisible ( int  x,
int  y 
) [slot]

Scrolls the content so that the point (x, y) is visible with at least 50-pixel margins (if possible, otherwise centered).

Definition at line 1911 of file q3scrollview.cpp.

Referenced by center(), Q3TableHeader::doAutoScroll(), Q3IconView::doAutoScroll(), Q3GridView::ensureCellVisible(), Q3Table::ensureCellVisible(), Q3ListBox::ensureCurrentVisible(), Q3TextEdit::ensureCursorVisible(), Q3IconView::ensureItemVisible(), focusNextPrevChild(), Q3TextEdit::optimAppend(), Q3TextEdit::optimDoAutoScroll(), Q3TextEdit::optimFind(), and Q3DataTable::reset().

01912 {
01913     ensureVisible(x, y, 50, 50);
01914 }

void Q3ScrollView::ensureVisible ( int  x,
int  y,
int  xmargin,
int  ymargin 
) [slot]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Scrolls the content so that the point (x, y) is visible with at least the xmargin and ymargin margins (if possible, otherwise centered).

Definition at line 1923 of file q3scrollview.cpp.

References contentsHeight(), Q3ScrollViewData::contentsWidth(), Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, setContentsPos(), visibleHeight(), and visibleWidth().

01924 {
01925     int pw=visibleWidth();
01926     int ph=visibleHeight();
01927 
01928     int cx=-d->contentsX();
01929     int cy=-d->contentsY();
01930     int cw=d->contentsWidth();
01931     int ch=contentsHeight();
01932 
01933     if (pw < xmargin*2)
01934         xmargin=pw/2;
01935     if (ph < ymargin*2)
01936         ymargin=ph/2;
01937 
01938     if (cw <= pw) {
01939         xmargin=0;
01940         cx=0;
01941     }
01942     if (ch <= ph) {
01943         ymargin=0;
01944         cy=0;
01945     }
01946 
01947     if (x < -cx+xmargin)
01948         cx = -x+xmargin;
01949     else if (x >= -cx+pw-xmargin)
01950         cx = -x+pw-xmargin;
01951 
01952     if (y < -cy+ymargin)
01953         cy = -y+ymargin;
01954     else if (y >= -cy+ph-ymargin)
01955         cy = -y+ph-ymargin;
01956 
01957     if (cx > 0)
01958         cx=0;
01959     else if (cx < pw-cw && cw>pw)
01960         cx=pw-cw;
01961 
01962     if (cy > 0)
01963         cy=0;
01964     else if (cy < ph-ch && ch>ph)
01965         cy=ph-ch;
01966 
01967     setContentsPos(-cx, -cy);
01968 }

void Q3ScrollView::center ( int  x,
int  y 
) [slot]

Scrolls the content so that the point (x, y) is in the center of visible area.

Definition at line 2004 of file q3scrollview.cpp.

References ensureVisible().

02005 {
02006     ensureVisible(x, y, 32000, 32000);
02007 }

void Q3ScrollView::center ( int  x,
int  y,
float  xmargin,
float  ymargin 
) [slot]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Scrolls the content so that the point (x, y) is visible with the xmargin and ymargin margins (as fractions of visible the area).

For example: Margin 0.0 allows (x, y) to be on the edge of the visible area. Margin 0.5 ensures that (x, y) is in middle 50% of the visible area. Margin 1.0 ensures that (x, y) is in the center of the the visible area.

Definition at line 2023 of file q3scrollview.cpp.

References ensureVisible(), visibleHeight(), and visibleWidth().

02024 {
02025     int pw=visibleWidth();
02026     int ph=visibleHeight();
02027     ensureVisible(x, y, int(xmargin/2.0*pw+0.5), int(ymargin/2.0*ph+0.5));
02028 }

void Q3ScrollView::updateScrollBars (  )  [slot]

Updates scroll bars: all possibilities are considered. You should never need to call this in your code.

Definition at line 820 of file q3scrollview.cpp.

References AlwaysOff, AlwaysOn, Q3ScrollViewData::anyVisibleChildren(), Auto, AutoOne, Q3ScrollViewData::b_marg, changeFrameRect(), Q3ScrollViewData::clipped_viewport, clipper(), contentsHeight(), Q3ScrollViewData::contentsWidth(), contentsWidth(), Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), Q3ScrollViewData::corner, cornerWidget(), d, Q3Frame::frameWidth(), h, QWidget::handle(), Q3ScrollViewData::hbar, QWidget::height(), QSize::height(), QWidget::hide(), Q3ScrollViewData::hMode, horizontalScrollBar(), Q3ScrollViewData::inresize, QWidget::isHidden(), QWidget::isVisible(), Q3ScrollViewData::l_marg, moveContents(), QWidget::parentWidget(), Q3ScrollViewData::policy, Q3ScrollViewData::r_marg, reverse(), right(), QWidget::setGeometry(), setHBarGeometry(), QAbstractSlider::setRange(), QAbstractSlider::setValue(), setVBarGeometry(), QStyle::SH_ScrollView_FrameOnlyAroundContents, QWidget::show(), Q3ScrollViewData::signal_choke, QScrollBar::sizeHint(), QWidget::style(), QStyle::styleHint(), Q3ScrollViewData::t_marg, Q3ScrollViewData::vbar, verticalScrollBar(), Q3ScrollViewData::viewportResized(), viewportResizeEvent(), visibleHeight(), visibleWidth(), Q3ScrollViewData::vMode, w, QSize::width(), QWidget::width(), QWidget::window(), QPoint::x(), QWidget::x(), QPoint::y(), and QWidget::y().

Referenced by fontChange(), frameChanged(), Q3TextEdit::optimAppend(), Q3ScrollView(), resizeEvent(), setCornerWidget(), setHScrollBarMode(), setMargins(), setVisible(), setVScrollBarMode(), styleChange(), and Q3TextEdit::sync().

00821 {
00822     if(!horizontalScrollBar() && !verticalScrollBar())
00823         return;
00824 
00825     // I support this should use viewportSize()... but it needs
00826     // so many of the temporary variables from viewportSize.  hm.
00827     int fw = frameWidth();
00828     int lmarg = fw+d->l_marg;
00829     int rmarg = fw+d->r_marg;
00830     int tmarg = fw+d->t_marg;
00831     int bmarg = fw+d->b_marg;
00832 
00833     int w = width();
00834     int h = height();
00835 
00836     int portw, porth;
00837 
00838     bool needh;
00839     bool needv;
00840     bool showh;
00841     bool showv;
00842     bool showc = false;
00843 
00844     int hsbExt = horizontalScrollBar()->sizeHint().height();
00845     int vsbExt = verticalScrollBar()->sizeHint().width();
00846 
00847     QSize oldVisibleSize(visibleWidth(), visibleHeight());
00848 
00849     if (d->policy != AutoOne || d->anyVisibleChildren()) {
00850         // Do we definitely need the scrollbar?
00851         needh = w-lmarg-rmarg < d->contentsWidth();
00852         if (d->inresize)
00853             needh  = !horizontalScrollBar()->isHidden();
00854         needv = h-tmarg-bmarg < contentsHeight();
00855 
00856         // Do we intend to show the scrollbar?
00857         if (d->hMode == AlwaysOn)
00858             showh = true;
00859         else if (d->hMode == AlwaysOff)
00860             showh = false;
00861         else
00862             showh = needh;
00863 
00864         if (d->vMode == AlwaysOn)
00865             showv = true;
00866         else if (d->vMode == AlwaysOff)
00867             showv = false;
00868         else
00869             showv = needv;
00870 
00871 #ifdef Q_WS_MAC
00872         bool mac_need_scroll = false;
00873         if(!parentWidget()) {
00874             mac_need_scroll = true;
00875         } else {
00876             QWidget *tlw = window();
00877             QPoint tlw_br = QPoint(tlw->width(), tlw->height()),
00878                     my_br = qt_mac_posInWindow(this) + QPoint(w, h);
00879             if(my_br.x() >= tlw_br.x() - 3 && my_br.y() >= tlw_br.y() - 3)
00880                 mac_need_scroll = true;
00881         }
00882         if(mac_need_scroll) {
00883             WindowAttributes attr;
00884             GetWindowAttributes((WindowPtr)handle(), &attr);
00885             mac_need_scroll = (attr & kWindowResizableAttribute);
00886         }
00887         if(mac_need_scroll) {
00888             showc = true;
00889             if(d->vMode == Auto)
00890                 showv = true;
00891             if(d->hMode == Auto)
00892                 showh = true;
00893         }
00894 #endif
00895 
00896         // Given other scrollbar will be shown, NOW do we need one?
00897         if (showh && h-vsbExt-tmarg-bmarg < contentsHeight()) {
00898             needv=true;
00899             if (d->vMode == Auto)
00900                 showv=true;
00901         }
00902         if (showv && !d->inresize && w-hsbExt-lmarg-rmarg < d->contentsWidth()) {
00903             needh=true;
00904             if (d->hMode == Auto)
00905                 showh=true;
00906         }
00907     } else {
00908         // Scrollbars not needed, only show scrollbar that are always on.
00909         needh = needv = false;
00910         showh = d->hMode == AlwaysOn;
00911         showv = d->vMode == AlwaysOn;
00912     }
00913 
00914     bool sc = d->signal_choke;
00915     d->signal_choke=true;
00916 
00917     // Hide unneeded scrollbar, calculate viewport size
00918     if (showh) {
00919         porth=h-hsbExt-tmarg-bmarg;
00920     } else {
00921         if (!needh)
00922             d->hbar->setValue(0);
00923         d->hbar->hide();
00924         porth=h-tmarg-bmarg;
00925     }
00926     if (showv) {
00927         portw=w-vsbExt-lmarg-rmarg;
00928     } else {
00929         if (!needv)
00930             d->vbar->setValue(0);
00931         d->vbar->hide();
00932         portw=w-lmarg-rmarg;
00933     }
00934 
00935     // Configure scrollbars that we will show
00936     if (needv) {
00937         d->vbar->setRange(0, contentsHeight()-porth);
00938         d->vbar->setSteps(Q3ScrollView::d->vbar->lineStep(), porth);
00939     } else {
00940         d->vbar->setRange(0, 0);
00941     }
00942     if (needh) {
00943         d->hbar->setRange(0, QMAX(0, d->contentsWidth()-portw));
00944         d->hbar->setSteps(Q3ScrollView::d->hbar->lineStep(), portw);
00945     } else {
00946         d->hbar->setRange(0, 0);
00947     }
00948 
00949     // Position the scrollbars, viewport and corner widget.
00950     int bottom;
00951     bool reverse = QApplication::reverseLayout();
00952     int xoffset = (reverse && (showv || cornerWidget())) ? vsbExt : 0;
00953     int xpos = reverse ? 0 : w - vsbExt;
00954     bool frameContentsOnly =
00955         style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents);
00956 
00957     if(! frameContentsOnly) {
00958         if (reverse)
00959             xpos += fw;
00960         else
00961             xpos -= fw;
00962     }
00963     if (showh) {
00964         int right = (showc || showv || cornerWidget()) ? w-vsbExt : w;
00965         if (! frameContentsOnly)
00966             setHBarGeometry(*d->hbar, fw + xoffset, h-hsbExt-fw,
00967                              right-fw-fw, hsbExt);
00968         else
00969             setHBarGeometry(*d->hbar, 0 + xoffset, h-hsbExt, right,
00970                              hsbExt);
00971         bottom=h-hsbExt;
00972     } else {
00973         bottom=h;
00974     }
00975     if (showv) {
00976         clipper()->setGeometry(lmarg + xoffset, tmarg,
00977                                 w-vsbExt-lmarg-rmarg,
00978                                 bottom-tmarg-bmarg);
00979         d->viewportResized(w-vsbExt-lmarg-rmarg, bottom-tmarg-bmarg);
00980         if (! frameContentsOnly)
00981             changeFrameRect(QRect(0, 0, w, h));
00982         else
00983             changeFrameRect(QRect(xoffset, 0, w-vsbExt, bottom));
00984         if (showc || cornerWidget()) {
00985             if (! frameContentsOnly)
00986                 setVBarGeometry(*d->vbar, xpos,
00987                                  fw, vsbExt,
00988                                  h-hsbExt-fw-fw);
00989             else
00990                 setVBarGeometry(*d->vbar, xpos, 0,
00991                                  vsbExt,
00992                                  h-hsbExt);
00993         }
00994         else {
00995             if (! frameContentsOnly)
00996                 setVBarGeometry(*d->vbar, xpos,
00997                                  fw, vsbExt,
00998                                  bottom-fw-fw);
00999             else
01000                 setVBarGeometry(*d->vbar, xpos, 0,
01001                                  vsbExt, bottom);
01002         }
01003     } else {
01004         if (! frameContentsOnly)
01005             changeFrameRect(QRect(0, 0, w, h));
01006         else
01007             changeFrameRect(QRect(0, 0, w, bottom));
01008         clipper()->setGeometry(lmarg, tmarg,
01009                                 w-lmarg-rmarg, bottom-tmarg-bmarg);
01010         d->viewportResized(w-lmarg-rmarg, bottom-tmarg-bmarg);
01011     }
01012 
01013     QWidget *corner = d->corner;
01014     if (d->corner) {
01015         if (! frameContentsOnly)
01016             corner->setGeometry(xpos,
01017                                 h-hsbExt-fw,
01018                                 vsbExt,
01019                                 hsbExt);
01020         else
01021             corner->setGeometry(xpos,
01022                                 h-hsbExt,
01023                                 vsbExt,
01024                                 hsbExt);
01025     }
01026 
01027     d->signal_choke=sc;
01028 
01029     if (d->contentsX()+visibleWidth() > d->contentsWidth()) {
01030         int x;
01031 #if 0
01032         if (reverse)
01033             x =QMIN(0,d->contentsWidth()-visibleWidth());
01034         else
01035 #endif
01036             x =QMAX(0,d->contentsWidth()-visibleWidth());
01037         d->hbar->setValue(x);
01038         // Do it even if it is recursive
01039         moveContents(-x, -d->contentsY());
01040     }
01041     if (d->contentsY()+visibleHeight() > contentsHeight()) {
01042         int y=QMAX(0,contentsHeight()-visibleHeight());
01043         d->vbar->setValue(y);
01044         // Do it even if it is recursive
01045         moveContents(-d->contentsX(), -y);
01046     }
01047 
01048     // Finally, show the scroll bars
01049     if (showh && (d->hbar->isHidden() || !d->hbar->isVisible()))
01050         d->hbar->show();
01051     if (showv && (d->vbar->isHidden() || !d->vbar->isVisible()))
01052         d->vbar->show();
01053 
01054     d->signal_choke=true;
01055     d->vbar->setValue(d->contentsY());
01056     d->hbar->setValue(d->contentsX());
01057     d->signal_choke=false;
01058 
01059     QSize newVisibleSize(visibleWidth(), visibleHeight());
01060     if (d->clipped_viewport && oldVisibleSize != newVisibleSize) {
01061         QResizeEvent e(newVisibleSize, oldVisibleSize);
01062         viewportResizeEvent(&e);
01063     }
01064 }

void Q3ScrollView::setEnabled ( bool  enable  )  [slot]

Reimplemented from QWidget.

Definition at line 1325 of file q3scrollview.cpp.

References QWidget::setEnabled().

Referenced by Q3Table::setEnabled().

01326 {
01327     Q3Frame::setEnabled(enable);
01328 }

void Q3ScrollView::drawContents ( QPainter p,
int  clipx,
int  clipy,
int  clipw,
int  cliph 
) [protected, virtual]

Reimplement this function if you are viewing a drawing area rather than a widget.

The function should draw the rectangle (clipx, clipy, clipw, cliph) of the contents using painter p. The clip rectangle is in the scrollview's coordinates.

For example:

    {
        // Fill a 40000 by 50000 rectangle at (100000,150000)

        // Calculate the coordinates...
        int x1 = 100000, y1 = 150000;
        int x2 = x1+40000-1, y2 = y1+50000-1;

        // Clip the coordinates so X/Windows will not have problems...
        if (x1 < clipx) x1=clipx;
        if (y1 < clipy) y1=clipy;
        if (x2 > clipx+clipw-1) x2=clipx+clipw-1;
        if (y2 > clipy+cliph-1) y2=clipy+cliph-1;

        // Paint using the small coordinates...
        if (x2 >= x1 && y2 >= y1)
            p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red);
    }

The clip rectangle and translation of the painter p is already set appropriately.

Definition at line 2352 of file q3scrollview.cpp.

Referenced by drawContentsOffset().

02353 {
02354 }

void Q3ScrollView::drawContentsOffset ( QPainter p,
int  offsetx,
int  offsety,
int  clipx,
int  clipy,
int  clipw,
int  cliph 
) [protected, virtual]

For backward-compatibility only. It is easier to use drawContents(QPainter*,int,int,int,int).

The default implementation translates the painter appropriately and calls drawContents(QPainter*,int,int,int,int). See drawContents() for an explanation of the parameters p, offsetx, offsety, clipx, clipy, clipw and cliph.

Definition at line 2312 of file q3scrollview.cpp.

References drawContents(), and p.

Referenced by viewportPaintEvent().

02313 {
02314     p->translate(-offsetx,-offsety);
02315     drawContents(p, clipx, clipy, clipw, cliph);
02316 }

Here is the call graph for this function:

void Q3ScrollView::contentsMousePressEvent ( QMouseEvent e  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a mousePressEvent(): the press position in e is translated to be a point on the contents.

Definition at line 1545 of file q3scrollview.cpp.

References QEvent::ignore().

Referenced by contentsMouseDoubleClickEvent(), and viewportMousePressEvent().

01546 {
01547     e->ignore();
01548 }

Here is the call graph for this function:

void Q3ScrollView::contentsMouseReleaseEvent ( QMouseEvent e  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a mouseReleaseEvent(): the release position in e is translated to be a point on the contents.

Definition at line 1555 of file q3scrollview.cpp.

References QEvent::ignore().

Referenced by viewportMouseReleaseEvent().

01556 {
01557     e->ignore();
01558 }

Here is the call graph for this function:

void Q3ScrollView::contentsMouseDoubleClickEvent ( QMouseEvent e  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a mouseDoubleClickEvent(): the click position in e is translated to be a point on the contents.

The default implementation generates a normal mouse press event.

Definition at line 1567 of file q3scrollview.cpp.

References contentsMousePressEvent().

Referenced by viewportMouseDoubleClickEvent().

01568 {
01569     contentsMousePressEvent(e);             // try mouse press event
01570 }

Here is the call graph for this function:

void Q3ScrollView::contentsMouseMoveEvent ( QMouseEvent e  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a mouseMoveEvent(): the mouse position in e is translated to be a point on the contents.

Definition at line 1577 of file q3scrollview.cpp.

References QEvent::ignore().

Referenced by viewportMouseMoveEvent().

01578 {
01579     e->ignore();
01580 }

Here is the call graph for this function:

void Q3ScrollView::contentsDragEnterEvent ( QDragEnterEvent  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a dragEnterEvent(): the drag position is translated to be a point on the contents.

The default implementation does nothing. The event parameter is ignored.

Definition at line 1592 of file q3scrollview.cpp.

Referenced by viewportDragEnterEvent().

01593 {
01594 }

void Q3ScrollView::contentsDragMoveEvent ( QDragMoveEvent  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a dragMoveEvent(): the drag position is translated to be a point on the contents.

The default implementation does nothing. The event parameter is ignored.

Definition at line 1604 of file q3scrollview.cpp.

Referenced by viewportDragMoveEvent().

01605 {
01606 }

void Q3ScrollView::contentsDragLeaveEvent ( QDragLeaveEvent  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a dragLeaveEvent(): the drag position is translated to be a point on the contents.

The default implementation does nothing. The event parameter is ignored.

Definition at line 1616 of file q3scrollview.cpp.

Referenced by viewportDragLeaveEvent().

01617 {
01618 }

void Q3ScrollView::contentsDropEvent ( QDropEvent  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a dropEvent(): the drop position is translated to be a point on the contents.

The default implementation does nothing. The event parameter is ignored.

Definition at line 1629 of file q3scrollview.cpp.

Referenced by viewportDropEvent().

01630 {
01631 }

void Q3ScrollView::contentsWheelEvent ( QWheelEvent e  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a wheelEvent() in {e}: the mouse position is translated to be a point on the contents.

Definition at line 1641 of file q3scrollview.cpp.

References QEvent::ignore().

Referenced by Q3TextEdit::contentsWheelEvent(), and viewportWheelEvent().

01642 {
01643     e->ignore();
01644 }

Here is the call graph for this function:

void Q3ScrollView::contentsContextMenuEvent ( QContextMenuEvent e  )  [protected, virtual]

This event handler is called whenever the Q3ScrollView receives a contextMenuEvent() in {e}: the mouse position is translated to be a point on the contents.

Definition at line 1651 of file q3scrollview.cpp.

References QEvent::ignore().

Referenced by viewportContextMenuEvent().

01652 {
01653     e->ignore();
01654 }

Here is the call graph for this function:

void Q3ScrollView::viewportPaintEvent ( QPaintEvent pe  )  [protected, virtual]

This is a low-level painting routine that draws the viewport contents. Reimplement this if drawContents() is too high-level (for example, if you don't want to open a QPainter on the viewport). The paint event is passed in pe.

Definition at line 1662 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, Q3ScrollViewData::contentsX(), Q3ScrollViewData::contentsY(), d, drawContentsOffset(), QWidget::height(), QRect::height(), p, QPaintEvent::rect(), QWidget::rect(), viewport(), Q3ScrollViewData::viewport, QRect::width(), QWidget::width(), QRect::x(), QWidget::x(), QRect::y(), and QWidget::y().

Referenced by Q3IconView::eventFilter(), and eventFilter().

01663 {
01664     QWidget* vp = viewport();
01665 
01666     QPainter p(vp);
01667     QRect r = pe->rect();
01668 
01669     if (d->clipped_viewport) {
01670         QRect rr(
01671             -d->clipped_viewport->x(), -d->clipped_viewport->y(),
01672             d->viewport->width(), d->viewport->height()
01673            );
01674         r &= rr;
01675         if (r.isValid()) {
01676             int ex = r.x() + d->clipped_viewport->x() + d->contentsX();
01677             int ey = r.y() + d->clipped_viewport->y() + d->contentsY();
01678             int ew = r.width();
01679             int eh = r.height();
01680             drawContentsOffset(&p,
01681                 d->contentsX()+d->clipped_viewport->x(),
01682                 d->contentsY()+d->clipped_viewport->y(),
01683                 ex, ey, ew, eh);
01684         }
01685     } else {
01686         r &= d->viewport->rect();
01687         int ex = r.x() + d->contentsX();
01688         int ey = r.y() + d->contentsY();
01689         int ew = r.width();
01690         int eh = r.height();
01691         drawContentsOffset(&p, d->contentsX(), d->contentsY(), ex, ey, ew, eh);
01692     }
01693 }

Here is the call graph for this function:

void Q3ScrollView::viewportResizeEvent ( QResizeEvent  )  [protected, virtual]

To provide simple processing of events on the contents, this function receives all resize events sent to the viewport.

The default implementation does nothing. The event parameter is ignored.

See also:
QWidget::resizeEvent()

Definition at line 1705 of file q3scrollview.cpp.

Referenced by eventFilter(), updateScrollBars(), Q3ListView::viewportResizeEvent(), Q3TextEdit::viewportResizeEvent(), and Q3Table::viewportResizeEvent().

01706 {
01707 }

void Q3ScrollView::viewportMousePressEvent ( QMouseEvent  )  [protected, virtual]

Definition at line 1717 of file q3scrollview.cpp.

References QMouseEvent::button(), contentsMousePressEvent(), QMouseEvent::globalPos(), QEvent::ignore(), QMouseEvent::pos(), QEvent::type(), and viewportToContents().

Referenced by eventFilter(), QFileListBox::viewportMousePressEvent(), and Q3FileDialogQFileListView::viewportMousePressEvent().

01718 {
01719     QMouseEvent ce(e->type(), viewportToContents(e->pos()),
01720         e->globalPos(), e->button(), e->state());
01721     contentsMousePressEvent(&ce);
01722     if (!ce.isAccepted())
01723         e->ignore();
01724 }

Here is the call graph for this function:

void Q3ScrollView::viewportMouseReleaseEvent ( QMouseEvent  )  [protected, virtual]

Definition at line 1734 of file q3scrollview.cpp.

References QMouseEvent::button(), contentsMouseReleaseEvent(), QMouseEvent::globalPos(), QEvent::ignore(), QMouseEvent::pos(), QEvent::type(), and viewportToContents().

Referenced by eventFilter(), Q3FileDialogQFileListView::viewportMouseReleaseEvent(), and QFileListBox::viewportMouseReleaseEvent().

01735 {
01736     QMouseEvent ce(e->type(), viewportToContents(e->pos()),
01737         e->globalPos(), e->button(), e->state());
01738     contentsMouseReleaseEvent(&ce);
01739     if (!ce.isAccepted())
01740         e->ignore();
01741 }

Here is the call graph for this function:

void Q3ScrollView::viewportMouseDoubleClickEvent ( QMouseEvent  )  [protected, virtual]

Definition at line 1751 of file q3scrollview.cpp.

References QMouseEvent::button(), contentsMouseDoubleClickEvent(), QMouseEvent::globalPos(), QEvent::ignore(), QMouseEvent::pos(), QEvent::type(), and viewportToContents().

Referenced by eventFilter(), Q3FileDialogQFileListView::viewportMouseDoubleClickEvent(), and QFileListBox::viewportMouseDoubleClickEvent().

01752 {
01753     QMouseEvent ce(e->type(), viewportToContents(e->pos()),
01754         e->globalPos(), e->button(), e->state());
01755     contentsMouseDoubleClickEvent(&ce);
01756     if (!ce.isAccepted())
01757         e->ignore();
01758 }

Here is the call graph for this function:

void Q3ScrollView::viewportMouseMoveEvent ( QMouseEvent  )  [protected, virtual]

Definition at line 1768 of file q3scrollview.cpp.

References QMouseEvent::button(), contentsMouseMoveEvent(), QMouseEvent::globalPos(), QEvent::ignore(), QMouseEvent::pos(), QEvent::type(), and viewportToContents().

Referenced by Q3ListView::eventFilter(), eventFilter(), and QFileListBox::viewportMouseMoveEvent().

01769 {
01770     QMouseEvent ce(e->type(), viewportToContents(e->pos()),
01771         e->globalPos(), e->button(), e->state());
01772     contentsMouseMoveEvent(&ce);
01773     if (!ce.isAccepted())
01774         e->ignore();
01775 }

Here is the call graph for this function:

void Q3ScrollView::viewportDragEnterEvent ( QDragEnterEvent  )  [protected, virtual]

Definition at line 1787 of file q3scrollview.cpp.

References contentsDragEnterEvent(), contentsToViewport(), QDropEvent::pos(), and viewportToContents().

Referenced by eventFilter().

01788 {
01789     e->setPoint(viewportToContents(e->pos()));
01790     contentsDragEnterEvent(e);
01791     e->setPoint(contentsToViewport(e->pos()));
01792 }

Here is the call graph for this function:

void Q3ScrollView::viewportDragMoveEvent ( QDragMoveEvent  )  [protected, virtual]

Definition at line 1802 of file q3scrollview.cpp.

References contentsDragMoveEvent(), contentsToViewport(), QDropEvent::pos(), and viewportToContents().

Referenced by eventFilter().

01803 {
01804     e->setPoint(viewportToContents(e->pos()));
01805     contentsDragMoveEvent(e);
01806     e->setPoint(contentsToViewport(e->pos()));
01807 }

Here is the call graph for this function:

void Q3ScrollView::viewportDragLeaveEvent ( QDragLeaveEvent  )  [protected, virtual]

Definition at line 1817 of file q3scrollview.cpp.

References contentsDragLeaveEvent().

Referenced by eventFilter().

01818 {
01819     contentsDragLeaveEvent(e);
01820 }

Here is the call graph for this function:

void Q3ScrollView::viewportDropEvent ( QDropEvent  )  [protected, virtual]

Definition at line 1830 of file q3scrollview.cpp.

References contentsDropEvent(), contentsToViewport(), QDropEvent::pos(), and viewportToContents().

Referenced by eventFilter().

01831 {
01832     e->setPoint(viewportToContents(e->pos()));
01833     contentsDropEvent(e);
01834     e->setPoint(contentsToViewport(e->pos()));
01835 }

Here is the call graph for this function:

void Q3ScrollView::viewportWheelEvent ( QWheelEvent  )  [protected, virtual]

Definition at line 1848 of file q3scrollview.cpp.

References QEvent::accept(), contentsWheelEvent(), QWheelEvent::delta(), QWheelEvent::globalPos(), QEvent::ignore(), QWheelEvent::pos(), and viewportToContents().

Referenced by wheelEvent().

01849 {
01850     /*
01851        Different than standard mouse events, because wheel events might
01852        be sent to the focus widget if the widget-under-mouse doesn't want
01853        the event itself.
01854     */
01855     QWheelEvent ce(viewportToContents(e->pos()),
01856         e->globalPos(), e->delta(), e->state());
01857     contentsWheelEvent(&ce);
01858     if (ce.isAccepted())
01859         e->accept();
01860     else
01861         e->ignore();
01862 }

Here is the call graph for this function:

void Q3ScrollView::viewportContextMenuEvent ( QContextMenuEvent  )  [protected, virtual]

Definition at line 1871 of file q3scrollview.cpp.

References QEvent::accept(), contentsContextMenuEvent(), QContextMenuEvent::globalPos(), QEvent::ignore(), QContextMenuEvent::pos(), QContextMenuEvent::reason(), and viewportToContents().

Referenced by contextMenuEvent(), and eventFilter().

01872 {
01873     QContextMenuEvent ce(e->reason(), viewportToContents(e->pos()), e->globalPos(), e->state());
01874     contentsContextMenuEvent(&ce);
01875     if (ce.isAccepted())
01876         e->accept();
01877     else
01878         e->ignore();
01879 }

Here is the call graph for this function:

void Q3ScrollView::frameChanged (  )  [protected, virtual]

Reimplemented from Q3Frame.

Definition at line 2360 of file q3scrollview.cpp.

References Q3Frame::frameChanged(), and updateScrollBars().

02361 {
02362     // slight ugle-hack - the listview header needs readjusting when
02363     // changing the frame
02364     if (Q3ListView *lv = qobject_cast<Q3ListView *>(this))
02365         lv->triggerUpdate();
02366     Q3Frame::frameChanged();
02367     updateScrollBars();
02368 }

Here is the call graph for this function:

void Q3ScrollView::setMargins ( int  left,
int  top,
int  right,
int  bottom 
) [virtual]

Sets the margins around the scrolling area to left, top, right and bottom. This is useful for applications such as spreadsheets with "locked" rows and columns. The marginal space is inside the frameRect() and is left blank; reimplement drawFrame() or put widgets in the unused area.

By default all margins are zero.

See also:
frameChanged()

Definition at line 2444 of file q3scrollview.cpp.

References Q3ScrollViewData::b_marg, d, Q3ScrollViewData::l_marg, Q3ScrollViewData::r_marg, Q3ScrollViewData::t_marg, and updateScrollBars().

Referenced by Q3Table::init(), Q3Table::setLeftMargin(), Q3Table::setTopMargin(), and Q3ListView::updateGeometries().

02445 {
02446     if (left == d->l_marg &&
02447          top == d->t_marg &&
02448          right == d->r_marg &&
02449          bottom == d->b_marg)
02450         return;
02451 
02452     d->l_marg = left;
02453     d->t_marg = top;
02454     d->r_marg = right;
02455     d->b_marg = bottom;
02456     updateScrollBars();
02457 }

int Q3ScrollView::leftMargin (  )  const

Returns the left margin.

See also:
setMargins()

Definition at line 2465 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::l_marg.

Referenced by Q3Table::inputMethodQuery(), Q3Table::insertRows(), Q3TableHeader::sectionLabelChanged(), Q3Table::setLeftMargin(), and Q3Table::setTopMargin().

02466 {
02467     return d->l_marg;
02468 }

int Q3ScrollView::topMargin (  )  const

Returns the top margin.

See also:
setMargins()

Definition at line 2476 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::t_marg.

Referenced by Q3Table::inputMethodQuery(), Q3Table::insertColumns(), Q3Table::paintEvent(), Q3TableHeader::sectionLabelChanged(), Q3Table::setLeftMargin(), Q3Table::sizeHint(), and Q3Table::updateGeometries().

02477 {
02478     return d->t_marg;
02479 }

int Q3ScrollView::rightMargin (  )  const

Returns the right margin.

See also:
setMargins()

Definition at line 2487 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::r_marg.

Referenced by Q3TableHeader::sectionLabelChanged(), Q3Table::setLeftMargin(), and Q3Table::setTopMargin().

02488 {
02489     return d->r_marg;
02490 }

int Q3ScrollView::bottomMargin (  )  const

Returns the bottom margin.

See also:
setMargins()

Definition at line 2498 of file q3scrollview.cpp.

References Q3ScrollViewData::b_marg, and d.

Referenced by Q3Table::setLeftMargin(), and Q3Table::setTopMargin().

02499 {
02500     return d->b_marg;
02501 }

bool Q3ScrollView::focusNextPrevChild ( bool  next  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 2506 of file q3scrollview.cpp.

References Q3ScrollViewData::ancestorRec(), QSVChildRec::child, d, ensureVisible(), QWidget::focusNextPrevChild(), QWidget::focusWidget(), QWidget::isAncestorOf(), QWidget::mapToGlobal(), w, QWidget::window(), QPoint::x(), QSVChildRec::x, QPoint::y(), and QSVChildRec::y.

02507 {
02508     //  Makes sure that the new focus widget is on-screen, if
02509     //  necessary by scrolling the scroll view.
02510     bool retval = Q3Frame::focusNextPrevChild(next);
02511     if (retval) {
02512         QWidget *w = window()->focusWidget();
02513         if (isAncestorOf(w)) {
02514             QSVChildRec *r = d->ancestorRec(w);
02515            if (r && (r->child == w || w->isVisibleTo(r->child))) {
02516                 QPoint cp = r->child->mapToGlobal(QPoint(0, 0));
02517                 QPoint cr = w->mapToGlobal(QPoint(0, 0)) - cp;
02518                 ensureVisible(r->x + cr.x() + w->width()/2, r->y + cr.y() + w->height()/2,
02519                               w->width()/2, w->height()/2);
02520             }
02521         }
02522     }
02523     return retval;
02524 }

Here is the call graph for this function:

void Q3ScrollView::setHBarGeometry ( QScrollBar hbar,
int  x,
int  y,
int  w,
int  h 
) [protected, virtual]

Called when the horizontal scroll bar geometry changes. This is provided as a protected function so that subclasses can do interesting things such as providing extra buttons in some of the space normally used by the scroll bars.

The default implementation simply gives all the space to hbar. The new geometry is given by x, y, w and h.

See also:
setVBarGeometry()

Definition at line 722 of file q3scrollview.cpp.

References QWidget::setGeometry().

Referenced by updateScrollBars().

00724 {
00725     hbar.setGeometry(x, y, w, h);
00726 }

Here is the call graph for this function:

void Q3ScrollView::setVBarGeometry ( QScrollBar vbar,
int  x,
int  y,
int  w,
int  h 
) [protected, virtual]

Called when the vertical scroll bar geometry changes. This is provided as a protected function so that subclasses can do interesting things such as providing extra buttons in some of the space normally used by the scroll bars.

The default implementation simply gives all the space to vbar. The new geometry is given by x, y, w and h.

See also:
setHBarGeometry()

Definition at line 739 of file q3scrollview.cpp.

References QWidget::setGeometry().

Referenced by updateScrollBars().

00741 {
00742     vbar.setGeometry(x, y, w, h);
00743 }

Here is the call graph for this function:

void Q3ScrollView::resizeEvent ( QResizeEvent event  )  [protected, virtual]

Reimplemented from Q3Frame.

Definition at line 1100 of file q3scrollview.cpp.

References d, QFrame::event(), Q3ScrollViewData::fake_scroll, Q3ScrollViewData::hideOrShowAll(), Q3ScrollViewData::inresize, Q3Frame::resizeEvent(), Q3ScrollViewData::scrollbar_timer, scrollBy(), QTimer::start(), and updateScrollBars().

Referenced by Q3ListView::resizeEvent(), Q3DataTable::resizeEvent(), Q3ListBox::resizeEvent(), Q3IconView::resizeEvent(), and Q3TextEdit::resizeEvent().

01101 {
01102     Q3Frame::resizeEvent(event);
01103 
01104 #if 0
01105     if (QApplication::reverseLayout()) {
01106         d->fake_scroll = true;
01107         scrollBy(-event->size().width() + event->oldSize().width(), 0);
01108         d->fake_scroll = false;
01109     }
01110 #endif
01111 
01112     bool inresize = d->inresize;
01113     d->inresize = true;
01114     updateScrollBars();
01115     d->inresize = inresize;
01116     d->scrollbar_timer.start(0, true);
01117 
01118     d->hideOrShowAll(this);
01119 }

Here is the call graph for this function:

void Q3ScrollView::mousePressEvent ( QMouseEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 1126 of file q3scrollview.cpp.

References QEvent::ignore().

01127 {
01128     e->ignore();
01129 }

Here is the call graph for this function:

void Q3ScrollView::mouseReleaseEvent ( QMouseEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 1134 of file q3scrollview.cpp.

References QEvent::ignore().

01135 {
01136     e->ignore();
01137 }

Here is the call graph for this function:

void Q3ScrollView::mouseDoubleClickEvent ( QMouseEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 1143 of file q3scrollview.cpp.

References QEvent::ignore().

01144 {
01145     e->ignore();
01146 }

Here is the call graph for this function:

void Q3ScrollView::mouseMoveEvent ( QMouseEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 1151 of file q3scrollview.cpp.

References QEvent::ignore().

01152 {
01153     e->ignore();
01154 }

Here is the call graph for this function:

void Q3ScrollView::wheelEvent ( QWheelEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 1160 of file q3scrollview.cpp.

References QEvent::accept(), QWheelEvent::delta(), QScrollBar::event(), QWheelEvent::globalPos(), Qt::Horizontal, horizontalScrollBar(), QWidget::mapFromGlobal(), QWheelEvent::orientation(), Qt::Vertical, verticalScrollBar(), viewport(), and viewportWheelEvent().

01161 {
01162     QWheelEvent ce(viewport()->mapFromGlobal(e->globalPos()),
01163                     e->globalPos(), e->delta(), e->state());
01164     viewportWheelEvent(&ce);
01165     if (!ce.isAccepted()) {
01166         if (e->orientation() == Horizontal && horizontalScrollBar())
01167             horizontalScrollBar()->event(e);
01168         else  if (e->orientation() == Vertical && verticalScrollBar())
01169             verticalScrollBar()->event(e);
01170     } else {
01171         e->accept();
01172     }
01173 }

Here is the call graph for this function:

void Q3ScrollView::contextMenuEvent ( QContextMenuEvent e  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 1179 of file q3scrollview.cpp.

References QEvent::accept(), QContextMenuEvent::globalPos(), QEvent::ignore(), QContextMenuEvent::Keyboard, QWidget::mapFromGlobal(), QContextMenuEvent::reason(), viewport(), and viewportContextMenuEvent().

01180 {
01181     if (e->reason() != QContextMenuEvent::Keyboard) {
01182         e->ignore();
01183         return;
01184     }
01185 
01186     QContextMenuEvent ce(e->reason(), viewport()->mapFromGlobal(e->globalPos()),
01187                           e->globalPos(), e->state());
01188     viewportContextMenuEvent(&ce);
01189     if (ce.isAccepted())
01190         e->accept();
01191     else
01192         e->ignore();
01193 }

Here is the call graph for this function:

bool Q3ScrollView::eventFilter ( QObject obj,
QEvent e 
) [protected, virtual]

This event filter ensures the scroll bars are updated when a single contents widget is resized, shown, hidden or destroyed; it passes mouse events to the Q3ScrollView. The event is in e and the object is in obj.

Reimplemented from QObject.

Definition at line 1456 of file q3scrollview.cpp.

References Q3ScrollViewData::autoMove(), Q3ScrollViewData::autoResize(), Q3ScrollViewData::autoResizeHint(), autoscroll_margin, QEvent::ChildRemoved, Q3ScrollViewData::clipped_viewport, QRect::contains(), QEvent::ContextMenu, d, Q3ScrollViewData::drag_autoscroll, QEvent::DragEnter, QEvent::DragLeave, QEvent::DragMove, QEvent::Drop, QObject::eventFilter(), QEvent::MouseButtonDblClick, QEvent::MouseButtonPress, QEvent::MouseButtonRelease, QEvent::MouseMove, QEvent::Move, QEvent::Paint, Q3ScrollViewData::rec(), removeChild(), QEvent::Resize, startDragAutoScroll(), stopDragAutoScroll(), QEvent::type(), Q3ScrollViewData::viewport, viewportContextMenuEvent(), viewportDragEnterEvent(), viewportDragLeaveEvent(), viewportDragMoveEvent(), viewportDropEvent(), viewportMouseDoubleClickEvent(), viewportMouseMoveEvent(), viewportMousePressEvent(), viewportMouseReleaseEvent(), viewportPaintEvent(), viewportResizeEvent(), visibleHeight(), and visibleWidth().

Referenced by Q3IconView::eventFilter(), Q3Table::eventFilter(), Q3ListBox::eventFilter(), Q3TextEdit::eventFilter(), and Q3ListView::eventFilter().

01457 {
01458     if (!d)
01459         return false; // we are destructing
01460     if (obj == d->viewport || obj == d->clipped_viewport) {
01461         switch (e->type()) {
01462             /* Forward many events to viewport...() functions */
01463         case QEvent::Paint:
01464             viewportPaintEvent((QPaintEvent*)e);
01465             break;
01466         case QEvent::Resize:
01467             if (!d->clipped_viewport)
01468                 viewportResizeEvent((QResizeEvent *)e);
01469             break;
01470         case QEvent::MouseButtonPress:
01471             viewportMousePressEvent((QMouseEvent*)e);
01472             if (((QMouseEvent*)e)->isAccepted())
01473                 return true;
01474             break;
01475         case QEvent::MouseButtonRelease:
01476             viewportMouseReleaseEvent((QMouseEvent*)e);
01477             if (((QMouseEvent*)e)->isAccepted())
01478                 return true;
01479             break;
01480         case QEvent::MouseButtonDblClick:
01481             viewportMouseDoubleClickEvent((QMouseEvent*)e);
01482             if (((QMouseEvent*)e)->isAccepted())
01483                 return true;
01484             break;
01485         case QEvent::MouseMove:
01486             viewportMouseMoveEvent((QMouseEvent*)e);
01487             if (((QMouseEvent*)e)->isAccepted())
01488                 return true;
01489             break;
01490 #ifndef QT_NO_DRAGANDDROP
01491         case QEvent::DragEnter:
01492             viewportDragEnterEvent((QDragEnterEvent*)e);
01493             break;
01494         case QEvent::DragMove: {
01495             if (d->drag_autoscroll) {
01496                 QPoint vp = ((QDragMoveEvent*) e)->pos();
01497                 QRect inside_margin(autoscroll_margin, autoscroll_margin,
01498                                      visibleWidth() - autoscroll_margin * 2,
01499                                      visibleHeight() - autoscroll_margin * 2);
01500                 if (!inside_margin.contains(vp)) {
01501                     startDragAutoScroll();
01502                     // Keep sending move events
01503                     ((QDragMoveEvent*)e)->accept(QRect(0,0,0,0));
01504                 }
01505             }
01506             viewportDragMoveEvent((QDragMoveEvent*)e);
01507         } break;
01508         case QEvent::DragLeave:
01509             stopDragAutoScroll();
01510             viewportDragLeaveEvent((QDragLeaveEvent*)e);
01511             break;
01512         case QEvent::Drop:
01513             stopDragAutoScroll();
01514             viewportDropEvent((QDropEvent*)e);
01515             break;
01516 #endif // QT_NO_DRAGANDDROP
01517         case QEvent::ContextMenu:
01518             viewportContextMenuEvent((QContextMenuEvent*)e);
01519             if (((QContextMenuEvent*)e)->isAccepted())
01520                 return true;
01521             break;
01522         case QEvent::ChildRemoved:
01523             removeChild((QWidget*)((QChildEvent*)e)->child());
01524             break;
01525         case QEvent::LayoutHint:
01526             d->autoResizeHint(this);
01527             break;
01528         default:
01529             break;
01530         }
01531     } else if (d && d->rec((QWidget*)obj)) {  // must be a child
01532         if (e->type() == QEvent::Resize)
01533             d->autoResize(this);
01534         else if (e->type() == QEvent::Move)
01535             d->autoMove(this);
01536     }
01537     return Q3Frame::eventFilter(obj, e);  // always continue with standard event processing
01538 }

Here is the call graph for this function:

void Q3ScrollView::setCachedSizeHint ( const QSize sh  )  const [protected]

Definition at line 2778 of file q3scrollview.cpp.

References Q3ScrollViewData::cachedSizeHint, d, QSize::isValid(), and QWidget::isVisible().

Referenced by Q3Table::sizeHint(), Q3ListBox::sizeHint(), and Q3ListView::sizeHint().

02779 {
02780     if (isVisible() && !d->cachedSizeHint.isValid())
02781         d->cachedSizeHint = sh;
02782 }

Here is the call graph for this function:

QSize Q3ScrollView::cachedSizeHint (  )  const [protected]

Definition at line 2793 of file q3scrollview.cpp.

References Q3ScrollViewData::cachedSizeHint, d, and Q3ScrollViewData::use_cached_size_hint.

Referenced by Q3Table::sizeHint(), Q3ListBox::sizeHint(), and Q3ListView::sizeHint().

02794 {
02795     return d->use_cached_size_hint ? d->cachedSizeHint : QSize();
02796 }

void Q3ScrollView::fontChange ( const QFont old  )  [protected, virtual]

Reimplemented from QWidget.

Definition at line 688 of file q3scrollview.cpp.

References Q3ScrollViewData::cachedSizeHint, d, QWidget::fontChange(), and updateScrollBars().

Referenced by Q3Table::setNumCols(), and Q3Table::setNumRows().

00689 {
00690     QWidget::fontChange(old);
00691     updateScrollBars();
00692     d->cachedSizeHint = QSize();
00693 }

Here is the call graph for this function:

void Q3ScrollView::drawContents ( QPainter  )  [private, virtual]

(Implemented to get rid of a compiler warning.)

Reimplemented from Q3Frame.

Definition at line 2692 of file q3scrollview.cpp.

02693 {
02694 }

void Q3ScrollView::moveContents ( int  x,
int  y 
) [private]

Moves the contents by (x, y).

Definition at line 2043 of file q3scrollview.cpp.

References Q3ScrollViewData::clipped_viewport, clipper(), contentsHeight(), contentsMoving(), Q3ScrollViewData::contentsWidth(), d, emit, Q3ScrollViewData::fake_scroll, Q3ScrollViewData::hideOrShowAll(), Q3ScrollViewData::moveAllBy(), QWidget::scroll(), Q3ScrollViewData::static_bg, QWidget::update(), QWidget::updatesEnabled(), viewport(), visibleHeight(), visibleWidth(), Q3ScrollViewData::vx, and Q3ScrollViewData::vy.

Referenced by hslide(), setContentsPos(), updateScrollBars(), and vslide().

02044 {
02045     if (-x+visibleWidth() > d->contentsWidth())
02046 #if 0
02047         if(QApplication::reverseLayout())
02048             x=QMAX(0,-d->contentsWidth()+visibleWidth());
02049         else
02050 #endif
02051             x=QMIN(0,-d->contentsWidth()+visibleWidth());
02052     if (-y+visibleHeight() > contentsHeight())
02053         y=QMIN(0,-contentsHeight()+visibleHeight());
02054 
02055     int dx = x - d->vx;
02056     int dy = y - d->vy;
02057 
02058     if (!dx && !dy)
02059         return; // Nothing to do
02060 
02061     emit contentsMoving(-x, -y);
02062 
02063     d->vx = x;
02064     d->vy = y;
02065 
02066     if (d->clipped_viewport || d->static_bg) {
02067         // Cheap move (usually)
02068         d->moveAllBy(dx,dy);
02069     } else if (/*dx && dy ||*/
02070          (QABS(dy) * 5 > visibleHeight() * 4) ||
02071          (QABS(dx) * 5 > visibleWidth() * 4)
02072        )
02073     {
02074         // Big move
02075         if (viewport()->updatesEnabled())
02076             viewport()->update();
02077         d->moveAllBy(dx,dy);
02078     } else if (!d->fake_scroll || d->contentsWidth() > visibleWidth()) {
02079         // Small move
02080         clipper()->scroll(dx,dy);
02081     }
02082     d->hideOrShowAll(this, true);
02083 }

Here is the call graph for this function:

void Q3ScrollView::hslide ( int   )  [private, slot]

Definition at line 695 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsY(), d, moveContents(), Q3ScrollViewData::signal_choke, and QApplication::syncX().

Referenced by Q3ScrollView().

00696 {
00697     if (!d->signal_choke) {
00698         moveContents(-pos, -d->contentsY());
00699         QApplication::syncX();
00700     }
00701 }

void Q3ScrollView::vslide ( int   )  [private, slot]

Definition at line 703 of file q3scrollview.cpp.

References Q3ScrollViewData::contentsX(), d, moveContents(), Q3ScrollViewData::signal_choke, and QApplication::syncX().

Referenced by Q3ScrollView().

00704 {
00705     if (!d->signal_choke) {
00706         moveContents(-d->contentsX(), -pos);
00707         QApplication::syncX();
00708     }
00709 }

void Q3ScrollView::hbarIsPressed (  )  [private, slot]

Definition at line 635 of file q3scrollview.cpp.

References d, emit, Q3ScrollViewData::hbarPressed, and horizontalSliderPressed().

Referenced by Q3ScrollView().

00636 {
00637     d->hbarPressed = true;
00638     emit(horizontalSliderPressed());
00639 }

void Q3ScrollView::hbarIsReleased (  )  [private, slot]

Definition at line 641 of file q3scrollview.cpp.

References d, emit, Q3ScrollViewData::hbarPressed, and horizontalSliderReleased().

Referenced by Q3ScrollView().

00642 {
00643     d->hbarPressed = false;
00644     emit(horizontalSliderReleased());
00645 }

void Q3ScrollView::vbarIsPressed (  )  [private, slot]

Definition at line 655 of file q3scrollview.cpp.

References d, emit, Q3ScrollViewData::vbarPressed, and verticalSliderPressed().

Referenced by Q3ScrollView().

00656 {
00657     d->vbarPressed = true;
00658     emit(verticalSliderPressed());
00659 }

void Q3ScrollView::vbarIsReleased (  )  [private, slot]

Definition at line 661 of file q3scrollview.cpp.

References d, emit, Q3ScrollViewData::vbarPressed, and verticalSliderReleased().

Referenced by Q3ScrollView().

00662 {
00663     d->vbarPressed = false;
00664     emit(verticalSliderReleased());
00665 }

void Q3ScrollView::doDragAutoScroll (  )  [private, slot]

Definition at line 2723 of file q3scrollview.cpp.

References Q3ScrollViewData::autoscroll_accel, autoscroll_margin, Q3ScrollViewData::autoscroll_time, Q3ScrollViewData::autoscroll_timer, d, initialScrollAccel, initialScrollTime, l, QWidget::mapFromGlobal(), p, QCursor::pos(), scrollBy(), QTimer::start(), stopDragAutoScroll(), Q3ScrollViewData::viewport, visibleHeight(), and visibleWidth().

Referenced by Q3ScrollView().

02724 {
02725     QPoint p = d->viewport->mapFromGlobal(QCursor::pos());
02726 
02727     if (d->autoscroll_accel-- <= 0 && d->autoscroll_time) {
02728         d->autoscroll_accel = initialScrollAccel;
02729         d->autoscroll_time--;
02730         d->autoscroll_timer.start(d->autoscroll_time);
02731     }
02732     int l = QMAX(1, (initialScrollTime- d->autoscroll_time));
02733 
02734     int dx = 0, dy = 0;
02735     if (p.y() < autoscroll_margin) {
02736         dy = -l;
02737     } else if (p.y() > visibleHeight() - autoscroll_margin) {
02738         dy = +l;
02739     }
02740     if (p.x() < autoscroll_margin) {
02741         dx = -l;
02742     } else if (p.x() > visibleWidth() - autoscroll_margin) {
02743         dx = +l;
02744     }
02745     if (dx || dy) {
02746         scrollBy(dx,dy);
02747     } else {
02748         stopDragAutoScroll();
02749     }
02750 }

void Q3ScrollView::startDragAutoScroll (  )  [private, slot]

Definition at line 2701 of file q3scrollview.cpp.

References Q3ScrollViewData::autoscroll_accel, Q3ScrollViewData::autoscroll_time, Q3ScrollViewData::autoscroll_timer, d, initialScrollAccel, initialScrollTime, QTimer::isActive(), and QTimer::start().

Referenced by eventFilter().

void Q3ScrollView::stopDragAutoScroll (  )  [private, slot]

Definition at line 2714 of file q3scrollview.cpp.

References Q3ScrollViewData::autoscroll_timer, d, and QTimer::stop().

Referenced by doDragAutoScroll(), and eventFilter().

02715 {
02716     d->autoscroll_timer.stop();
02717 }

void Q3ScrollView::changeFrameRect ( const QRect  )  [private]

Definition at line 2414 of file q3scrollview.cpp.

References Q3Frame::contentsRect(), QFrame::frameRect(), QRect::intersected(), QRegion::isEmpty(), QWidget::isVisible(), QFrame::setFrameRect(), QRegion::subtracted(), QRegion::united(), and QWidget::update().

Referenced by updateScrollBars().

02415 {
02416     QRect oldr = frameRect();
02417     if (oldr != r) {
02418         QRect cr = contentsRect();
02419         QRegion fr(frameRect());
02420         fr = fr.subtracted(contentsRect());
02421         setFrameRect(r);
02422         if (isVisible()) {
02423             cr = cr.intersected(contentsRect());
02424             fr = fr.united(frameRect());
02425             fr = fr.subtracted(cr);
02426             if (!fr.isEmpty())
02427                 update(fr);
02428         }
02429     }
02430 }

Here is the call graph for this function:

void Q3ScrollView::disableSizeHintCaching (  ) 

Definition at line 2786 of file q3scrollview.cpp.

References d, and Q3ScrollViewData::use_cached_size_hint.

02787 {
02788     d->use_cached_size_hint = false;
02789 }


Member Data Documentation

Q3ScrollViewData* Q3ScrollView::d [private]

Definition at line 207 of file q3scrollview.h.

Referenced by addChild(), bottomMargin(), cachedSizeHint(), childX(), childY(), clipper(), contentsHeight(), contentsToViewport(), contentsWidth(), contentsX(), contentsY(), cornerWidget(), disableSizeHintCaching(), doDragAutoScroll(), dragAutoScroll(), enableClipper(), ensureVisible(), eventFilter(), focusNextPrevChild(), fontChange(), hasStaticBackground(), hbarIsPressed(), hbarIsReleased(), horizontalScrollBar(), hScrollBarMode(), hslide(), isHorizontalSliderPressed(), isVerticalSliderPressed(), leftMargin(), moveContents(), Q3ScrollView(), removeChild(), repaintContents(), resizeContents(), resizeEvent(), resizePolicy(), rightMargin(), scrollBy(), setCachedSizeHint(), setContentsPos(), setCornerWidget(), setDragAutoScroll(), setHScrollBarMode(), setMargins(), setResizePolicy(), setStaticBackground(), setVisible(), setVScrollBarMode(), sizeHint(), startDragAutoScroll(), stopDragAutoScroll(), styleChange(), topMargin(), updateContents(), updateScrollBars(), vbarIsPressed(), vbarIsReleased(), verticalScrollBar(), viewport(), viewportPaintEvent(), viewportSize(), viewportToContents(), vScrollBarMode(), vslide(), and ~Q3ScrollView().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 16:16:17 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1