#include <qcombobox_p.h>
Inheritance diagram for QComboBoxPrivateScroller:


Definition at line 81 of file qcombobox_p.h.
Signals | |
| void | doScroll (int action) |
Public Member Functions | |
| QComboBoxPrivateScroller (QAbstractSlider::SliderAction action, QWidget *parent) | |
| QSize | sizeHint () const |
Protected Member Functions | |
| void | stopTimer () |
| void | startTimer () |
| void | enterEvent (QEvent *) |
| void | leaveEvent (QEvent *) |
| void | timerEvent (QTimerEvent *e) |
| void | hideEvent (QHideEvent *) |
| void | mouseMoveEvent (QMouseEvent *e) |
| void | paintEvent (QPaintEvent *) |
Private Attributes | |
| QAbstractSlider::SliderAction | sliderAction |
| QBasicTimer | timer |
| bool | fast |
| QComboBoxPrivateScroller::QComboBoxPrivateScroller | ( | QAbstractSlider::SliderAction | action, | |
| QWidget * | parent | |||
| ) | [inline] |
Definition at line 86 of file qcombobox_p.h.
References QSizePolicy::Fixed, QSizePolicy::Minimum, and QWidget::setSizePolicy().
00087 : QWidget(parent), sliderAction(action) { 00088 setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 00089 }
Here is the call graph for this function:

| QSize QComboBoxPrivateScroller::sizeHint | ( | ) | const [inline, virtual] |
Reimplemented from QWidget.
Definition at line 90 of file qcombobox_p.h.
References QStyle::PM_MenuScrollerHeight, and QWidget::style().
00090 { 00091 return QSize(20, style()->pixelMetric(QStyle::PM_MenuScrollerHeight)); 00092 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::stopTimer | ( | ) | [inline, protected] |
Definition at line 95 of file qcombobox_p.h.
References QBasicTimer::stop(), and timer.
Referenced by hideEvent(), and leaveEvent().
Here is the call graph for this function:

| void QComboBoxPrivateScroller::startTimer | ( | ) | [inline, protected] |
Definition at line 99 of file qcombobox_p.h.
References fast, QBasicTimer::start(), and timer.
Referenced by enterEvent().
Here is the call graph for this function:

| void QComboBoxPrivateScroller::enterEvent | ( | QEvent * | ) | [inline, protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter.
An event is sent to the widget when the mouse cursor enters the widget.
Reimplemented from QWidget.
Definition at line 104 of file qcombobox_p.h.
References startTimer().
00104 { 00105 startTimer(); 00106 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::leaveEvent | ( | QEvent * | ) | [inline, protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter.
A leave event is sent to the widget when the mouse cursor leaves the widget.
Reimplemented from QWidget.
Definition at line 108 of file qcombobox_p.h.
References stopTimer().
00108 { 00109 stopTimer(); 00110 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::timerEvent | ( | QTimerEvent * | e | ) | [inline, protected, virtual] |
This event handler can be reimplemented in a subclass to receive timer events for the object.
QTimer provides a higher-level interface to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.
Reimplemented from QObject.
Definition at line 111 of file qcombobox_p.h.
References doScroll(), emit, fast, sliderAction, timer, QTimerEvent::timerId(), and QBasicTimer::timerId().
00111 { 00112 if (e->timerId() == timer.timerId()) { 00113 emit doScroll(sliderAction); 00114 if (fast) { 00115 emit doScroll(sliderAction); 00116 emit doScroll(sliderAction); 00117 } 00118 } 00119 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::hideEvent | ( | QHideEvent * | ) | [inline, protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the event parameter.
Hide events are sent to widgets immediately after they have been hidden.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible().
Reimplemented from QWidget.
Definition at line 120 of file qcombobox_p.h.
References stopTimer().
00120 { 00121 stopTimer(); 00122 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::mouseMoveEvent | ( | QMouseEvent * | e | ) | [inline, protected, virtual] |
This event handler, for event event, can be reimplemented in a subclass to receive mouse move events for the widget.
If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.
Reimplemented from QWidget.
Definition at line 124 of file qcombobox_p.h.
References QRect::bottom(), fast, QMouseEvent::pos(), QWidget::pos(), QWidget::rect(), QRect::right(), sliderAction, QAbstractSlider::SliderSingleStepAdd, QPoint::x(), and QPoint::y().
00125 { 00126 // Enable fast scrolling if the cursor is directly above or below the popup. 00127 const int mouseX = e->pos().x(); 00128 const int mouseY = e->pos().y(); 00129 const bool horizontallyInside = pos().x() < mouseX && mouseX < rect().right() + 1; 00130 const bool verticallyOutside = (sliderAction == QAbstractSlider::SliderSingleStepAdd) ? 00131 rect().bottom() + 1 < mouseY : mouseY < pos().y(); 00132 00133 fast = horizontallyInside && verticallyOutside; 00134 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::paintEvent | ( | QPaintEvent * | ) | [inline, protected, virtual] |
This event handler can be reimplemented in a subclass to receive paint events which are passed in the event parameter.
A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example.
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). repaint() does not permit this optimization, so we suggest using update() whenever possible.
When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background.
The background can be set using setBackgroundRole() and setPalette().
From Qt 4.0, QWidget automatically double-buffers its painting, so there's no need to write double-buffering code in paintEvent() to avoid flicker.
Note: Under X11 it is possible to toggle the global double buffering by calling qt_x11_set_global_double_buffer(). Example usage:
...
extern void qt_x11_set_global_double_buffer(bool);
qt_x11_set_global_double_buffer(false);
...
Reimplemented from QWidget.
Definition at line 136 of file qcombobox_p.h.
References QStyle::CE_MenuScroller, QStyleOptionMenuItem::checkType, QStyle::drawControl(), QStyleOption::init(), QStyleOptionMenuItem::maxIconWidth, QStyleOptionMenuItem::menuItemType, QStyleOptionMenuItem::menuRect, QStyleOptionMenuItem::NotCheckable, p, QWidget::rect(), QStyleOptionMenuItem::Scroller, sliderAction, QAbstractSlider::SliderSingleStepAdd, QStyleOption::state, QStyle::State_DownArrow, QWidget::style(), and QStyleOptionMenuItem::tabWidth.
00136 { 00137 QPainter p(this); 00138 QStyleOptionMenuItem menuOpt; 00139 menuOpt.init(this); 00140 menuOpt.checkType = QStyleOptionMenuItem::NotCheckable; 00141 menuOpt.menuRect = rect(); 00142 menuOpt.maxIconWidth = 0; 00143 menuOpt.tabWidth = 0; 00144 menuOpt.menuItemType = QStyleOptionMenuItem::Scroller; 00145 if (sliderAction == QAbstractSlider::SliderSingleStepAdd) 00146 menuOpt.state |= QStyle::State_DownArrow; 00147 p.eraseRect(rect()); 00148 style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p); 00149 }
Here is the call graph for this function:

| void QComboBoxPrivateScroller::doScroll | ( | int | action | ) | [signal] |
Referenced by timerEvent().
Definition at line 155 of file qcombobox_p.h.
Referenced by mouseMoveEvent(), paintEvent(), and timerEvent().
QBasicTimer QComboBoxPrivateScroller::timer [private] |
Definition at line 156 of file qcombobox_p.h.
Referenced by startTimer(), stopTimer(), and timerEvent().
bool QComboBoxPrivateScroller::fast [private] |
Definition at line 157 of file qcombobox_p.h.
Referenced by mouseMoveEvent(), startTimer(), and timerEvent().
1.5.1