Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ
îðèãèíàëüíîãî äîêóìåíòà
: http://rtm-cs.sinp.msu.ru/manual/qt/qscrollview.html
Äàòà èçìåíåíèÿ: Sun Jul 12 02:58:59 1998 Äàòà èíäåêñèðîâàíèÿ: Mon Oct 1 20:34:06 2012 Êîäèðîâêà: |
The QScrollView widget provides a scrolling area with on-demand scrollbars. More...
#include <qscrollview.h>
Inherits QFrame.
Inherited by QListView.
The QScrollView is a large canvas - potentially larger than the coordinate system normally supported by the underlying window system. This is important, as is is quite easy to go beyond such limitations (eg. many web pages are more than 32000 pixels high). Additionally, the QScrollView can have QWidgets positioned on it that scroll around with the drawn content. These subwidgets can also have positions outside the normal coordinate range (but they are still limited in size).
To provide content for the widget, inherit from QScrollView and override drawContentsOffset(), and use resizeContents() to set the size of the viewed area. Use addChild(), moveChild(), and showChild() to position widgets on the view.
Note also the effect of resizePolicy().
Currently the scrollbars fail beyond about 1000000 pixels due to integer overflow.
Constructs a QScrollView.
If you intend to add child widgets, you may see improved refresh if you include WPaintClever in the widgets flags, f. WPaintClever will be propagated to the viewport() widget.
Destructs the QScrollView. Any children added with addChild() will be destructed.
Inserts child into the scrolled area. It is equivalent to addChild(child,0,0).
[virtual]
Inserts child into the scrolled area positioned at (x, y). If the child is already in the view, it is just moved.
[protected]
Returns the current bottom margin.
See also: setMargins().
[slot]
Scrolls the content so that the point (x,y) is in the center of visible area.
[slot]
Scrolls the content so that the point (x,y) is visible, with the given margins (as fractions of visible area).
eg.
Returns TRUE if child is visible. Use this rather than QWidget::isVisible() for widgets added to the view.
Returns the X position of the given child widget. Use this rather than QWidget::x() for widgets added to the view.
Returns the Y position of the given child widget. Use this rather than QWidget::y() for widgets added to the view.
Returns the height of the contents area.
[signal]
This signal is emitted just before the contents is moved to the given position.
See also: contentsX() and contentsY().
Returns the width of the contents area.
Returns the X coordinate of the contents which is at the left edge of the viewport.
Returns the Y coordinate of the contents which is at the top edge of the viewport.
Returns the widget in the corner between the two scrollbars.
By default, no corner widget is present.
[virtual protected]
Reimplement this method if you are viewing a drawing area rather than a widget.
Draws the rectangle (clipx, clipy, clipw, cliph ) of the contents, offset by (offsetx, offsety ) using painter p. All four are given in the scroll views's coordinates. All of clipx, clipy, offsetx and offsety are typically large positive numbers.
Note that the final coordinates you give to QPainter methods must be within the range supported by the underlying window systems - about +/- 32000 at most, often much less - +/- 4000 or so is all you should rely expect.
For example:
{ // Fill a 40000 by 50000 rectangle at (100000,150000) // Calculate the coordinates... (don't use QPoint, QRect, etc!) 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; // Translate to scrolled coordinates... x1 -= ox; x2 -= ox; y1 -= oy; y2 -= oy; // Paint using the new small coordinates... if ( x2 >= x1 && y2 >= y1 ) p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red); }
The clip rectangle of the painter p is already set appropriately.
Note that QPainter::translate() is not sufficient.
The default implementation does nothing.
Reimplemented in QListView.
[slot]
Scrolls the content so that the point (x, y) is visible with at least 50-pixel margins (if possible, otherwise centered).
[slot]
Scrolls the content so that the point (x, y) is visible with at least the given pixel margins (if possible, otherwise centered).
[virtual protected]
This event filter ensures the scrollbars are updated when a single contents widget is resized, shown, hidden, or destroyed, and passes mouse events to the QScrollView.
Reimplemented from QObject.
[virtual protected]
Override so that traversal moves among child widgets, even if they are not visible, scrolling to make them so.
Reimplemented from QWidget.
[virtual protected]
An override - ensures scrollbars are correct size when frame style changes.
Reimplemented from QFrame.
Returns the currently set mode for the horizontal scrollbar.
See also: setHScrollBarMode().
Returns the component horizontal scrollbar. It is made available to allow accelerators, autoscrolling, etc., and to allow changing of arrow scrollrates: bar->setSteps( rate, bar->pageStep() ).
It should not be otherwise manipulated.
[protected]
Returns the current left margin.
See also: setMargins().
[virtual]
Repositions child to (x, y). This functions the same as addChild().
Removes a child from the scrolled area. Note that this happens automatically if the child is deleted.
An override - ensures scrollbars are correct size upon resize.
An override - ensures scrollbars are correct size upon resize.
[virtual slot]
Set the size of the contents area to w pixels wide and h pixels high, and updates the viewport accordingly.
[virtual protected]
An override - ensures scrollbars are correct size upon resize.
Reimplemented from QWidget.
Returns the currently set ResizePolicy.
[protected]
Returns the current right margin.
See also: setMargins().
[slot]
Scrolls the content by x to the left and y upwards.
[slot]
Scrolls the content so that the point (x, y) is in the top-left corner.
[virtual]
Sets the widget in the corner between the two scrollbars.
You will probably also want to set at least one of the scrollbar 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 QScrollView when it destructs unless you seperately recreate 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() and setHScrollBarMode().
[virtual]
Sets the mode for the horizontal scrollbar.
Auto
(the default) shows a scrollbar when the content is too wide to fit.
AlwaysOff
never shows a scrollbar.
AlwaysOn
always shows a scrollbar.
See also: hScrollBarMode() and setVScrollBarMode().
[protected]
Sets the margins around the scrolling area. This is useful for applications such as spreadsheets with `locked' rows and columns. The marginal space is inside the frameRect() and is left blank - override drawContents() or put widgets in the unused area.
By default all margins are zero.
See also: frameChanged().
[virtual]
Sets the resize policy to r.
The policies are:
Default
is the initial value. It converts to Manual
if
the view is resized with resizeContents(), or to AutoOne
if a child is added.
Manual
means the view stays the size set by resizeContents().
AutoOne
means that if there is only only child widget, the
view stays the size of that widget.
[virtual]
Sets the mode for the vertical scrollbar.
Auto
(the default) shows a scrollbar when the content is too tall to fit.
AlwaysOff
never shows a scrollbar.
AlwaysOn
always shows a scrollbar.
See also: vScrollBarMode() and setHScrollBarMode().
[virtual]
An override - ensures scrollbars are correct size upon showing.
Reimplemented from QWidget.
Sets the visibility of child. Use this rather than QWidget::show() or QWidget::hide() for widgets added to the view.
[protected]
Returns the current top margin.
See also: setMargins().
[slot]
Updates scrollbars - all possibilities considered. You should never need to call this in your code.
Returns the currently set mode for the vertical scrollbar.
See also: setVScrollBarMode().
Returns the component vertical scrollbar. It is made available to allow accelerators, autoscrolling, etc., and to allow changing of arrow scrollrates: bar->setSteps( rate, bar->pageStep() ).
It should not be otherwise manipulated.
Returns the viewport widget of the scrollview. This is the widget containing the contents widget or which is the drawing area.
[virtual protected]
To provide simple processing of events on the contents, this method receives all mouse double click events sent to the viewport.
[virtual protected]
To provide simple processing of events on the contents, this method receives all mouse move events sent to the viewport.
[virtual protected]
To provide simple processing of events on the contents, this method receives all mouse press events sent to the viewport.
[virtual protected]
To provide simple processing of events on the contents, this method receives all mouse release events sent to the viewport.
[virtual protected]
This is a low-level painting routine that draws the viewport contents. Override this if drawContentsOffset() is too high-level. (for example, if you don't want to open a QPainter on the viewport).
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.
It was generated from the following files:
Copyright © 1998 Troll Tech | Trademarks | Qt version 1.40
|