1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qscrollview.cpp:347 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QScrollView Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QScrollView Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QScrollView widget provides a scrolling area with on-demand scroll bars.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qscrollview-h.html">qscrollview.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qframe.html">QFrame</a>.
|
---|
38 | <p>Inherited by <a href="qcanvasview.html">QCanvasView</a>, <a href="qtable.html">QTable</a>, <a href="qgridview.html">QGridView</a>, <a href="qiconview.html">QIconView</a>, <a href="qlistbox.html">QListBox</a>, <a href="qlistview.html">QListView</a>, and <a href="qtextedit.html">QTextEdit</a>.
|
---|
39 | <p><a href="qscrollview-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QScrollView"><b>QScrollView</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
---|
43 | <li class=fn><a href="#~QScrollView"><b>~QScrollView</b></a> ()</li>
|
---|
44 | <li class=fn>enum <a href="#ResizePolicy-enum"><b>ResizePolicy</b></a> { Default, Manual, AutoOne, AutoOneFit }</li>
|
---|
45 | <li class=fn>virtual void <a href="#setResizePolicy"><b>setResizePolicy</b></a> ( ResizePolicy )</li>
|
---|
46 | <li class=fn>ResizePolicy <a href="#resizePolicy"><b>resizePolicy</b></a> () const</li>
|
---|
47 | <li class=fn>void <a href="#removeChild"><b>removeChild</b></a> ( QWidget * child )</li>
|
---|
48 | <li class=fn>virtual void <a href="#addChild"><b>addChild</b></a> ( QWidget * child, int x = 0, int y = 0 )</li>
|
---|
49 | <li class=fn>virtual void <a href="#moveChild"><b>moveChild</b></a> ( QWidget * child, int x, int y )</li>
|
---|
50 | <li class=fn>int <a href="#childX"><b>childX</b></a> ( QWidget * child )</li>
|
---|
51 | <li class=fn>int <a href="#childY"><b>childY</b></a> ( QWidget * child )</li>
|
---|
52 | <li class=fn>bool childIsVisible ( QWidget * child ) <em>(obsolete)</em></li>
|
---|
53 | <li class=fn>void showChild ( QWidget * child, bool y = TRUE ) <em>(obsolete)</em></li>
|
---|
54 | <li class=fn>enum <a href="#ScrollBarMode-enum"><b>ScrollBarMode</b></a> { Auto, AlwaysOff, AlwaysOn }</li>
|
---|
55 | <li class=fn>ScrollBarMode <a href="#vScrollBarMode"><b>vScrollBarMode</b></a> () const</li>
|
---|
56 | <li class=fn>virtual void <a href="#setVScrollBarMode"><b>setVScrollBarMode</b></a> ( ScrollBarMode )</li>
|
---|
57 | <li class=fn>ScrollBarMode <a href="#hScrollBarMode"><b>hScrollBarMode</b></a> () const</li>
|
---|
58 | <li class=fn>virtual void <a href="#setHScrollBarMode"><b>setHScrollBarMode</b></a> ( ScrollBarMode )</li>
|
---|
59 | <li class=fn>QWidget * <a href="#cornerWidget"><b>cornerWidget</b></a> () const</li>
|
---|
60 | <li class=fn>virtual void <a href="#setCornerWidget"><b>setCornerWidget</b></a> ( QWidget * corner )</li>
|
---|
61 | <li class=fn>QScrollBar * <a href="#horizontalScrollBar"><b>horizontalScrollBar</b></a> () const</li>
|
---|
62 | <li class=fn>QScrollBar * <a href="#verticalScrollBar"><b>verticalScrollBar</b></a> () const</li>
|
---|
63 | <li class=fn>QWidget * <a href="#viewport"><b>viewport</b></a> () const</li>
|
---|
64 | <li class=fn>QWidget * <a href="#clipper"><b>clipper</b></a> () const</li>
|
---|
65 | <li class=fn>int <a href="#visibleWidth"><b>visibleWidth</b></a> () const</li>
|
---|
66 | <li class=fn>int <a href="#visibleHeight"><b>visibleHeight</b></a> () const</li>
|
---|
67 | <li class=fn>int <a href="#contentsWidth"><b>contentsWidth</b></a> () const</li>
|
---|
68 | <li class=fn>int <a href="#contentsHeight"><b>contentsHeight</b></a> () const</li>
|
---|
69 | <li class=fn>int <a href="#contentsX"><b>contentsX</b></a> () const</li>
|
---|
70 | <li class=fn>int <a href="#contentsY"><b>contentsY</b></a> () const</li>
|
---|
71 | <li class=fn>void <a href="#updateContents"><b>updateContents</b></a> ( int x, int y, int w, int h )</li>
|
---|
72 | <li class=fn>void <a href="#updateContents-2"><b>updateContents</b></a> ( const QRect & r )</li>
|
---|
73 | <li class=fn>void <a href="#updateContents-3"><b>updateContents</b></a> ()</li>
|
---|
74 | <li class=fn>void <a href="#repaintContents"><b>repaintContents</b></a> ( int x, int y, int w, int h, bool erase = TRUE )</li>
|
---|
75 | <li class=fn>void <a href="#repaintContents-2"><b>repaintContents</b></a> ( const QRect & r, bool erase = TRUE )</li>
|
---|
76 | <li class=fn>void <a href="#repaintContents-3"><b>repaintContents</b></a> ( bool erase = TRUE )</li>
|
---|
77 | <li class=fn>void <a href="#contentsToViewport"><b>contentsToViewport</b></a> ( int x, int y, int & vx, int & vy ) const</li>
|
---|
78 | <li class=fn>void <a href="#viewportToContents"><b>viewportToContents</b></a> ( int vx, int vy, int & x, int & y ) const</li>
|
---|
79 | <li class=fn>QPoint <a href="#contentsToViewport-2"><b>contentsToViewport</b></a> ( const QPoint & p ) const</li>
|
---|
80 | <li class=fn>QPoint <a href="#viewportToContents-2"><b>viewportToContents</b></a> ( const QPoint & vp ) const</li>
|
---|
81 | <li class=fn>void <a href="#enableClipper"><b>enableClipper</b></a> ( bool y )</li>
|
---|
82 | <li class=fn>void <a href="#setStaticBackground"><b>setStaticBackground</b></a> ( bool y )</li>
|
---|
83 | <li class=fn>bool <a href="#hasStaticBackground"><b>hasStaticBackground</b></a> () const</li>
|
---|
84 | <li class=fn>QSize <a href="#viewportSize"><b>viewportSize</b></a> ( int x, int y ) const</li>
|
---|
85 | <li class=fn>bool <a href="#isHorizontalSliderPressed"><b>isHorizontalSliderPressed</b></a> ()</li>
|
---|
86 | <li class=fn>bool <a href="#isVerticalSliderPressed"><b>isVerticalSliderPressed</b></a> ()</li>
|
---|
87 | <li class=fn>virtual void <a href="#setDragAutoScroll"><b>setDragAutoScroll</b></a> ( bool b )</li>
|
---|
88 | <li class=fn>bool <a href="#dragAutoScroll"><b>dragAutoScroll</b></a> () const</li>
|
---|
89 | </ul>
|
---|
90 | <h2>Public Slots</h2>
|
---|
91 | <ul>
|
---|
92 | <li class=fn>virtual void <a href="#resizeContents"><b>resizeContents</b></a> ( int w, int h )</li>
|
---|
93 | <li class=fn>void <a href="#scrollBy"><b>scrollBy</b></a> ( int dx, int dy )</li>
|
---|
94 | <li class=fn>virtual void <a href="#setContentsPos"><b>setContentsPos</b></a> ( int x, int y )</li>
|
---|
95 | <li class=fn>void <a href="#ensureVisible"><b>ensureVisible</b></a> ( int x, int y )</li>
|
---|
96 | <li class=fn>void <a href="#ensureVisible-2"><b>ensureVisible</b></a> ( int x, int y, int xmargin, int ymargin )</li>
|
---|
97 | <li class=fn>void <a href="#center"><b>center</b></a> ( int x, int y )</li>
|
---|
98 | <li class=fn>void <a href="#center-2"><b>center</b></a> ( int x, int y, float xmargin, float ymargin )</li>
|
---|
99 | <li class=fn>void <a href="#updateScrollBars"><b>updateScrollBars</b></a> ()</li>
|
---|
100 | </ul>
|
---|
101 | <h2>Signals</h2>
|
---|
102 | <ul>
|
---|
103 | <li class=fn>void <a href="#contentsMoving"><b>contentsMoving</b></a> ( int x, int y )</li>
|
---|
104 | <li class=fn>void <a href="#horizontalSliderPressed"><b>horizontalSliderPressed</b></a> ()</li>
|
---|
105 | <li class=fn>void <a href="#horizontalSliderReleased"><b>horizontalSliderReleased</b></a> ()</li>
|
---|
106 | <li class=fn>void <a href="#verticalSliderPressed"><b>verticalSliderPressed</b></a> ()</li>
|
---|
107 | <li class=fn>void <a href="#verticalSliderReleased"><b>verticalSliderReleased</b></a> ()</li>
|
---|
108 | </ul>
|
---|
109 | <h2>Properties</h2>
|
---|
110 | <ul>
|
---|
111 | <li class=fn>int <a href="#contentsHeight-prop"><b>contentsHeight</b></a> - the height of the contents area <em>(read only)</em></li>
|
---|
112 | <li class=fn>int <a href="#contentsWidth-prop"><b>contentsWidth</b></a> - the width of the contents area <em>(read only)</em></li>
|
---|
113 | <li class=fn>int <a href="#contentsX-prop"><b>contentsX</b></a> - the X coordinate of the contents that are at the left edge of the viewport <em>(read only)</em></li>
|
---|
114 | <li class=fn>int <a href="#contentsY-prop"><b>contentsY</b></a> - the Y coordinate of the contents that are at the top edge of the viewport <em>(read only)</em></li>
|
---|
115 | <li class=fn>bool <a href="#dragAutoScroll-prop"><b>dragAutoScroll</b></a> - whether autoscrolling in drag move events is enabled</li>
|
---|
116 | <li class=fn>ScrollBarMode <a href="#hScrollBarMode-prop"><b>hScrollBarMode</b></a> - the mode for the horizontal scroll bar</li>
|
---|
117 | <li class=fn>ResizePolicy <a href="#resizePolicy-prop"><b>resizePolicy</b></a> - the resize policy</li>
|
---|
118 | <li class=fn>ScrollBarMode <a href="#vScrollBarMode-prop"><b>vScrollBarMode</b></a> - the mode for the vertical scroll bar</li>
|
---|
119 | <li class=fn>int <a href="#visibleHeight-prop"><b>visibleHeight</b></a> - the vertical amount of the content that is visible <em>(read only)</em></li>
|
---|
120 | <li class=fn>int <a href="#visibleWidth-prop"><b>visibleWidth</b></a> - the horizontal amount of the content that is visible <em>(read only)</em></li>
|
---|
121 | </ul>
|
---|
122 | <h2>Protected Members</h2>
|
---|
123 | <ul>
|
---|
124 | <li class=fn>virtual void <a href="#drawContents"><b>drawContents</b></a> ( QPainter * p, int clipx, int clipy, int clipw, int cliph )</li>
|
---|
125 | <li class=fn>virtual void <a href="#drawContentsOffset"><b>drawContentsOffset</b></a> ( QPainter * p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph )</li>
|
---|
126 | <li class=fn>virtual void <a href="#contentsMousePressEvent"><b>contentsMousePressEvent</b></a> ( QMouseEvent * e )</li>
|
---|
127 | <li class=fn>virtual void <a href="#contentsMouseReleaseEvent"><b>contentsMouseReleaseEvent</b></a> ( QMouseEvent * e )</li>
|
---|
128 | <li class=fn>virtual void <a href="#contentsMouseDoubleClickEvent"><b>contentsMouseDoubleClickEvent</b></a> ( QMouseEvent * e )</li>
|
---|
129 | <li class=fn>virtual void <a href="#contentsMouseMoveEvent"><b>contentsMouseMoveEvent</b></a> ( QMouseEvent * e )</li>
|
---|
130 | <li class=fn>virtual void <a href="#contentsDragEnterEvent"><b>contentsDragEnterEvent</b></a> ( QDragEnterEvent * )</li>
|
---|
131 | <li class=fn>virtual void <a href="#contentsDragMoveEvent"><b>contentsDragMoveEvent</b></a> ( QDragMoveEvent * )</li>
|
---|
132 | <li class=fn>virtual void <a href="#contentsDragLeaveEvent"><b>contentsDragLeaveEvent</b></a> ( QDragLeaveEvent * )</li>
|
---|
133 | <li class=fn>virtual void <a href="#contentsDropEvent"><b>contentsDropEvent</b></a> ( QDropEvent * )</li>
|
---|
134 | <li class=fn>virtual void <a href="#contentsWheelEvent"><b>contentsWheelEvent</b></a> ( QWheelEvent * e )</li>
|
---|
135 | <li class=fn>virtual void <a href="#contentsContextMenuEvent"><b>contentsContextMenuEvent</b></a> ( QContextMenuEvent * e )</li>
|
---|
136 | <li class=fn>virtual void <a href="#viewportPaintEvent"><b>viewportPaintEvent</b></a> ( QPaintEvent * pe )</li>
|
---|
137 | <li class=fn>virtual void <a href="#viewportResizeEvent"><b>viewportResizeEvent</b></a> ( QResizeEvent * )</li>
|
---|
138 | <li class=fn>virtual void <a href="#setMargins"><b>setMargins</b></a> ( int left, int top, int right, int bottom )</li>
|
---|
139 | <li class=fn>int <a href="#leftMargin"><b>leftMargin</b></a> () const</li>
|
---|
140 | <li class=fn>int <a href="#topMargin"><b>topMargin</b></a> () const</li>
|
---|
141 | <li class=fn>int <a href="#rightMargin"><b>rightMargin</b></a> () const</li>
|
---|
142 | <li class=fn>int <a href="#bottomMargin"><b>bottomMargin</b></a> () const</li>
|
---|
143 | <li class=fn>virtual void <a href="#setHBarGeometry"><b>setHBarGeometry</b></a> ( QScrollBar & hbar, int x, int y, int w, int h )</li>
|
---|
144 | <li class=fn>virtual void <a href="#setVBarGeometry"><b>setVBarGeometry</b></a> ( QScrollBar & vbar, int x, int y, int w, int h )</li>
|
---|
145 | <li class=fn>virtual bool <a href="#eventFilter"><b>eventFilter</b></a> ( QObject * obj, QEvent * e )</li>
|
---|
146 | </ul>
|
---|
147 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
148 |
|
---|
149 |
|
---|
150 | The QScrollView widget provides a scrolling area with on-demand scroll bars.
|
---|
151 | <p>
|
---|
152 |
|
---|
153 | <p> The QScrollView is a large canvas - potentially larger than the
|
---|
154 | coordinate system normally supported by the underlying window
|
---|
155 | system. This is important because it is quite easy to go beyond
|
---|
156 | these limitations (e.g. many web pages are more than 32000 pixels
|
---|
157 | high). Additionally, the QScrollView can have QWidgets positioned
|
---|
158 | on it that scroll around with the drawn content. These sub-widgets
|
---|
159 | can also have positions outside the normal coordinate range (but
|
---|
160 | they are still limited in size).
|
---|
161 | <p> To provide content for the widget, inherit from QScrollView,
|
---|
162 | reimplement <a href="#drawContents">drawContents</a>() and use <a href="#resizeContents">resizeContents</a>() to set the
|
---|
163 | size of the viewed area. Use <a href="#addChild">addChild</a>() and <a href="#moveChild">moveChild</a>() to
|
---|
164 | position widgets on the view.
|
---|
165 | <p> To use QScrollView effectively it is important to understand its
|
---|
166 | widget structure in the three styles of use: a single large child
|
---|
167 | widget, a large panning area with some widgets and a large panning
|
---|
168 | area with many widgets.
|
---|
169 | <p> <h3> Using One Big Widget
|
---|
170 | </h3>
|
---|
171 | <a name="1"></a><p> <center><img src="qscrollview-vp2.png"></center>
|
---|
172 | <p> The first, simplest usage of QScrollView (depicted above), is
|
---|
173 | appropriate for scrolling areas that are never more than about
|
---|
174 | 4000 pixels in either dimension (this is about the maximum
|
---|
175 | reliable size on X11 servers). In this usage, you just make one
|
---|
176 | large child in the QScrollView. The child should be a child of the
|
---|
177 | <a href="#viewport">viewport</a>() of the scrollview and be added with addChild():
|
---|
178 | <pre>
|
---|
179 | QScrollView* sv = new QScrollView(...);
|
---|
180 | <a href="qvbox.html">QVBox</a>* big_box = new <a href="qvbox.html">QVBox</a>(sv-><a href="#viewport">viewport</a>());
|
---|
181 | sv-><a href="#addChild">addChild</a>(big_box);
|
---|
182 | </pre>
|
---|
183 |
|
---|
184 | You can go on to add arbitrary child widgets to the single child
|
---|
185 | in the scrollview as you would with any widget:
|
---|
186 | <pre>
|
---|
187 | <a href="qlabel.html">QLabel</a>* child1 = new <a href="qlabel.html">QLabel</a>("CHILD", big_box);
|
---|
188 | <a href="qlabel.html">QLabel</a>* child2 = new <a href="qlabel.html">QLabel</a>("CHILD", big_box);
|
---|
189 | <a href="qlabel.html">QLabel</a>* child3 = new <a href="qlabel.html">QLabel</a>("CHILD", big_box);
|
---|
190 | ...
|
---|
191 | </pre>
|
---|
192 |
|
---|
193 | <p> Here the QScrollView has four children: the viewport(), the
|
---|
194 | <a href="#verticalScrollBar">verticalScrollBar</a>(), the <a href="#horizontalScrollBar">horizontalScrollBar</a>() and a small
|
---|
195 | <a href="#cornerWidget">cornerWidget</a>(). The <a href="#viewport">viewport</a>() has one child: the big <a href="qvbox.html">QVBox</a>. The
|
---|
196 | QVBox has the three <a href="qlabel.html">QLabel</a> objects as child widgets. When the view
|
---|
197 | is scrolled, the QVBox is moved; its children move with it as
|
---|
198 | child widgets normally do.
|
---|
199 | <p> <h3> Using a Very Big View with Some Widgets
|
---|
200 | </h3>
|
---|
201 | <a name="1-1"></a><p> <center><img src="qscrollview-vp.png"></center>
|
---|
202 | <p> The second usage of QScrollView (depicted above) is appropriate
|
---|
203 | when few, if any, widgets are on a very large scrolling area that
|
---|
204 | is potentially larger than 4000 pixels in either dimension. In
|
---|
205 | this usage you call <a href="#resizeContents">resizeContents</a>() to set the size of the area
|
---|
206 | and reimplement <a href="#drawContents">drawContents</a>() to paint the contents. You may also
|
---|
207 | add some widgets by making them children of the viewport() and
|
---|
208 | adding them with <a href="#addChild">addChild</a>() (this is the same as the process for
|
---|
209 | the single large widget in the previous example):
|
---|
210 | <pre>
|
---|
211 | QScrollView* sv = new QScrollView(...);
|
---|
212 | <a href="qlabel.html">QLabel</a>* child1 = new <a href="qlabel.html">QLabel</a>("CHILD", sv-><a href="#viewport">viewport</a>());
|
---|
213 | sv-><a href="#addChild">addChild</a>(child1);
|
---|
214 | <a href="qlabel.html">QLabel</a>* child2 = new <a href="qlabel.html">QLabel</a>("CHILD", sv-><a href="#viewport">viewport</a>());
|
---|
215 | sv-><a href="#addChild">addChild</a>(child2);
|
---|
216 | <a href="qlabel.html">QLabel</a>* child3 = new <a href="qlabel.html">QLabel</a>("CHILD", sv-><a href="#viewport">viewport</a>());
|
---|
217 | sv-><a href="#addChild">addChild</a>(child3);
|
---|
218 | </pre>
|
---|
219 |
|
---|
220 | Here, the QScrollView has the same four children: the <a href="#viewport">viewport</a>(),
|
---|
221 | the <a href="#verticalScrollBar">verticalScrollBar</a>(), the <a href="#horizontalScrollBar">horizontalScrollBar</a>() and a small
|
---|
222 | <a href="#cornerWidget">cornerWidget</a>(). The viewport() has the three <a href="qlabel.html">QLabel</a> objects as
|
---|
223 | child widgets. When the view is scrolled, the scrollview moves the
|
---|
224 | child widgets individually.
|
---|
225 | <p> <h3> Using a Very Big View with Many Widgets
|
---|
226 | </h3>
|
---|
227 | <a name="1-2"></a><p> <a name="enableclipper"></a>
|
---|
228 | <center><img src="qscrollview-cl.png"></center>
|
---|
229 | <p> The final usage of QScrollView (depicted above) is appropriate
|
---|
230 | when many widgets are on a very large scrolling area that is
|
---|
231 | potentially larger than 4000 pixels in either dimension. In this
|
---|
232 | usage you call <a href="#resizeContents">resizeContents</a>() to set the size of the area and
|
---|
233 | reimplement <a href="#drawContents">drawContents</a>() to paint the contents. You then call
|
---|
234 | <a href="#enableClipper">enableClipper</a>(TRUE) and add widgets, again by making them children
|
---|
235 | of the <a href="#viewport">viewport</a>(), and adding them with <a href="#addChild">addChild</a>():
|
---|
236 | <pre>
|
---|
237 | QScrollView* sv = new QScrollView(...);
|
---|
238 | sv-><a href="#enableClipper">enableClipper</a>(TRUE);
|
---|
239 | <a href="qlabel.html">QLabel</a>* child1 = new <a href="qlabel.html">QLabel</a>("CHILD", sv-><a href="#viewport">viewport</a>());
|
---|
240 | sv-><a href="#addChild">addChild</a>(child1);
|
---|
241 | <a href="qlabel.html">QLabel</a>* child2 = new <a href="qlabel.html">QLabel</a>("CHILD", sv-><a href="#viewport">viewport</a>());
|
---|
242 | sv-><a href="#addChild">addChild</a>(child2);
|
---|
243 | <a href="qlabel.html">QLabel</a>* child3 = new <a href="qlabel.html">QLabel</a>("CHILD", sv-><a href="#viewport">viewport</a>());
|
---|
244 | sv-><a href="#addChild">addChild</a>(child3);
|
---|
245 | </pre>
|
---|
246 |
|
---|
247 | <p> Here, the QScrollView has four children: the <a href="#clipper">clipper</a>() (not the
|
---|
248 | viewport() this time), the <a href="#verticalScrollBar">verticalScrollBar</a>(), the
|
---|
249 | <a href="#horizontalScrollBar">horizontalScrollBar</a>() and a small <a href="#cornerWidget">cornerWidget</a>(). The clipper()
|
---|
250 | has one child: the <a href="#viewport">viewport</a>(). The viewport() has the same three
|
---|
251 | labels as child widgets. When the view is scrolled the viewport()
|
---|
252 | is moved; its children move with it as child widgets normally do.
|
---|
253 | <p> <a name="allviews"></a>
|
---|
254 | <h3> Details Relevant for All Views
|
---|
255 | </h3>
|
---|
256 | <a name="1-3"></a><p> Normally you will use the first or third method if you want any
|
---|
257 | child widgets in the view.
|
---|
258 | <p> Note that the widget you see in the scrolled area is the
|
---|
259 | viewport() widget, not the QScrollView itself. So to turn mouse
|
---|
260 | tracking on, for example, use viewport()->setMouseTracking(TRUE).
|
---|
261 | <p> To enable drag-and-drop, you would <a href="qwidget.html#setAcceptDrops">setAcceptDrops</a>(TRUE) on the
|
---|
262 | QScrollView (because drag-and-drop events propagate to the
|
---|
263 | parent). But to work out the logical position in the view, you
|
---|
264 | would need to map the drop co-ordinate from being relative to the
|
---|
265 | QScrollView to being relative to the contents; use the function
|
---|
266 | <a href="#viewportToContents">viewportToContents</a>() for this.
|
---|
267 | <p> To handle mouse events on the scrolling area, subclass scrollview
|
---|
268 | as you would subclass other widgets, but rather than
|
---|
269 | reimplementing <a href="qwidget.html#mousePressEvent">mousePressEvent</a>(), reimplement
|
---|
270 | <a href="#contentsMousePressEvent">contentsMousePressEvent</a>() instead. The contents specific event
|
---|
271 | handlers provide translated events in the coordinate system of the
|
---|
272 | scrollview. If you reimplement mousePressEvent(), you'll get
|
---|
273 | called only when part of the QScrollView is clicked: and the only
|
---|
274 | such part is the "corner" (if you don't set a <a href="#cornerWidget">cornerWidget</a>()) and
|
---|
275 | the frame; everything else is covered up by the viewport, clipper
|
---|
276 | or scroll bars.
|
---|
277 | <p> When you construct a QScrollView, some of the widget flags apply
|
---|
278 | to the <a href="#viewport">viewport</a>() instead of being sent to the <a href="qwidget.html">QWidget</a> constructor
|
---|
279 | for the QScrollView. This applies to <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a>, <a href="qt.html#WidgetFlags-enum">WStaticContents</a>, and <a href="qt.html#WidgetFlags-enum">WPaintClever</a>. See <a href="qt.html#WidgetFlags-enum">Qt::WidgetFlags</a> for
|
---|
280 | documentation about these flags. Here are some examples:
|
---|
281 | <p> <ul>
|
---|
282 | <p> <li> An image-manipulation widget would use <tt>WNoAutoErase|WStaticContents</tt> because the widget draws all pixels
|
---|
283 | itself, and when its size increases, it only needs a paint event
|
---|
284 | for the new part because the old part remains unchanged.
|
---|
285 | <p> <li> A scrolling game widget in which the background scrolls as the
|
---|
286 | characters move might use <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> (in addition to <a href="qt.html#WidgetFlags-enum">WStaticContents</a>) so that the window system background does not
|
---|
287 | flash in and out during scrolling.
|
---|
288 | <p> <li> A word processing widget might use <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> and repaint
|
---|
289 | itself line by line to get a less-flickery resizing. If the widget
|
---|
290 | is in a mode in which no text justification can take place, it
|
---|
291 | might use <a href="qt.html#WidgetFlags-enum">WStaticContents</a> too, so that it would only get a
|
---|
292 | repaint for the newly visible parts.
|
---|
293 | <p> </ul>
|
---|
294 | <p> Child widgets may be moved using <a href="#addChild">addChild</a>() or <a href="#moveChild">moveChild</a>(). Use
|
---|
295 | <a href="#childX">childX</a>() and <a href="#childY">childY</a>() to get the position of a child widget.
|
---|
296 | <p> A widget may be placed in the corner between the vertical and
|
---|
297 | horizontal scrollbars with <a href="#setCornerWidget">setCornerWidget</a>(). You can get access
|
---|
298 | to the scrollbars using <a href="#horizontalScrollBar">horizontalScrollBar</a>() and
|
---|
299 | <a href="#verticalScrollBar">verticalScrollBar</a>(), and to the viewport with <a href="#viewport">viewport</a>(). The
|
---|
300 | scroll view can be scrolled using <a href="#scrollBy">scrollBy</a>(), <a href="#ensureVisible">ensureVisible</a>(),
|
---|
301 | <a href="#setContentsPos">setContentsPos</a>() or <a href="#center">center</a>().
|
---|
302 | <p> The visible area is given by <a href="#visibleWidth">visibleWidth</a>() and <a href="#visibleHeight">visibleHeight</a>(),
|
---|
303 | and the contents area by <a href="#contentsWidth">contentsWidth</a>() and <a href="#contentsHeight">contentsHeight</a>(). The
|
---|
304 | contents may be repainted using one of the <a href="#repaintContents">repaintContents</a>() or
|
---|
305 | <a href="#updateContents">updateContents</a>() functions.
|
---|
306 | <p> Coordinate conversion is provided by <a href="#contentsToViewport">contentsToViewport</a>() and
|
---|
307 | <a href="#viewportToContents">viewportToContents</a>().
|
---|
308 | <p> The <a href="#contentsMoving">contentsMoving</a>() signal is emitted just before the contents
|
---|
309 | are moved to a new position.
|
---|
310 | <p> <b>Warning:</b> QScrollView currently does not erase the background when
|
---|
311 | resized, i.e. you must always clear the background manually in
|
---|
312 | scrollview subclasses. This will change in a future version of Qt
|
---|
313 | and we recommend specifying the WNoAutoErase flag explicitly.
|
---|
314 | <p> <img src=qscrollview-m.png> <img src=qscrollview-w.png>
|
---|
315 | <p>See also <a href="abstractwidgets.html">Abstract Widget Classes</a>.
|
---|
316 |
|
---|
317 | <hr><h2>Member Type Documentation</h2>
|
---|
318 | <h3 class=fn><a name="ResizePolicy-enum"></a>QScrollView::ResizePolicy</h3>
|
---|
319 |
|
---|
320 | <p> This enum type is used to control a QScrollView's reaction to
|
---|
321 | resize events.
|
---|
322 | <ul>
|
---|
323 | <li><tt>QScrollView::Default</tt> - the QScrollView selects one of the other settings
|
---|
324 | automatically when it has to. In this version of Qt, QScrollView
|
---|
325 | changes to <a href="#ResizePolicy-enum">Manual</a> if you resize the contents with
|
---|
326 | <a href="#resizeContents">resizeContents</a>() and to <a href="#ResizePolicy-enum">AutoOne</a> if a child is added.
|
---|
327 | <li><tt>QScrollView::Manual</tt> - the contents stays the size set by resizeContents().
|
---|
328 | <li><tt>QScrollView::AutoOne</tt> - if there is only one child widget the contents stays
|
---|
329 | the size of that widget. Otherwise the behavior is undefined.
|
---|
330 | <li><tt>QScrollView::AutoOneFit</tt> - if there is only one child widget the contents stays
|
---|
331 | the size of that widget's <a href="qwidget.html#sizeHint">sizeHint</a>(). If the scrollview is resized
|
---|
332 | larger than the child's sizeHint(), the child will be resized to
|
---|
333 | fit. If there is more than one child, the behavior is undefined.
|
---|
334 | </ul><p>
|
---|
335 | <h3 class=fn><a name="ScrollBarMode-enum"></a>QScrollView::ScrollBarMode</h3>
|
---|
336 |
|
---|
337 | <p> This enum type describes the various modes of QScrollView's scroll
|
---|
338 | bars.
|
---|
339 | <ul>
|
---|
340 | <li><tt>QScrollView::Auto</tt> - QScrollView shows a scroll bar when the content is
|
---|
341 | too large to fit and not otherwise. This is the default.
|
---|
342 | <li><tt>QScrollView::AlwaysOff</tt> - QScrollView never shows a scroll bar.
|
---|
343 | <li><tt>QScrollView::AlwaysOn</tt> - QScrollView always shows a scroll bar.
|
---|
344 | </ul><p> (The modes for the horizontal and vertical scroll bars are
|
---|
345 | independent.)
|
---|
346 |
|
---|
347 | <hr><h2>Member Function Documentation</h2>
|
---|
348 | <h3 class=fn><a name="QScrollView"></a>QScrollView::QScrollView ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
---|
349 | </h3>
|
---|
350 | Constructs a QScrollView called <em>name</em> with parent <em>parent</em> and
|
---|
351 | widget flags <em>f</em>.
|
---|
352 | <p> The widget flags <a href="qt.html#WidgetFlags-enum">WStaticContents</a>, <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> and <a href="qt.html#WidgetFlags-enum">WPaintClever</a> are propagated to the <a href="#viewport">viewport</a>() widget. The other
|
---|
353 | widget flags are propagated to the parent constructor as usual.
|
---|
354 |
|
---|
355 | <h3 class=fn><a name="~QScrollView"></a>QScrollView::~QScrollView ()
|
---|
356 | </h3>
|
---|
357 | Destroys the QScrollView. Any children added with <a href="#addChild">addChild</a>() will
|
---|
358 | be deleted.
|
---|
359 |
|
---|
360 | <h3 class=fn>void <a name="addChild"></a>QScrollView::addChild ( <a href="qwidget.html">QWidget</a> * child, int x = 0, int y = 0 )<tt> [virtual]</tt>
|
---|
361 | </h3>
|
---|
362 | Inserts the widget, <em>child</em>, into the scrolled area positioned at
|
---|
363 | (<em>x</em>, <em>y</em>). The position defaults to (0, 0). If the child is
|
---|
364 | already in the view, it is just moved.
|
---|
365 | <p> You may want to call <a href="#enableClipper">enableClipper</a>(TRUE) if you add a large number
|
---|
366 | of widgets.
|
---|
367 |
|
---|
368 | <p>Example: <a href="scrollview-example.html#x645">scrollview/scrollview.cpp</a>.
|
---|
369 | <h3 class=fn>int <a name="bottomMargin"></a>QScrollView::bottomMargin () const<tt> [protected]</tt>
|
---|
370 | </h3>
|
---|
371 | Returns the bottom margin.
|
---|
372 | <p> <p>See also <a href="#setMargins">setMargins</a>().
|
---|
373 |
|
---|
374 | <h3 class=fn>void <a name="center"></a>QScrollView::center ( int x, int y )<tt> [slot]</tt>
|
---|
375 | </h3>
|
---|
376 | Scrolls the content so that the point <em>(x, y)</em> is in the center
|
---|
377 | of visible area.
|
---|
378 |
|
---|
379 | <p>Example: <a href="scrollview-example.html#x646">scrollview/scrollview.cpp</a>.
|
---|
380 | <h3 class=fn>void <a name="center-2"></a>QScrollView::center ( int x, int y, float xmargin, float ymargin )<tt> [slot]</tt>
|
---|
381 | </h3>
|
---|
382 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
383 | <p> Scrolls the content so that the point <em>(x, y)</em> is visible with
|
---|
384 | the <em>xmargin</em> and <em>ymargin</em> margins (as fractions of visible
|
---|
385 | the area).
|
---|
386 | <p> For example:
|
---|
387 | <ul>
|
---|
388 | <li> Margin 0.0 allows (x, y) to be on the edge of the visible area.
|
---|
389 | <li> Margin 0.5 ensures that (x, y) is in middle 50% of the visible area.
|
---|
390 | <li> Margin 1.0 ensures that (x, y) is in the center of the the visible area.
|
---|
391 | </ul>
|
---|
392 |
|
---|
393 | <h3 class=fn>bool <a name="childIsVisible"></a>QScrollView::childIsVisible ( <a href="qwidget.html">QWidget</a> * child )
|
---|
394 | </h3>
|
---|
395 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
396 | <p> Returns TRUE if <em>child</em> is visible. This is equivalent
|
---|
397 | to child->isVisible().
|
---|
398 |
|
---|
399 | <h3 class=fn>int <a name="childX"></a>QScrollView::childX ( <a href="qwidget.html">QWidget</a> * child )
|
---|
400 | </h3>
|
---|
401 | Returns the X position of the given <em>child</em> widget. Use this
|
---|
402 | rather than <a href="qwidget.html#x">QWidget::x</a>() for widgets added to the view.
|
---|
403 | <p> This function returns 0 if <em>child</em> has not been added to the view.
|
---|
404 |
|
---|
405 | <h3 class=fn>int <a name="childY"></a>QScrollView::childY ( <a href="qwidget.html">QWidget</a> * child )
|
---|
406 | </h3>
|
---|
407 | Returns the Y position of the given <em>child</em> widget. Use this
|
---|
408 | rather than <a href="qwidget.html#y">QWidget::y</a>() for widgets added to the view.
|
---|
409 | <p> This function returns 0 if <em>child</em> has not been added to the view.
|
---|
410 |
|
---|
411 | <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="clipper"></a>QScrollView::clipper () const
|
---|
412 | </h3>
|
---|
413 | Returns the clipper widget. Contents in the scrollview are
|
---|
414 | ultimately clipped to be inside the clipper widget.
|
---|
415 | <p> You should not need to use this function.
|
---|
416 | <p> <p>See also <a href="#visibleWidth-prop">visibleWidth</a> and <a href="#visibleHeight-prop">visibleHeight</a>.
|
---|
417 |
|
---|
418 | <h3 class=fn>void <a name="contentsContextMenuEvent"></a>QScrollView::contentsContextMenuEvent ( <a href="qcontextmenuevent.html">QContextMenuEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
419 | </h3>
|
---|
420 | This event handler is called whenever the QScrollView receives a
|
---|
421 | <a href="qwidget.html#contextMenuEvent">contextMenuEvent</a>() in <em>e</em>: the mouse position is translated to
|
---|
422 | be a point on the contents.
|
---|
423 |
|
---|
424 | <p>Example: <a href="tutorial2-06.html#x2584">chart/canvasview.cpp</a>.
|
---|
425 | <h3 class=fn>void <a name="contentsDragEnterEvent"></a>QScrollView::contentsDragEnterEvent ( <a href="qdragenterevent.html">QDragEnterEvent</a> * )<tt> [virtual protected]</tt>
|
---|
426 | </h3>
|
---|
427 | This event handler is called whenever the QScrollView receives a
|
---|
428 | <a href="qwidget.html#dragEnterEvent">dragEnterEvent</a>(): the drag position is translated to be a point
|
---|
429 | on the contents.
|
---|
430 |
|
---|
431 | <p>Reimplemented in <a href="qtable.html#contentsDragEnterEvent">QTable</a>.
|
---|
432 | <h3 class=fn>void <a name="contentsDragLeaveEvent"></a>QScrollView::contentsDragLeaveEvent ( <a href="qdragleaveevent.html">QDragLeaveEvent</a> * )<tt> [virtual protected]</tt>
|
---|
433 | </h3>
|
---|
434 | This event handler is called whenever the QScrollView receives a
|
---|
435 | <a href="qwidget.html#dragLeaveEvent">dragLeaveEvent</a>(): the drag position is translated to be a point
|
---|
436 | on the contents.
|
---|
437 |
|
---|
438 | <p>Reimplemented in <a href="qtable.html#contentsDragLeaveEvent">QTable</a>.
|
---|
439 | <h3 class=fn>void <a name="contentsDragMoveEvent"></a>QScrollView::contentsDragMoveEvent ( <a href="qdragmoveevent.html">QDragMoveEvent</a> * )<tt> [virtual protected]</tt>
|
---|
440 | </h3>
|
---|
441 | This event handler is called whenever the QScrollView receives a
|
---|
442 | <a href="qwidget.html#dragMoveEvent">dragMoveEvent</a>(): the drag position is translated to be a point on
|
---|
443 | the contents.
|
---|
444 |
|
---|
445 | <p>Reimplemented in <a href="qtable.html#contentsDragMoveEvent">QTable</a>.
|
---|
446 | <h3 class=fn>void <a name="contentsDropEvent"></a>QScrollView::contentsDropEvent ( <a href="qdropevent.html">QDropEvent</a> * )<tt> [virtual protected]</tt>
|
---|
447 | </h3>
|
---|
448 | This event handler is called whenever the QScrollView receives a
|
---|
449 | <a href="qwidget.html#dropEvent">dropEvent</a>(): the drop position is translated to be a point on the
|
---|
450 | contents.
|
---|
451 |
|
---|
452 | <p>Reimplemented in <a href="qtable.html#contentsDropEvent">QTable</a>.
|
---|
453 | <h3 class=fn>int <a name="contentsHeight"></a>QScrollView::contentsHeight () const
|
---|
454 | </h3><p>Returns the height of the contents area.
|
---|
455 | See the <a href="qscrollview.html#contentsHeight-prop">"contentsHeight"</a> property for details.
|
---|
456 | <h3 class=fn>void <a name="contentsMouseDoubleClickEvent"></a>QScrollView::contentsMouseDoubleClickEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
457 | </h3>
|
---|
458 | This event handler is called whenever the QScrollView receives a
|
---|
459 | <a href="qwidget.html#mouseDoubleClickEvent">mouseDoubleClickEvent</a>(): the click position in <em>e</em> is translated to be a
|
---|
460 | point on the contents.
|
---|
461 | <p> The default implementation generates a normal mouse press event.
|
---|
462 |
|
---|
463 | <p>Reimplemented in <a href="qlistview.html#contentsMouseDoubleClickEvent">QListView</a>.
|
---|
464 | <h3 class=fn>void <a name="contentsMouseMoveEvent"></a>QScrollView::contentsMouseMoveEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
465 | </h3>
|
---|
466 | This event handler is called whenever the QScrollView receives a
|
---|
467 | <a href="qwidget.html#mouseMoveEvent">mouseMoveEvent</a>(): the mouse position in <em>e</em> is translated to be a point
|
---|
468 | on the contents.
|
---|
469 |
|
---|
470 | <p>Examples: <a href="canvas-example.html#x2950">canvas/canvas.cpp</a> and <a href="tutorial2-06.html#x2585">chart/canvasview.cpp</a>.
|
---|
471 | <p>Reimplemented in <a href="qlistview.html#contentsMouseMoveEvent">QListView</a>.
|
---|
472 | <h3 class=fn>void <a name="contentsMousePressEvent"></a>QScrollView::contentsMousePressEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
473 | </h3>
|
---|
474 | This event handler is called whenever the QScrollView receives a
|
---|
475 | <a href="qwidget.html#mousePressEvent">mousePressEvent</a>(): the press position in <em>e</em> is translated to be a point
|
---|
476 | on the contents.
|
---|
477 |
|
---|
478 | <p>Examples: <a href="canvas-example.html#x2951">canvas/canvas.cpp</a> and <a href="tutorial2-06.html#x2586">chart/canvasview.cpp</a>.
|
---|
479 | <p>Reimplemented in <a href="qlistview.html#contentsMousePressEvent">QListView</a>.
|
---|
480 | <h3 class=fn>void <a name="contentsMouseReleaseEvent"></a>QScrollView::contentsMouseReleaseEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
481 | </h3>
|
---|
482 | This event handler is called whenever the QScrollView receives a
|
---|
483 | <a href="qwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>(): the release position in <em>e</em> is translated to be a
|
---|
484 | point on the contents.
|
---|
485 |
|
---|
486 | <p>Reimplemented in <a href="qlistview.html#contentsMouseReleaseEvent">QListView</a>.
|
---|
487 | <h3 class=fn>void <a name="contentsMoving"></a>QScrollView::contentsMoving ( int x, int y )<tt> [signal]</tt>
|
---|
488 | </h3>
|
---|
489 |
|
---|
490 | <p> This signal is emitted just before the contents are moved to
|
---|
491 | position <em>(x, y)</em>.
|
---|
492 | <p> <p>See also <a href="#contentsX-prop">contentsX</a> and <a href="#contentsY-prop">contentsY</a>.
|
---|
493 |
|
---|
494 | <h3 class=fn>void <a name="contentsToViewport"></a>QScrollView::contentsToViewport ( int x, int y, int & vx, int & vy ) const
|
---|
495 | </h3>
|
---|
496 | Translates a point (<em>x</em>, <em>y</em>) in the contents to a point (<em>vx</em>,
|
---|
497 | <em>vy</em>) on the <a href="#viewport">viewport</a>() widget.
|
---|
498 |
|
---|
499 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="contentsToViewport-2"></a>QScrollView::contentsToViewport ( const <a href="qpoint.html">QPoint</a> & p ) const
|
---|
500 | </h3>
|
---|
501 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
502 | <p> Returns the point <em>p</em> translated to a point on the <a href="#viewport">viewport</a>()
|
---|
503 | widget.
|
---|
504 |
|
---|
505 | <h3 class=fn>void <a name="contentsWheelEvent"></a>QScrollView::contentsWheelEvent ( <a href="qwheelevent.html">QWheelEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
506 | </h3>
|
---|
507 | This event handler is called whenever the QScrollView receives a
|
---|
508 | <a href="qwidget.html#wheelEvent">wheelEvent</a>() in <em>e</em>: the mouse position is translated to be a
|
---|
509 | point on the contents.
|
---|
510 |
|
---|
511 | <h3 class=fn>int <a name="contentsWidth"></a>QScrollView::contentsWidth () const
|
---|
512 | </h3><p>Returns the width of the contents area.
|
---|
513 | See the <a href="qscrollview.html#contentsWidth-prop">"contentsWidth"</a> property for details.
|
---|
514 | <h3 class=fn>int <a name="contentsX"></a>QScrollView::contentsX () const
|
---|
515 | </h3><p>Returns the X coordinate of the contents that are at the left edge of the viewport.
|
---|
516 | See the <a href="qscrollview.html#contentsX-prop">"contentsX"</a> property for details.
|
---|
517 | <h3 class=fn>int <a name="contentsY"></a>QScrollView::contentsY () const
|
---|
518 | </h3><p>Returns the Y coordinate of the contents that are at the top edge of the viewport.
|
---|
519 | See the <a href="qscrollview.html#contentsY-prop">"contentsY"</a> property for details.
|
---|
520 | <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="cornerWidget"></a>QScrollView::cornerWidget () const
|
---|
521 | </h3>
|
---|
522 | Returns the widget in the corner between the two scroll bars.
|
---|
523 | <p> By default, no corner widget is present.
|
---|
524 |
|
---|
525 | <p>Example: <a href="scrollview-example.html#x647">scrollview/scrollview.cpp</a>.
|
---|
526 | <h3 class=fn>bool <a name="dragAutoScroll"></a>QScrollView::dragAutoScroll () const
|
---|
527 | </h3><p>Returns TRUE if autoscrolling in drag move events is enabled; otherwise returns FALSE.
|
---|
528 | See the <a href="qscrollview.html#dragAutoScroll-prop">"dragAutoScroll"</a> property for details.
|
---|
529 | <h3 class=fn>void <a name="drawContents"></a>QScrollView::drawContents ( <a href="qpainter.html">QPainter</a> * p, int clipx, int clipy, int clipw, int cliph )<tt> [virtual protected]</tt>
|
---|
530 | </h3>
|
---|
531 |
|
---|
532 | <p> Reimplement this function if you are viewing a drawing area rather
|
---|
533 | than a widget.
|
---|
534 | <p> The function should draw the rectangle (<em>clipx</em>, <em>clipy</em>, <em>clipw</em>, <em>cliph</em>) of the contents using painter <em>p</em>. The clip
|
---|
535 | rectangle is in the scrollview's coordinates.
|
---|
536 | <p> For example:
|
---|
537 | <pre>
|
---|
538 | {
|
---|
539 | // Fill a 40000 by 50000 rectangle at (100000,150000)
|
---|
540 |
|
---|
541 | // Calculate the coordinates...
|
---|
542 | int x1 = 100000, y1 = 150000;
|
---|
543 | int x2 = x1+40000-1, y2 = y1+50000-1;
|
---|
544 |
|
---|
545 | // Clip the coordinates so X/Windows will not have problems...
|
---|
546 | if (x1 < clipx) x1=clipx;
|
---|
547 | if (y1 < clipy) y1=clipy;
|
---|
548 | if (x2 > clipx+clipw-1) x2=clipx+clipw-1;
|
---|
549 | if (y2 > clipy+cliph-1) y2=clipy+cliph-1;
|
---|
550 |
|
---|
551 | // Paint using the small coordinates...
|
---|
552 | if ( x2 >= x1 && y2 >= y1 )
|
---|
553 | p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red);
|
---|
554 | }
|
---|
555 | </pre>
|
---|
556 |
|
---|
557 | <p> The clip rectangle and translation of the painter <em>p</em> is already
|
---|
558 | set appropriately.
|
---|
559 |
|
---|
560 | <p>Example: <a href="qdir-example.html#x1837">qdir/qdir.cpp</a>.
|
---|
561 | <p>Reimplemented in <a href="qcanvasview.html#drawContents">QCanvasView</a> and <a href="qtable.html#drawContents">QTable</a>.
|
---|
562 | <h3 class=fn>void <a name="drawContentsOffset"></a>QScrollView::drawContentsOffset ( <a href="qpainter.html">QPainter</a> * p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph )<tt> [virtual protected]</tt>
|
---|
563 | </h3>
|
---|
564 | For backward-compatibility only. It is easier to use
|
---|
565 | <a href="#drawContents">drawContents</a>(<a href="qpainter.html">QPainter</a>*,int,int,int,int).
|
---|
566 | <p> The default implementation translates the painter appropriately
|
---|
567 | and calls drawContents(QPainter*,int,int,int,int). See
|
---|
568 | drawContents() for an explanation of the parameters <em>p</em>, <em>offsetx</em>, <em>offsety</em>, <em>clipx</em>, <em>clipy</em>, <em>clipw</em> and <em>cliph</em>.
|
---|
569 |
|
---|
570 | <p>Reimplemented in <a href="qlistview.html#drawContentsOffset">QListView</a>.
|
---|
571 | <h3 class=fn>void <a name="enableClipper"></a>QScrollView::enableClipper ( bool y )
|
---|
572 | </h3>
|
---|
573 | When a large numbers of child widgets are in a scrollview,
|
---|
574 | especially if they are close together, the scrolling performance
|
---|
575 | can suffer greatly. If <em>y</em> is TRUE the scrollview will use an
|
---|
576 | extra widget to group child widgets.
|
---|
577 | <p> Note that you may only call <a href="#enableClipper">enableClipper</a>() prior to adding
|
---|
578 | widgets.
|
---|
579 | <p> For a full discussion, see this class's <a href="#enableclipper">detailed description</a>.
|
---|
580 |
|
---|
581 | <p>Example: <a href="scrollview-example.html#x648">scrollview/scrollview.cpp</a>.
|
---|
582 | <h3 class=fn>void <a name="ensureVisible"></a>QScrollView::ensureVisible ( int x, int y )<tt> [slot]</tt>
|
---|
583 | </h3>
|
---|
584 | Scrolls the content so that the point <em>(x, y)</em> is visible with at
|
---|
585 | least 50-pixel margins (if possible, otherwise centered).
|
---|
586 |
|
---|
587 | <h3 class=fn>void <a name="ensureVisible-2"></a>QScrollView::ensureVisible ( int x, int y, int xmargin, int ymargin )<tt> [slot]</tt>
|
---|
588 | </h3>
|
---|
589 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
590 | <p> Scrolls the content so that the point <em>(x, y)</em> is visible with at
|
---|
591 | least the <em>xmargin</em> and <em>ymargin</em> margins (if possible,
|
---|
592 | otherwise centered).
|
---|
593 |
|
---|
594 | <h3 class=fn>bool <a name="eventFilter"></a>QScrollView::eventFilter ( <a href="qobject.html">QObject</a> * obj, <a href="qevent.html">QEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
595 | </h3>
|
---|
596 | This event filter ensures the scroll bars are updated when a
|
---|
597 | single contents widget is resized, shown, hidden or destroyed; it
|
---|
598 | passes mouse events to the QScrollView. The event is in <em>e</em> and
|
---|
599 | the object is in <em>obj</em>.
|
---|
600 |
|
---|
601 | <p>Reimplemented from <a href="qobject.html#eventFilter">QObject</a>.
|
---|
602 | <p>Reimplemented in <a href="qlistview.html#eventFilter">QListView</a>.
|
---|
603 | <h3 class=fn><a href="qscrollview.html#ScrollBarMode-enum">ScrollBarMode</a> <a name="hScrollBarMode"></a>QScrollView::hScrollBarMode () const
|
---|
604 | </h3><p>Returns the mode for the horizontal scroll bar.
|
---|
605 | See the <a href="qscrollview.html#hScrollBarMode-prop">"hScrollBarMode"</a> property for details.
|
---|
606 | <h3 class=fn>bool <a name="hasStaticBackground"></a>QScrollView::hasStaticBackground () const
|
---|
607 | </h3>
|
---|
608 | Returns TRUE if QScrollView uses a static background; otherwise
|
---|
609 | returns FALSE.
|
---|
610 | <p> <p>See also <a href="#setStaticBackground">setStaticBackground</a>().
|
---|
611 |
|
---|
612 | <h3 class=fn><a href="qscrollbar.html">QScrollBar</a> * <a name="horizontalScrollBar"></a>QScrollView::horizontalScrollBar () const
|
---|
613 | </h3>
|
---|
614 | Returns the component horizontal scroll bar. It is made available
|
---|
615 | to allow accelerators, autoscrolling, etc.
|
---|
616 | <p> It should not be used for other purposes.
|
---|
617 | <p> This function never returns 0.
|
---|
618 |
|
---|
619 | <h3 class=fn>void <a name="horizontalSliderPressed"></a>QScrollView::horizontalSliderPressed ()<tt> [signal]</tt>
|
---|
620 | </h3>
|
---|
621 |
|
---|
622 | <p> This signal is emitted whenever the user presses the horizontal slider.
|
---|
623 |
|
---|
624 | <h3 class=fn>void <a name="horizontalSliderReleased"></a>QScrollView::horizontalSliderReleased ()<tt> [signal]</tt>
|
---|
625 | </h3>
|
---|
626 |
|
---|
627 | <p> This signal is emitted whenever the user releases the horizontal slider.
|
---|
628 |
|
---|
629 | <h3 class=fn>bool <a name="isHorizontalSliderPressed"></a>QScrollView::isHorizontalSliderPressed ()
|
---|
630 | </h3>
|
---|
631 | Returns TRUE if horizontal slider is pressed by user; otherwise returns FALSE.
|
---|
632 |
|
---|
633 | <h3 class=fn>bool <a name="isVerticalSliderPressed"></a>QScrollView::isVerticalSliderPressed ()
|
---|
634 | </h3>
|
---|
635 | Returns TRUE if vertical slider is pressed by user; otherwise returns FALSE.
|
---|
636 |
|
---|
637 | <h3 class=fn>int <a name="leftMargin"></a>QScrollView::leftMargin () const<tt> [protected]</tt>
|
---|
638 | </h3>
|
---|
639 | Returns the left margin.
|
---|
640 | <p> <p>See also <a href="#setMargins">setMargins</a>().
|
---|
641 |
|
---|
642 | <h3 class=fn>void <a name="moveChild"></a>QScrollView::moveChild ( <a href="qwidget.html">QWidget</a> * child, int x, int y )<tt> [virtual]</tt>
|
---|
643 | </h3>
|
---|
644 | Repositions the <em>child</em> widget to (<em>x</em>, <em>y</em>). This function is
|
---|
645 | the same as <a href="#addChild">addChild</a>().
|
---|
646 |
|
---|
647 | <h3 class=fn>void <a name="removeChild"></a>QScrollView::removeChild ( <a href="qwidget.html">QWidget</a> * child )
|
---|
648 | </h3>
|
---|
649 | Removes the <em>child</em> widget from the scrolled area. Note that this
|
---|
650 | happens automatically if the <em>child</em> is deleted.
|
---|
651 |
|
---|
652 | <h3 class=fn>void <a name="repaintContents"></a>QScrollView::repaintContents ( int x, int y, int w, int h, bool erase = TRUE )
|
---|
653 | </h3>
|
---|
654 | Calls <a href="qwidget.html#repaint">repaint</a>() on a rectangle defined by <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>,
|
---|
655 | translated appropriately. If the rectangle is not visible, nothing
|
---|
656 | is repainted. If <em>erase</em> is TRUE the background is cleared using
|
---|
657 | the background color.
|
---|
658 | <p> <p>See also <a href="#updateContents">updateContents</a>().
|
---|
659 |
|
---|
660 | <h3 class=fn>void <a name="repaintContents-2"></a>QScrollView::repaintContents ( const <a href="qrect.html">QRect</a> & r, bool erase = TRUE )
|
---|
661 | </h3>
|
---|
662 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
663 | <p> Repaints the contents of rectangle <em>r</em>. If <em>erase</em> is TRUE the
|
---|
664 | background is cleared using the background color.
|
---|
665 |
|
---|
666 | <h3 class=fn>void <a name="repaintContents-3"></a>QScrollView::repaintContents ( bool erase = TRUE )
|
---|
667 | </h3>
|
---|
668 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
669 | <p> Repaints the contents. If <em>erase</em> is TRUE the background is
|
---|
670 | cleared using the background color.
|
---|
671 |
|
---|
672 | <h3 class=fn>void <a name="resizeContents"></a>QScrollView::resizeContents ( int w, int h )<tt> [virtual slot]</tt>
|
---|
673 | </h3>
|
---|
674 | Sets the size of the contents area to <em>w</em> pixels wide and <em>h</em>
|
---|
675 | pixels high and updates the viewport accordingly.
|
---|
676 |
|
---|
677 | <h3 class=fn><a href="qscrollview.html#ResizePolicy-enum">ResizePolicy</a> <a name="resizePolicy"></a>QScrollView::resizePolicy () const
|
---|
678 | </h3><p>Returns the resize policy.
|
---|
679 | See the <a href="qscrollview.html#resizePolicy-prop">"resizePolicy"</a> property for details.
|
---|
680 | <h3 class=fn>int <a name="rightMargin"></a>QScrollView::rightMargin () const<tt> [protected]</tt>
|
---|
681 | </h3>
|
---|
682 | Returns the right margin.
|
---|
683 | <p> <p>See also <a href="#setMargins">setMargins</a>().
|
---|
684 |
|
---|
685 | <h3 class=fn>void <a name="scrollBy"></a>QScrollView::scrollBy ( int dx, int dy )<tt> [slot]</tt>
|
---|
686 | </h3>
|
---|
687 | Scrolls the content by <em>dx</em> to the left and <em>dy</em> upwards.
|
---|
688 |
|
---|
689 | <h3 class=fn>void <a name="setContentsPos"></a>QScrollView::setContentsPos ( int x, int y )<tt> [virtual slot]</tt>
|
---|
690 | </h3>
|
---|
691 | Scrolls the content so that the point <em>(x, y)</em> is in the top-left
|
---|
692 | corner.
|
---|
693 |
|
---|
694 | <p>Example: <a href="process-example.html#x102">process/process.cpp</a>.
|
---|
695 | <h3 class=fn>void <a name="setCornerWidget"></a>QScrollView::setCornerWidget ( <a href="qwidget.html">QWidget</a> * corner )<tt> [virtual]</tt>
|
---|
696 | </h3>
|
---|
697 | Sets the widget in the <em>corner</em> between the two scroll bars.
|
---|
698 | <p> You will probably also want to set at least one of the scroll bar
|
---|
699 | modes to <a href="#ScrollBarMode-enum">AlwaysOn</a>.
|
---|
700 | <p> Passing 0 shows no widget in the corner.
|
---|
701 | <p> Any previous <em>corner</em> widget is hidden.
|
---|
702 | <p> You may call <a href="#setCornerWidget">setCornerWidget</a>() with the same widget at different
|
---|
703 | times.
|
---|
704 | <p> All widgets set here will be deleted by the QScrollView when it is
|
---|
705 | destroyed unless you separately reparent the widget after setting
|
---|
706 | some other corner widget (or 0).
|
---|
707 | <p> Any <em>newly</em> set widget should have no current parent.
|
---|
708 | <p> By default, no corner widget is present.
|
---|
709 | <p> <p>See also <a href="#vScrollBarMode-prop">vScrollBarMode</a> and <a href="#hScrollBarMode-prop">hScrollBarMode</a>.
|
---|
710 |
|
---|
711 | <p>Example: <a href="scrollview-example.html#x651">scrollview/scrollview.cpp</a>.
|
---|
712 | <h3 class=fn>void <a name="setDragAutoScroll"></a>QScrollView::setDragAutoScroll ( bool b )<tt> [virtual]</tt>
|
---|
713 | </h3><p>Sets whether autoscrolling in drag move events is enabled to <em>b</em>.
|
---|
714 | See the <a href="qscrollview.html#dragAutoScroll-prop">"dragAutoScroll"</a> property for details.
|
---|
715 | <h3 class=fn>void <a name="setHBarGeometry"></a>QScrollView::setHBarGeometry ( <a href="qscrollbar.html">QScrollBar</a> & hbar, int x, int y, int w, int h )<tt> [virtual protected]</tt>
|
---|
716 | </h3>
|
---|
717 | Called when the horizontal scroll bar geometry changes. This is
|
---|
718 | provided as a protected function so that subclasses can do
|
---|
719 | interesting things such as providing extra buttons in some of the
|
---|
720 | space normally used by the scroll bars.
|
---|
721 | <p> The default implementation simply gives all the space to <em>hbar</em>.
|
---|
722 | The new geometry is given by <em>x</em>, <em>y</em>, <em>w</em> and <em>h</em>.
|
---|
723 | <p> <p>See also <a href="#setVBarGeometry">setVBarGeometry</a>().
|
---|
724 |
|
---|
725 | <h3 class=fn>void <a name="setHScrollBarMode"></a>QScrollView::setHScrollBarMode ( <a href="qscrollview.html#ScrollBarMode-enum">ScrollBarMode</a> )<tt> [virtual]</tt>
|
---|
726 | </h3><p>Sets the mode for the horizontal scroll bar.
|
---|
727 | See the <a href="qscrollview.html#hScrollBarMode-prop">"hScrollBarMode"</a> property for details.
|
---|
728 | <h3 class=fn>void <a name="setMargins"></a>QScrollView::setMargins ( int left, int top, int right, int bottom )<tt> [virtual protected]</tt>
|
---|
729 | </h3>
|
---|
730 | Sets the margins around the scrolling area to <em>left</em>, <em>top</em>, <em>right</em> and <em>bottom</em>. This is useful for applications such as
|
---|
731 | spreadsheets with "locked" rows and columns. The marginal space is
|
---|
732 | <em>inside</em> the <a href="qframe.html#frameRect">frameRect</a>() and is left blank; reimplement
|
---|
733 | <a href="qframe.html#drawFrame">drawFrame</a>() or put widgets in the unused area.
|
---|
734 | <p> By default all margins are zero.
|
---|
735 | <p> <p>See also <a href="qframe.html#frameChanged">frameChanged</a>().
|
---|
736 |
|
---|
737 | <h3 class=fn>void <a name="setResizePolicy"></a>QScrollView::setResizePolicy ( <a href="qscrollview.html#ResizePolicy-enum">ResizePolicy</a> )<tt> [virtual]</tt>
|
---|
738 | </h3><p>Sets the resize policy.
|
---|
739 | See the <a href="qscrollview.html#resizePolicy-prop">"resizePolicy"</a> property for details.
|
---|
740 | <h3 class=fn>void <a name="setStaticBackground"></a>QScrollView::setStaticBackground ( bool y )
|
---|
741 | </h3>
|
---|
742 | Sets the scrollview to have a static background if <em>y</em> is TRUE,
|
---|
743 | or a scrolling background if <em>y</em> is FALSE. By default, the
|
---|
744 | background is scrolling.
|
---|
745 | <p> Be aware that this mode is quite slow, as a full repaint of the
|
---|
746 | visible area has to be triggered on every contents move.
|
---|
747 | <p> <p>See also <a href="#hasStaticBackground">hasStaticBackground</a>().
|
---|
748 |
|
---|
749 | <h3 class=fn>void <a name="setVBarGeometry"></a>QScrollView::setVBarGeometry ( <a href="qscrollbar.html">QScrollBar</a> & vbar, int x, int y, int w, int h )<tt> [virtual protected]</tt>
|
---|
750 | </h3>
|
---|
751 | Called when the vertical scroll bar geometry changes. This is
|
---|
752 | provided as a protected function so that subclasses can do
|
---|
753 | interesting things such as providing extra buttons in some of the
|
---|
754 | space normally used by the scroll bars.
|
---|
755 | <p> The default implementation simply gives all the space to <em>vbar</em>.
|
---|
756 | The new geometry is given by <em>x</em>, <em>y</em>, <em>w</em> and <em>h</em>.
|
---|
757 | <p> <p>See also <a href="#setHBarGeometry">setHBarGeometry</a>().
|
---|
758 |
|
---|
759 | <h3 class=fn>void <a name="setVScrollBarMode"></a>QScrollView::setVScrollBarMode ( <a href="qscrollview.html#ScrollBarMode-enum">ScrollBarMode</a> )<tt> [virtual]</tt>
|
---|
760 | </h3><p>Sets the mode for the vertical scroll bar.
|
---|
761 | See the <a href="qscrollview.html#vScrollBarMode-prop">"vScrollBarMode"</a> property for details.
|
---|
762 | <h3 class=fn>void <a name="showChild"></a>QScrollView::showChild ( <a href="qwidget.html">QWidget</a> * child, bool y = TRUE )
|
---|
763 | </h3>
|
---|
764 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
765 | <p> Sets the visibility of <em>child</em>. Equivalent to
|
---|
766 | <a href="qwidget.html#show">QWidget::show</a>() or <a href="qwidget.html#hide">QWidget::hide</a>().
|
---|
767 |
|
---|
768 | <h3 class=fn>int <a name="topMargin"></a>QScrollView::topMargin () const<tt> [protected]</tt>
|
---|
769 | </h3>
|
---|
770 | Returns the top margin.
|
---|
771 | <p> <p>See also <a href="#setMargins">setMargins</a>().
|
---|
772 |
|
---|
773 | <h3 class=fn>void <a name="updateContents"></a>QScrollView::updateContents ( int x, int y, int w, int h )
|
---|
774 | </h3>
|
---|
775 | Calls <a href="qwidget.html#update">update</a>() on a rectangle defined by <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>,
|
---|
776 | translated appropriately. If the rectangle is not visible, nothing
|
---|
777 | is repainted.
|
---|
778 | <p> <p>See also <a href="#repaintContents">repaintContents</a>().
|
---|
779 |
|
---|
780 | <h3 class=fn>void <a name="updateContents-2"></a>QScrollView::updateContents ( const <a href="qrect.html">QRect</a> & r )
|
---|
781 | </h3>
|
---|
782 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
783 | <p> Updates the contents in rectangle <em>r</em>
|
---|
784 |
|
---|
785 | <h3 class=fn>void <a name="updateContents-3"></a>QScrollView::updateContents ()
|
---|
786 | </h3>
|
---|
787 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
788 | <p>
|
---|
789 | <h3 class=fn>void <a name="updateScrollBars"></a>QScrollView::updateScrollBars ()<tt> [slot]</tt>
|
---|
790 | </h3>
|
---|
791 | Updates scroll bars: all possibilities are considered. You should
|
---|
792 | never need to call this in your code.
|
---|
793 |
|
---|
794 | <h3 class=fn><a href="qscrollview.html#ScrollBarMode-enum">ScrollBarMode</a> <a name="vScrollBarMode"></a>QScrollView::vScrollBarMode () const
|
---|
795 | </h3><p>Returns the mode for the vertical scroll bar.
|
---|
796 | See the <a href="qscrollview.html#vScrollBarMode-prop">"vScrollBarMode"</a> property for details.
|
---|
797 | <h3 class=fn><a href="qscrollbar.html">QScrollBar</a> * <a name="verticalScrollBar"></a>QScrollView::verticalScrollBar () const
|
---|
798 | </h3>
|
---|
799 | Returns the component vertical scroll bar. It is made available to
|
---|
800 | allow accelerators, autoscrolling, etc.
|
---|
801 | <p> It should not be used for other purposes.
|
---|
802 | <p> This function never returns 0.
|
---|
803 |
|
---|
804 | <h3 class=fn>void <a name="verticalSliderPressed"></a>QScrollView::verticalSliderPressed ()<tt> [signal]</tt>
|
---|
805 | </h3>
|
---|
806 |
|
---|
807 | <p> This signal is emitted whenever the user presses the vertical slider.
|
---|
808 |
|
---|
809 | <h3 class=fn>void <a name="verticalSliderReleased"></a>QScrollView::verticalSliderReleased ()<tt> [signal]</tt>
|
---|
810 | </h3>
|
---|
811 |
|
---|
812 | <p> This signal is emitted whenever the user releases the vertical slider.
|
---|
813 |
|
---|
814 | <h3 class=fn><a href="qwidget.html">QWidget</a> * <a name="viewport"></a>QScrollView::viewport () const
|
---|
815 | </h3>
|
---|
816 | Returns the viewport widget of the scrollview. This is the widget
|
---|
817 | containing the contents widget or which is the drawing area.
|
---|
818 |
|
---|
819 | <p>Examples: <a href="helpsystem-example.html#x2683">helpsystem/tooltip.cpp</a> and <a href="scrollview-example.html#x655">scrollview/scrollview.cpp</a>.
|
---|
820 | <h3 class=fn>void <a name="viewportPaintEvent"></a>QScrollView::viewportPaintEvent ( <a href="qpaintevent.html">QPaintEvent</a> * pe )<tt> [virtual protected]</tt>
|
---|
821 | </h3>
|
---|
822 | This is a low-level painting routine that draws the viewport
|
---|
823 | contents. Reimplement this if <a href="#drawContents">drawContents</a>() is too high-level
|
---|
824 | (for example, if you don't want to open a <a href="qpainter.html">QPainter</a> on the
|
---|
825 | viewport). The paint event is passed in <em>pe</em>.
|
---|
826 |
|
---|
827 | <h3 class=fn>void <a name="viewportResizeEvent"></a>QScrollView::viewportResizeEvent ( <a href="qresizeevent.html">QResizeEvent</a> * )<tt> [virtual protected]</tt>
|
---|
828 | </h3>
|
---|
829 | To provide simple processing of events on the contents, this
|
---|
830 | function receives all resize events sent to the viewport.
|
---|
831 | <p> <p>See also <a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().
|
---|
832 |
|
---|
833 | <p>Example: <a href="tutorial2-06.html#x2587">chart/canvasview.cpp</a>.
|
---|
834 | <h3 class=fn><a href="qsize.html">QSize</a> <a name="viewportSize"></a>QScrollView::viewportSize ( int x, int y ) const
|
---|
835 | </h3>
|
---|
836 | Returns the viewport size for size (<em>x</em>, <em>y</em>).
|
---|
837 | <p> The viewport size depends on <em>(x, y)</em> (the size of the contents),
|
---|
838 | the size of this widget and the modes of the horizontal and
|
---|
839 | vertical scroll bars.
|
---|
840 | <p> This function permits widgets that can trade vertical and
|
---|
841 | horizontal space for each other to control scroll bar appearance
|
---|
842 | better. For example, a word processor or web browser can control
|
---|
843 | the width of the right margin accurately, whether or not there
|
---|
844 | needs to be a vertical scroll bar.
|
---|
845 |
|
---|
846 | <h3 class=fn>void <a name="viewportToContents"></a>QScrollView::viewportToContents ( int vx, int vy, int & x, int & y ) const
|
---|
847 | </h3>
|
---|
848 | Translates a point (<em>vx</em>, <em>vy</em>) on the <a href="#viewport">viewport</a>() widget to a
|
---|
849 | point (<em>x</em>, <em>y</em>) in the contents.
|
---|
850 |
|
---|
851 | <h3 class=fn><a href="qpoint.html">QPoint</a> <a name="viewportToContents-2"></a>QScrollView::viewportToContents ( const <a href="qpoint.html">QPoint</a> & vp ) const
|
---|
852 | </h3>
|
---|
853 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
854 | <p> Returns the point on the viewport <em>vp</em> translated to a point in
|
---|
855 | the contents.
|
---|
856 |
|
---|
857 | <h3 class=fn>int <a name="visibleHeight"></a>QScrollView::visibleHeight () const
|
---|
858 | </h3><p>Returns the vertical amount of the content that is visible.
|
---|
859 | See the <a href="qscrollview.html#visibleHeight-prop">"visibleHeight"</a> property for details.
|
---|
860 | <h3 class=fn>int <a name="visibleWidth"></a>QScrollView::visibleWidth () const
|
---|
861 | </h3><p>Returns the horizontal amount of the content that is visible.
|
---|
862 | See the <a href="qscrollview.html#visibleWidth-prop">"visibleWidth"</a> property for details.
|
---|
863 | <hr><h2>Property Documentation</h2>
|
---|
864 | <h3 class=fn>int <a name="contentsHeight-prop"></a>contentsHeight</h3>
|
---|
865 | <p>This property holds the height of the contents area.
|
---|
866 | <p>
|
---|
867 | <p>Get this property's value with <a href="#contentsHeight">contentsHeight</a>().
|
---|
868 | <h3 class=fn>int <a name="contentsWidth-prop"></a>contentsWidth</h3>
|
---|
869 | <p>This property holds the width of the contents area.
|
---|
870 | <p>
|
---|
871 | <p>Get this property's value with <a href="#contentsWidth">contentsWidth</a>().
|
---|
872 | <h3 class=fn>int <a name="contentsX-prop"></a>contentsX</h3>
|
---|
873 | <p>This property holds the X coordinate of the contents that are at the left edge of the viewport.
|
---|
874 | <p>
|
---|
875 | <p>Get this property's value with <a href="#contentsX">contentsX</a>().
|
---|
876 | <h3 class=fn>int <a name="contentsY-prop"></a>contentsY</h3>
|
---|
877 | <p>This property holds the Y coordinate of the contents that are at the top edge of the viewport.
|
---|
878 | <p>
|
---|
879 | <p>Get this property's value with <a href="#contentsY">contentsY</a>().
|
---|
880 | <h3 class=fn>bool <a name="dragAutoScroll-prop"></a>dragAutoScroll</h3>
|
---|
881 | <p>This property holds whether autoscrolling in drag move events is enabled.
|
---|
882 | <p>If this property is set to TRUE (the default), the QScrollView
|
---|
883 | automatically scrolls the contents in drag move events if the user
|
---|
884 | moves the cursor close to a border of the view. Of course this
|
---|
885 | works only if the viewport accepts drops. Specifying FALSE
|
---|
886 | disables this autoscroll feature.
|
---|
887 | <p> <b>Warning:</b> Enabling this property might not be enough to
|
---|
888 | effectively turn on autoscrolling. If you put a custom widget in
|
---|
889 | the QScrollView, you might need to call QDragEvent::ignore() on
|
---|
890 | the event in the <a href="qwidget.html#dragEnterEvent">dragEnterEvent</a>() and <a href="qwidget.html#dragMoveEvent">dragMoveEvent</a>()
|
---|
891 | reimplementations.
|
---|
892 |
|
---|
893 | <p>Set this property's value with <a href="#setDragAutoScroll">setDragAutoScroll</a>() and get this property's value with <a href="#dragAutoScroll">dragAutoScroll</a>().
|
---|
894 | <h3 class=fn><a href="qscrollview.html#ScrollBarMode-enum">ScrollBarMode</a> <a name="hScrollBarMode-prop"></a>hScrollBarMode</h3>
|
---|
895 | <p>This property holds the mode for the horizontal scroll bar.
|
---|
896 | <p>The default mode is <a href="#ScrollBarMode-enum">QScrollView::Auto</a>.
|
---|
897 | <p> <p>See also <a href="#vScrollBarMode-prop">vScrollBarMode</a>.
|
---|
898 |
|
---|
899 | <p>Set this property's value with <a href="#setHScrollBarMode">setHScrollBarMode</a>() and get this property's value with <a href="#hScrollBarMode">hScrollBarMode</a>().
|
---|
900 | <h3 class=fn><a href="qscrollview.html#ResizePolicy-enum">ResizePolicy</a> <a name="resizePolicy-prop"></a>resizePolicy</h3>
|
---|
901 | <p>This property holds the resize policy.
|
---|
902 | <p>The default is <a href="#ResizePolicy-enum">Default</a>.
|
---|
903 | <p> <p>See also <a href="#ResizePolicy-enum">ResizePolicy</a>.
|
---|
904 |
|
---|
905 | <p>Set this property's value with <a href="#setResizePolicy">setResizePolicy</a>() and get this property's value with <a href="#resizePolicy">resizePolicy</a>().
|
---|
906 | <h3 class=fn><a href="qscrollview.html#ScrollBarMode-enum">ScrollBarMode</a> <a name="vScrollBarMode-prop"></a>vScrollBarMode</h3>
|
---|
907 | <p>This property holds the mode for the vertical scroll bar.
|
---|
908 | <p>The default mode is <a href="#ScrollBarMode-enum">QScrollView::Auto</a>.
|
---|
909 | <p> <p>See also <a href="#hScrollBarMode-prop">hScrollBarMode</a>.
|
---|
910 |
|
---|
911 | <p>Set this property's value with <a href="#setVScrollBarMode">setVScrollBarMode</a>() and get this property's value with <a href="#vScrollBarMode">vScrollBarMode</a>().
|
---|
912 | <h3 class=fn>int <a name="visibleHeight-prop"></a>visibleHeight</h3>
|
---|
913 | <p>This property holds the vertical amount of the content that is visible.
|
---|
914 | <p>
|
---|
915 | <p>Get this property's value with <a href="#visibleHeight">visibleHeight</a>().
|
---|
916 | <h3 class=fn>int <a name="visibleWidth-prop"></a>visibleWidth</h3>
|
---|
917 | <p>This property holds the horizontal amount of the content that is visible.
|
---|
918 | <p>
|
---|
919 | <p>Get this property's value with <a href="#visibleWidth">visibleWidth</a>().
|
---|
920 | <!-- eof -->
|
---|
921 | <hr><p>
|
---|
922 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
923 | Copyright © 1995-2007
|
---|
924 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
925 | <table width=100% cellspacing=0 border=0><tr>
|
---|
926 | <td>Copyright © 2007
|
---|
927 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
928 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
929 | </table></div></address></body>
|
---|
930 | </html>
|
---|