📄 qscrollview.3qt
字号:
.br int x2 = x1+40000-1, y2 = y1+50000-1;.br.br // Clip the coordinates so X/Windows will not have problems....br if (x1 < clipx) x1=clipx;.br if (y1 < clipy) y1=clipy;.br if (x2 > clipx+clipw-1) x2=clipx+clipw-1;.br if (y2 > clipy+cliph-1) y2=clipy+cliph-1;.br.br // Paint using the small coordinates....br if ( x2 >= x1 && y2 >= y1 ).br p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red);.br }.br.fi.PPThe clip rectangle and translation of the painter \fIp\fR is already set appropriately..PPExample: qdir/qdir.cpp..PPReimplemented in QCanvasView and QTable..SH "void QScrollView::drawContentsOffset ( QPainter * p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph )\fC [virtual protected]\fR"For backward-compatibility only. It is easier to use drawContents(QPainter*,int,int,int,int)..PPThe default implementation translates the painter appropriately and calls drawContents(QPainter*,int,int,int,int). See drawContents() for an explanation of the parameters \fIp\fR, \fIoffsetx\fR, \fIoffsety\fR, \fIclipx\fR, \fIclipy\fR, \fIclipw\fR and \fIcliph\fR..PPReimplemented in QListView..SH "void QScrollView::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 \fIy\fR is TRUE the scrollview will use an extra widget to group child widgets..PPNote that you may only call enableClipper() prior to adding widgets..PPFor a full discussion, see this class's detailed description..PPExample: scrollview/scrollview.cpp..SH "void QScrollView::ensureVisible ( int x, int y )\fC [slot]\fR"Scrolls the content so that the point \fI(x, y)\fR is visible with at least 50-pixel margins (if possible, otherwise centered)..SH "void QScrollView::ensureVisible ( int x, int y, int xmargin, int ymargin )\fC [slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPScrolls the content so that the point \fI(x, y)\fR is visible with at least the \fIxmargin\fR and \fIymargin\fR margins (if possible, otherwise centered)..SH "bool QScrollView::eventFilter ( QObject * obj, QEvent * e )\fC [virtual protected]\fR"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 QScrollView. The event is in \fIe\fR and the object is in \fIobj\fR..PPReimplemented from QObject..PPReimplemented in QListView..SH "ScrollBarMode QScrollView::hScrollBarMode () const"Returns the mode for the horizontal scroll bar. See the "hScrollBarMode" property for details..SH "bool QScrollView::hasStaticBackground () const"Returns TRUE if QScrollView uses a static background; otherwise returns FALSE..PPSee also setStaticBackground()..SH "QScrollBar * QScrollView::horizontalScrollBar () const"Returns the component horizontal scroll bar. It is made available to allow accelerators, autoscrolling, etc..PPIt should not be used for other purposes..PPThis function never returns 0..SH "void QScrollView::horizontalSliderPressed ()\fC [signal]\fR"This signal is emitted whenever the user presses the horizontal slider..SH "void QScrollView::horizontalSliderReleased ()\fC [signal]\fR"This signal is emitted whenever the user releases the horizontal slider..SH "bool QScrollView::isHorizontalSliderPressed ()"Returns TRUE if horizontal slider is pressed by user; otherwise returns FALSE..SH "bool QScrollView::isVerticalSliderPressed ()"Returns TRUE if vertical slider is pressed by user; otherwise returns FALSE..SH "int QScrollView::leftMargin () const\fC [protected]\fR"Returns the left margin..PPSee also setMargins()..SH "void QScrollView::moveChild ( QWidget * child, int x, int y )\fC [virtual]\fR"Repositions the \fIchild\fR widget to (\fIx\fR, \fIy\fR). This function is the same as addChild()..SH "void QScrollView::removeChild ( QWidget * child )"Removes the \fIchild\fR widget from the scrolled area. Note that this happens automatically if the \fIchild\fR is deleted..SH "void QScrollView::repaintContents ( int x, int y, int w, int h, bool erase = TRUE )"Calls repaint() on a rectangle defined by \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR, translated appropriately. If the rectangle is not visible, nothing is repainted. If \fIerase\fR is TRUE the background is cleared using the background color..PPSee also updateContents()..SH "void QScrollView::repaintContents ( const QRect & r, bool erase = TRUE )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPRepaints the contents of rectangle \fIr\fR. If \fIerase\fR is TRUE the background is cleared using the background color..SH "void QScrollView::repaintContents ( bool erase = TRUE )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPRepaints the contents. If \fIerase\fR is TRUE the background is cleared using the background color..SH "void QScrollView::resizeContents ( int w, int h )\fC [virtual slot]\fR"Sets the size of the contents area to \fIw\fR pixels wide and \fIh\fR pixels high and updates the viewport accordingly..SH "ResizePolicy QScrollView::resizePolicy () const"Returns the resize policy. See the "resizePolicy" property for details..SH "int QScrollView::rightMargin () const\fC [protected]\fR"Returns the right margin..PPSee also setMargins()..SH "void QScrollView::scrollBy ( int dx, int dy )\fC [slot]\fR"Scrolls the content by \fIdx\fR to the left and \fIdy\fR upwards..SH "void QScrollView::setContentsPos ( int x, int y )\fC [virtual slot]\fR"Scrolls the content so that the point \fI(x, y)\fR is in the top-left corner..PPExample: process/process.cpp..SH "void QScrollView::setCornerWidget ( QWidget * corner )\fC [virtual]\fR"Sets the widget in the \fIcorner\fR between the two scroll bars..PPYou will probably also want to set at least one of the scroll bar modes to AlwaysOn..PPPassing 0 shows no widget in the corner..PPAny previous \fIcorner\fR widget is hidden..PPYou may call setCornerWidget() with the same widget at different times..PPAll widgets set here will be deleted by the QScrollView when it is destroyed unless you separately reparent the widget after setting some other corner widget (or 0)..PPAny \fInewly\fR set widget should have no current parent..PPBy default, no corner widget is present..PPSee also vScrollBarMode and hScrollBarMode..PPExample: scrollview/scrollview.cpp..SH "void QScrollView::setDragAutoScroll ( bool b )\fC [virtual]\fR"Sets whether autoscrolling in drag move events is enabled to \fIb\fR. See the "dragAutoScroll" property for details..SH "void QScrollView::setHBarGeometry ( QScrollBar & hbar, int x, int y, int w, int h )\fC [virtual protected]\fR"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..PPThe default implementation simply gives all the space to \fIhbar\fR. The new geometry is given by \fIx\fR, \fIy\fR, \fIw\fR and \fIh\fR..PPSee also setVBarGeometry()..SH "void QScrollView::setHScrollBarMode ( ScrollBarMode )\fC [virtual]\fR"Sets the mode for the horizontal scroll bar. See the "hScrollBarMode" property for details..SH "void QScrollView::setMargins ( int left, int top, int right, int bottom )\fC [virtual protected]\fR"Sets the margins around the scrolling area to \fIleft\fR, \fItop\fR, \fIright\fR and \fIbottom\fR. This is useful for applications such as spreadsheets with "locked" rows and columns. The marginal space is \fIinside\fR the frameRect() and is left blank; reimplement drawFrame() or put widgets in the unused area..PPBy default all margins are zero..PPSee also frameChanged()..SH "void QScrollView::setResizePolicy ( ResizePolicy )\fC [virtual]\fR"Sets the resize policy. See the "resizePolicy" property for details..SH "void QScrollView::setStaticBackground ( bool y )"Sets the scrollview to have a static background if \fIy\fR is TRUE, or a scrolling background if \fIy\fR is FALSE. By default, the background is scrolling..PPBe aware that this mode is quite slow, as a full repaint of the visible area has to be triggered on every contents move..PPSee also hasStaticBackground()..SH "void QScrollView::setVBarGeometry ( QScrollBar & vbar, int x, int y, int w, int h )\fC [virtual protected]\fR"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..PPThe default implementation simply gives all the space to \fIvbar\fR. The new geometry is given by \fIx\fR, \fIy\fR, \fIw\fR and \fIh\fR..PPSee also setHBarGeometry()..SH "void QScrollView::setVScrollBarMode ( ScrollBarMode )\fC [virtual]\fR"Sets the mode for the vertical scroll bar. See the "vScrollBarMode" property for details..SH "void QScrollView::showChild ( QWidget * child, bool y = TRUE )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPSets the visibility of \fIchild\fR. Equivalent to QWidget::show() or QWidget::hide()..SH "int QScrollView::topMargin () const\fC [protected]\fR"Returns the top margin..PPSee also setMargins()..SH "void QScrollView::updateContents ( int x, int y, int w, int h )"Calls update() on a rectangle defined by \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR, translated appropriately. If the rectangle is not visible, nothing is repainted..PPSee also repaintContents()..SH "void QScrollView::updateContents ( const QRect & r )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPUpdates the contents in rectangle \fIr\fR.SH "void QScrollView::updateContents ()"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..SH "void QScrollView::updateScrollBars ()\fC [slot]\fR"Updates scroll bars: all possibilities are considered. You should never need to call this in your code..SH "ScrollBarMode QScrollView::vScrollBarMode () const"Returns the mode for the vertical scroll bar. See the "vScrollBarMode" property for details..SH "QScrollBar * QScrollView::verticalScrollBar () const"Returns the component vertical scroll bar. It is made available to allow accelerators, autoscrolling, etc..PPIt should not be used for other purposes..PPThis function never returns 0..SH "void QScrollView::verticalSliderPressed ()\fC [signal]\fR"This signal is emitted whenever the user presses the vertical slider..SH "void QScrollView::verticalSliderReleased ()\fC [signal]\fR"This signal is emitted whenever the user releases the vertical slider..SH "QWidget * QScrollView::viewport () const"Returns the viewport widget of the scrollview. This is the widget containing the contents widget or which is the drawing area..PPExamples:.)l helpsystem/tooltip.cpp and scrollview/scrollview.cpp..SH "void QScrollView::viewportPaintEvent ( QPaintEvent * pe )\fC [virtual protected]\fR"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 \fIpe\fR..SH "void QScrollView::viewportResizeEvent ( QResizeEvent * )\fC [virtual protected]\fR"To provide simple processing of events on the contents, this function receives all resize events sent to the viewport..PPSee also QWidget::resizeEvent()..PPExample: chart/canvasview.cpp..SH "QSize QScrollView::viewportSize ( int x, int y ) const"Returns the viewport size for size (\fIx\fR, \fIy\fR)..PPThe viewport size depends on \fI(x, y)\fR (the size of the contents), the size of this widget and the modes of the horizontal and vertical scroll bars..PPThis 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..SH "void QScrollView::viewportToContents ( int vx, int vy, int & x, int & y ) const"Translates a point (\fIvx\fR, \fIvy\fR) on the viewport() widget to a point (\fIx\fR, \fIy\fR) in the contents..SH "QPoint QScrollView::viewportToContents ( const QPoint & vp ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the point on the viewport \fIvp\fR translated to a point in the contents..SH "int QScrollView::visibleHeight () const"Returns the vertical amount of the content that is visible. See the "visibleHeight" property for details..SH "int QScrollView::visibleWidth () const"Returns the horizontal amount of the content that is visible. See the "visibleWidth" property for details..SS "Property Documentation".SH "int contentsHeight"This property holds the height of the contents area..PPGet this property's value with contentsHeight()..SH "int contentsWidth"This property holds the width of the contents area..PPGet this property's value with contentsWidth()..SH "int contentsX"This property holds the X coordinate of the contents that are at the left edge of the viewport..PPGet this property's value with contentsX()..SH "int contentsY"This property holds the Y coordinate of the contents that are at the top edge of the viewport..PPGet this property's value with contentsY()..SH "bool dragAutoScroll"This property holds whether autoscrolling in drag move events is enabled..PPIf this property is set to TRUE (the default), the QScrollView automatically scrolls the contents in drag move events if the user moves the cursor close to a border of the view. Of course this works only if the viewport accepts drops. Specifying FALSE disables this autoscroll feature..PPSet this property's value with setDragAutoScroll() and get this property's value with dragAutoScroll()..SH "ScrollBarMode hScrollBarMode"This property holds the mode for the horizontal scroll bar..PPThe default mode is QScrollView::Auto..PPSee also vScrollBarMode..PPSet this property's value with setHScrollBarMode() and get this property's value with hScrollBarMode()..SH "ResizePolicy resizePolicy"This property holds the resize policy..PPThe default is Default..PPSee also ResizePolicy..PPSet this property's value with setResizePolicy() and get this property's value with resizePolicy()..SH "ScrollBarMode vScrollBarMode"This property holds the mode for the vertical scroll bar..PPThe default mode is QScrollView::Auto..PPSee also hScrollBarMode..PPSet this property's value with setVScrollBarMode() and get this property's value with vScrollBarMode()..SH "int visibleHeight"This property holds the vertical amount of the content that is visible..PPGet this property's value with visibleHeight()..SH "int visibleWidth"This property holds the horizontal amount of the content that is visible..PPGet this property's value with visibleWidth()..SH "SEE ALSO".BR http://doc.trolltech.com/qscrollview.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qscrollview.3qt) and the Qtversion (3.3.4).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -