亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qrangecontrol.cpp

?? qtopia-phone-2.2.0下公共的控件實現源代碼。
?? CPP
字號:
/****************************************************************************** $Id: qt/src/widgets/qrangecontrol.cpp   2.3.12   edited 2005-10-27 $**** Implementation of QRangeControl class**** Created : 940427**** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.**** This file is part of the widgets module of the Qt GUI Toolkit.**** This file may be distributed under the terms of the Q Public License** as defined by Trolltech AS of Norway and appearing in the file** LICENSE.QPL included in the packaging of this file.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition** licenses may use this file in accordance with the Qt Commercial License** Agreement provided with the Software.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for**   information about Qt Commercial License Agreements.** See http://www.trolltech.com/qpl/ for QPL licensing information.** See http://www.trolltech.com/gpl/ for GPL licensing information.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#include "qrangecontrol.h"#ifndef QT_NO_RANGECONTROL#include "qglobal.h"#include <limits.h>// BEING REVISED: weis/*!  \class QRangeControl qrangecontrol.h  \brief The QRangeControl class provides an integer value within a range.  \ingroup misc  It was originally designed for the QScrollBar widget, but it can  also be practical for other purposes such as QSlider and QSpinBox.  Here are the five main concepts in the class: <ul>  <li> The current value.  This is the bounded integer that  QRangeControl maintains.  value() returns this, and several  functions including setValue() set it.  <li> The minimum.  This is the lowest value value() can ever return.  Returned by minValue(), set by setRange() or one of the  constructors.  <li> The maximum.  This is the highest value value() can ever return.  Returned by maxValue(), set by setRange() or one of the  constructors.  <li> The line step.  This is the smaller of two natural steps  QRangeControl provides, and typically corresponds to the user  pressing an arrow key.  The line step is returned by lineStep()  and set using setSteps(). The functions addLine() and subtractLine() allow easy  movement of the current value by lineStep().  <li> The page step.  This is the larger of two natural steps  QRangeControl provides, and typically corresponds to the user  pressing one of the PageUp and PageDown keys.  The page step is  returned by pageStep() and set using setSteps().  The functions addPage() and substractPage() allow easy movement  of the current value by pageStep().  </ul>  Note that unity (1) may be viewed as a third step size.  setValue()  lets you set the current value to any integer in the allowed range,  not just minValue()+n*lineStep() for integer values of n.  Some  widgets may allow the user to set any value at all, others may just  provide multiples of lineStep()/pageStep().  QRangeControl provides three virtual functions that are well-suited  e.g. for updating the on-screen representation of range controls and  emitting signals, namely valueChange(), rangeChange() and  stepChange().  Finally, QRangeControl provides a function called bound() which lets you  force arbitrary integers to be within the allowed range of the range control.  We recommend that all widgets, which inherit QRangeControl,  provide at least a signal called  valueChanged(), and many widgets will want to provide addStep(),  addPage(), substractStep() and substractPage() as slots.    Note that you have to use multiple inheritance if you plan to implement  a widget using QRangeControl, since QRangeControl is not derived from  QWidget.*//*!  Constructs a range control with min value 0, max value 99,  line step 1, page step 10 and initial value 0.*/QRangeControl::QRangeControl(){    minVal  = 0;    maxVal  = 99;    line    = 1;    page    = 10;    val	    = 0;    prevVal = -1;    d	    = 0;}/*!  Constructs a range control whose value can never be smaller than \a  minValue or greater than \a maxValue, whose line step size is \a  lineStep and page step size is \a pageStep, and whose value is  initially \a value.  \a value is forced to be within the legal range using the bound() method.*/QRangeControl::QRangeControl( int minValue, int maxValue,			      int lineStep, int pageStep,			      int value ){    minVal  = minValue;    maxVal  = maxValue;    line    = QABS( lineStep );    page    = QABS( pageStep );    prevVal = minVal - 1;    val	    = bound( value );    d	    = 0;}/*!  \fn int QRangeControl::value() const  Returns the current range control value.  This is guaranteed to be  within the range [ minValue() ... maxValue() ].  \sa setValue() prevValue()*//*!  \fn int QRangeControl::prevValue() const  Returns the previous value of the range control. "Previous value"  means the value before the last change occurred. Setting a new range  may affect the value, too, since the value is forced to be inside  the specified range. When the range  control is initially created, this is the same as value().  Note that prevValue() can be outside the current legal range if a call to  setRange() causes the current value to change.  (For example if the  range was 0-1000 and the current value 500, setRange( 0, 400 ) makes  value() return 400 and prevValue() 500)  \sa value() setRange()*//*!  Sets the range controls value to \e value and forces it to be within  the legal range.  Calls the virtual valueChange() function if the new value is  different from the previous value. The old value can still be  retrieved using prevValue().     \sa value()*/void QRangeControl::setValue( int value ){    int lprevVal = prevVal;    directSetValue( value );    if ( lprevVal != val || prevVal != val )	valueChange();}/*!  Sets the range control value directly without calling valueChange().  Forces the new value to be within the legal range.  You will find few cases only where you have to call this function.  However, if you want to change the range controls value inside  the overloaded method valueChange() then setValue() would call the  function valueChange() again. To avoid this recursion you must use  directSetValue() instead.    \sa setValue()*/void QRangeControl::directSetValue(int value){    prevVal = val;    val = bound( value );}/*!  Equivalent to \code setValue( value()+pageStep() )\endcode plus a  test for numerical overflow.  If the value is changed, then valueChange() is called.    \sa subtractPage() addLine() setValue()*/void QRangeControl::addPage(){    if ( value() + pageStep() < maxValue() )	setValue( value() + pageStep() );    else	setValue( maxValue() );}/*!  Equivalent to \code setValue( value()-pageStep() )\endcode  plus a  test for numerical underflow    If the value is changed, then valueChange() is called.      \sa addPage() subtractLine() setValue()*/void QRangeControl::subtractPage(){    if ( value() - pageStep() > minValue() )	setValue( value() - pageStep() );    else	setValue( minValue() );}/*!  Equivalent to \code setValue( value()+lineStep() )\endcode  plus a  test for numerical overflow    If the value is changed, then valueChange() is called.      \sa subtractLine() addPage() setValue()*/void QRangeControl::addLine(){    if ( value() + lineStep() < maxValue() )	setValue( value() + lineStep() );    else	setValue( maxValue() );}/*!  Equivalent to \code setValue( value()-lineStep() )\endcode plus a  test for numerical underflow    If the value is changed, then valueChange() is called.      \sa addLine() subtractPage() setValue()*/void QRangeControl::subtractLine(){    if ( value() - lineStep() > minValue() )	setValue( value() - lineStep() );    else	setValue( minValue() );}/*!  \fn int QRangeControl::minValue() const  Returns the current minimum value of the range.  \sa setRange() maxValue()*//*!  \fn int QRangeControl::maxValue() const  Returns the current maximum value of the range.  \sa setRange() minValue()*//*!  Sets the range min value to \e minValue and the max value to \e  maxValue.  Calls the virtual rangeChange() function if one or both of the new  min and max values are different from the previous setting.  Calls  the virtual valueChange() function if the current value is adjusted  because it was outside the new range.  If \a maxValue is smaller than \a minValue, \a minValue becomes the  only legal value.  \sa minValue() maxValue()*/void QRangeControl::setRange( int minValue, int maxValue ){    if ( minValue == minVal && maxValue == maxVal )	return;    if ( minValue > maxValue ) {	minVal = maxVal = minValue;    } else {	minVal = minValue;	maxVal = maxValue;    }    int tmp = bound( val );    rangeChange();    if ( tmp != val ) {	prevVal = val;	val = tmp;	valueChange();    }}/*!  \fn int QRangeControl::lineStep() const    Returns the current line step.    \sa setSteps() pageStep()*//*!  \fn int QRangeControl::pageStep() const  Returns the current page step.    \sa setSteps() lineStep()*//*!  Sets the range line step to \e lineStep and page step to \e pageStep.  Calls the virtual stepChange() function if the new line step and/or  page step are different from the previous settings.  \sa lineStep() pageStep() setRange()*/void QRangeControl::setSteps(int lineStep,int pageStep){    if (lineStep != line || pageStep != page) {	line = QABS(lineStep);	page = QABS(pageStep);	stepChange();    }}/*!  This virtual function is called whenever the range control value  changes.  You can reimplement it if you want to be notified when the  value changes.  The default implementation does nothing.  Note that this method is called after the value changed. The previous  value can be retrieved using prevValue().    \sa setValue(), addPage(), subtractPage(), addLine(), subtractLine()  rangeChange(), stepChange()*/void QRangeControl::valueChange(){}/*!  This virtual function is called whenever the range controls range  changes.  You can reimplement it if you want to be notified when the range  changes.  The default implementation does nothing.  Note that this method is called after the range changed.      \sa setRange(), valueChange(), stepChange()*/void QRangeControl::rangeChange(){}/*!  This virtual function is called whenever the range controls line/page step  settings changes.  You can reimplement it if you want to be notified  when the step changes.  The default implementation does nothing.  Note that this method is called after the step settings changed.      \sa setSteps(), rangeChange(), valueChange()*/void QRangeControl::stepChange(){}/*!  Forces \a v to be within the range from minValue() to maxValue()  inclusive, and returns the result.  This function is provided so that you can easily force other numbers  than value() into the allowed range.  You do not need to call it in  order to use QRangeControl itself.  \sa setValue() value() minValue() maxValue()*/int QRangeControl::bound( int v ) const{    if ( v < minVal )	return minVal;    if ( v > maxVal )	return maxVal;    return v;}/*!  Converts \a logical_val to a pixel position.  minValue() maps to 0, maxValue()  maps to \a span, and other values are distributed evenly in between.  This function can handle the entire integer range without overflow.    Callings this method is useful when actually drawing a range control  like a QScrollBar on the screen.    \sa valueFromPosition()*/int QRangeControl::positionFromValue( int logical_val, int span ) const{    if ( span <= 0 || logical_val < minValue() || maxValue() <= minValue() )	return 0;    if ( logical_val > maxValue() )	return span;    uint range = maxValue() - minValue();    uint p = logical_val - minValue();    if ( range > (uint)INT_MAX/4096 ) {	const int scale = 4096*2;	return ( (p/scale) * span ) / (range/scale);	// ### the above line is probably not 100% correct	// ### but fixing it isn't worth the extreme pain...    } else if ( range > (uint)span ) {	return (2*p*span + range) / (2*range);    } else {	uint div = span / range;	uint mod = span % range;	return p*div + (2*p*mod + range) / (2*range);    }    //equiv. to (p*span)/range + 0.5    // no overflow because of this implicit assumption:    // span <= 4096}/*!  Converts the pixel position \a pos to a value.  0 maps to minValue(),  \a span maps to maxValue(), and other values are distributed evenly  in between.  This function can handle the entire integer range without overflow.    Calling this method is useful if you actually implemented a range control  widget like QScrollBar and want to handle mouse press events.  This function  maps then screen coordinates to the logical values.    \sa positionFromValue()*/int QRangeControl::valueFromPosition( int pos, int span ) const{    if ( span <= 0 || pos <= 0 )	return minValue();    if ( pos >= span )	return maxValue();    uint range = maxValue() - minValue();    if ( (uint)span > range )	return  minValue() + (2*pos*range + span) / (2*span);    else {	uint div = range / span;	uint mod = range % span;	return  minValue() + pos*div + (2*pos*mod + span) / (2*span);    }    // equiv. to minValue() + (pos*range)/span + 0.5    // no overflow because of this implicit assumption:    // pos <= span < sqrt(INT_MAX+0.0625)+0.25 ~ sqrt(INT_MAX)}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人精品在线观看| 国产一区视频导航| 久久成人精品无人区| 91麻豆免费在线观看| 欧美日韩一本到| 国产精品大尺度| 九色综合国产一区二区三区| 欧美性色欧美a在线播放| 国产午夜亚洲精品理论片色戒| 午夜欧美大尺度福利影院在线看| 成人精品电影在线观看| 久久综合九色综合欧美就去吻| 亚洲一区二区精品3399| 91影视在线播放| 国产农村妇女精品| 韩国理伦片一区二区三区在线播放| 精品视频一区二区不卡| 亚洲免费在线视频一区 二区| 福利一区在线观看| 精品区一区二区| 青青草97国产精品免费观看| 欧美日韩国产精选| 亚洲综合免费观看高清完整版| 99国产精品久久久久| 国产精品素人视频| 国产成人在线影院| 国产欧美日韩另类视频免费观看| 国产在线国偷精品免费看| 日韩精品一区二区三区在线 | 欧美私人免费视频| 综合久久久久综合| 一本大道久久a久久精品综合 | 久久久久久97三级| 韩国三级在线一区| 国产日韩一级二级三级| 丁香天五香天堂综合| 欧美国产1区2区| av电影天堂一区二区在线| 国产精品丝袜在线| 色天天综合色天天久久| 亚洲大片在线观看| 欧美一区二区在线播放| 九九国产精品视频| 日本一区二区三区四区| 91碰在线视频| 视频在线在亚洲| 日韩精品中文字幕一区| 国产高清无密码一区二区三区| 国产欧美日韩视频在线观看| 色拍拍在线精品视频8848| 午夜a成v人精品| 精品欧美乱码久久久久久| 国产宾馆实践打屁股91| 亚洲视频免费在线观看| 欧美日韩精品一区二区在线播放| 蜜臀久久久久久久| 欧美激情在线一区二区| 日本高清无吗v一区| 麻豆成人免费电影| 国产精品久久免费看| 欧美三级电影网| 国产精品正在播放| 亚洲精品久久久久久国产精华液| 777午夜精品视频在线播放| 国产一区免费电影| 亚洲综合在线免费观看| 精品不卡在线视频| 色综合久久88色综合天天免费| 日韩二区三区在线观看| 欧美国产一区二区在线观看| 欧美日韩免费在线视频| 国产一区不卡在线| 亚洲一区视频在线| 国产欧美日韩一区二区三区在线观看| 在线观看91视频| 成人午夜激情在线| 青青青爽久久午夜综合久久午夜| 国产精品久久久久久久久免费樱桃 | 国产成人精品免费在线| 亚洲国产婷婷综合在线精品| 久久蜜臀中文字幕| 欧美日本一区二区三区| 成人午夜精品在线| 黄页网站大全一区二区| 亚洲18影院在线观看| 国产精品美日韩| 欧美精品一区二区三区一线天视频| 日本高清不卡视频| 东方aⅴ免费观看久久av| 蜜臂av日日欢夜夜爽一区| 亚洲黄色性网站| 欧美激情一区二区三区不卡| 日韩精品专区在线| 欧美少妇bbb| 91国产丝袜在线播放| 成人av电影免费在线播放| 韩国精品在线观看| 久久国产精品一区二区| 肉肉av福利一精品导航| 亚洲精品老司机| 亚洲免费在线电影| 中文字幕日韩一区二区| 国产精品全国免费观看高清| 欧美精品一区二区三| 日韩一区二区三区高清免费看看| 在线观看日韩国产| 91成人看片片| 欧美午夜影院一区| 欧美在线视频日韩| 欧美午夜影院一区| 欧美三级中文字| 欧美日韩精品一区二区天天拍小说 | 久久夜色精品国产欧美乱极品| 69堂亚洲精品首页| 欧美一级二级三级蜜桃| 日韩一区二区三区高清免费看看| 日韩午夜电影在线观看| 久久人人爽人人爽| 不卡av免费在线观看| 亚洲日本韩国一区| 中文字幕一区在线观看视频| 中文字幕乱码一区二区免费| 国产精品天美传媒| 亚洲综合区在线| 天天影视网天天综合色在线播放| 日韩和的一区二区| 久久激情综合网| 国产精品一色哟哟哟| 国产一区二区电影| 北条麻妃国产九九精品视频| 不卡一区二区三区四区| 日本韩国一区二区| 日韩一区二区在线看片| 久久―日本道色综合久久| ...中文天堂在线一区| 一区二区在线免费| 奇米四色…亚洲| 国产999精品久久久久久绿帽| 成人午夜在线播放| 欧美日韩一区在线观看| 精品免费99久久| |精品福利一区二区三区| 亚洲成人激情自拍| 国产在线看一区| 色8久久精品久久久久久蜜| 678五月天丁香亚洲综合网| 久久久久久综合| 一区二区三区不卡视频| 精品综合久久久久久8888| 成人高清视频免费观看| 欧美日韩电影一区| 国产午夜精品一区二区三区四区| 亚洲男人天堂av网| 久久99精品一区二区三区三区| 成人av电影免费观看| 欧美一二三四区在线| 亚洲三级电影网站| 九九视频精品免费| 日本丶国产丶欧美色综合| 亚洲精品在线观看视频| 一区二区三区欧美亚洲| 国产一区二区三区免费观看| 欧美艳星brazzers| 日本一二三四高清不卡| 蜜乳av一区二区三区| 91福利在线播放| 国产精品美女久久久久久久久久久| 天天操天天综合网| 一本久久综合亚洲鲁鲁五月天 | 国产午夜精品在线观看| 日本欧美久久久久免费播放网| av一区二区三区在线| 欧美大片免费久久精品三p| 夜夜亚洲天天久久| a4yy欧美一区二区三区| 精品第一国产综合精品aⅴ| 天天色天天爱天天射综合| 91久久久免费一区二区| 国产精品无遮挡| 国产在线一区观看| 欧美成va人片在线观看| 日本欧美一区二区| 宅男噜噜噜66一区二区66| 亚洲品质自拍视频| 不卡的av电影在线观看| 国产亚洲人成网站| 国产精品99久久久久久有的能看 | 中文字幕一区二区三区在线播放 | 中文字幕乱码久久午夜不卡| 久久er99热精品一区二区| 欧美精品在线一区二区| 亚洲成精国产精品女| 在线观看三级视频欧美| 亚洲综合色丁香婷婷六月图片| 97久久久精品综合88久久| 国产精品成人免费在线| 99精品久久只有精品| 中文字幕色av一区二区三区| 91在线免费看| 一区二区三区国产|