[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: kdelibs/kdeui
From: "Aaron J. Seigo" <aseigo () olympusproject ! org>
Date: 2002-10-22 0:37:26
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 21 October 2002 04:11, Stephan Kulow wrote:
> Still you browse when you scroll in the location bar of konqueror - you're
> not changing the URL, you browse right away. Scroll wheel actions shouldn't
> change anything but the view.
so we take care of some comboboxes (kcombobox, but not those that just use
qcombobox), and neuter them just because we don't like how it behaves in the
konqueror url box? not that someone ever accidently wheel scrolls over it (do
they?)
how about the attached patch to qcombobox itself: it implements a delayed
emit() on wheel events... i set it .5 seconds and it feels fairly natural.
behaviours don't change and the user can scroll through the list w/out
causing tons of unintential activated() events.
note that this does NOT address the issue of a combobox in a web page as that
is, obviously a seperate issue from this.
- --
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
"Everything should be made as simple as possible, but not simpler"
- Albert Einstein
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9tJ3K1rcusafx20MRAmCeAJ93t2qG0o7aqfwFtKYlggNQHnyRkACfTShK
ZXIvfSBF8112HLqaMN06bnQ=
=D8y/
-----END PGP SIGNATURE-----
["qcombobox_delayedWheel.diff" (text/x-diff)]
Index: src/widgets/qcombobox.cpp
===================================================================
RCS file: /home/kde/qt-copy/src/widgets/qcombobox.cpp,v
retrieving revision 1.51
diff -u -3 -d -p -r1.51 qcombobox.cpp
--- src/widgets/qcombobox.cpp 2002/10/21 12:39:34 1.51
+++ src/widgets/qcombobox.cpp 2002/10/22 00:36:08
@@ -392,6 +392,7 @@ public:
QTimer *completionTimer;
QSize sizeHint;
+ QTimer delayedActivated;
private:
bool usingLBox;
@@ -490,6 +491,7 @@ QComboBox::QComboBox( QWidget *parent, c
setFocusPolicy( TabFocus );
setBackgroundMode( PaletteButton );
+ connect( &d->delayedActivated, SIGNAL(timeout()), this, SLOT(emitActivated()) );
}
@@ -533,6 +535,7 @@ QComboBox::QComboBox( bool rw, QWidget *
if ( rw )
setUpLineEdit();
setBackgroundMode( PaletteButton, PaletteBase );
+ connect( &d->delayedActivated, SIGNAL(timeout()), this, SLOT(emitActivated()) );
}
@@ -1434,9 +1437,10 @@ void QComboBox::focusInEvent( QFocusEven
/*!\reimp
*/
-
void QComboBox::wheelEvent( QWheelEvent *e )
{
+ d->delayedActivated.stop();
+
if ( d->poppedUp ) {
if ( d->usingListBox() ) {
QApplication::sendEvent( d->listBox(), e );
@@ -1446,19 +1450,29 @@ void QComboBox::wheelEvent( QWheelEvent
int c = currentItem();
if ( c > 0 ) {
setCurrentItem( c-1 );
- emit activated( currentItem() );
- emit activated( currentText() );
+ d->delayedActivated.start(400, true);
}
} else {
int c = currentItem();
if ( ++c < count() ) {
setCurrentItem( c );
- emit activated( currentItem() );
- emit activated( currentText() );
+ d->delayedActivated.start(400, true);
}
}
e->accept();
}
+}
+
+/*!
+ \internal
+ Receives timeouts after a wheel event to prevent immediate activation
+ on a wheel
+*/
+void QComboBox::emitActivated()
+{
+ d->delayedActivated.stop();
+ emit activated( currentItem() );
+ emit activated( currentText() );
}
/*!
Index: src/widgets/qcombobox.h
===================================================================
RCS file: /home/kde/qt-copy/src/widgets/qcombobox.h,v
retrieving revision 1.45
diff -u -3 -d -p -r1.45 qcombobox.h
--- src/widgets/qcombobox.h 2002/10/21 12:39:34 1.45
+++ src/widgets/qcombobox.h 2002/10/22 00:36:08
@@ -159,6 +159,7 @@ private slots:
void internalHighlight( int );
void internalClickTimeout();
void returnPressed();
+ void emitActivated();
protected:
void paintEvent( QPaintEvent * );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic