[Interest] [External] How to prevent scroll changing QML ComboBox index when mouse hovers?
Edward Sutton
edward.sutton at subsite.com
Thu Aug 20 16:08:41 CEST 2015
On Aug 20, 2015, at 8:57 AM, Michael R Nelson <mnelson at sutron.com<mailto:mnelson at sutron.com>> wrote:
*External Message - use caution*
I have the same question as Edward Sutton, but as applied to a QML ComboBox. Is there an easy way to prevent a mouse wheel scroll over a QML ComboBox from changing the index of the ComboBox? My users complain it causes them to frequently make unintended changes.
This behavior is wrong. I cannot find any examples OS X or Windows apps that behave like this unless they were written in Qt.
It is a bug in QComboBox behavior. Developers should not have to subclass QComboBox or install event filters to make it behave like a normal combobox should behave by default.
class ComboBox : public QComboBox
{
Q_OBJECT
public:
explicit ComboBox::ComboBox(QWidget *parent) : QComboBox(parent)
{
this->setFocusPolicy(Qt::StrongFocus);
}
protected:
#ifndef QT_NO_WHEELEVENT
/// Fix unexpected scrollwheel behavior for OSX and Windows users
/// where QComboBox index changes when user moves mouse scrollwheel
/// when mouse *hovering* (no mouse click involved - just hovering ) over QComboBox
void ComboBox::wheelEvent( QWheelEvent * e)
{
if (false == hasFocus())
{
e->ignore();
return;
}
QComboBox::wheelEvent(e);
}
#endif
};
Developers need a focus property or style sheet that makes the QComboBox default behavior behave like a desktop users expects a normal combobox to behave.
-Ed
From: interest-bounces+mnelson=sutron.com at qt-project.org<mailto:interest-bounces+mnelson=sutron.com at qt-project.org> [mailto:interest-bounces+mnelson=sutron.com at qt-project.org] On Behalf Of Edward Sutton
Sent: Thursday, August 20, 2015 9:15 AM
To: Interests Qt <interest at qt-project.org<mailto:interest at qt-project.org>>
Subject: Re: [Interest] [External] Re: How to prevent scroll changing QComboBox index when mouse hovers?
Thanks Reinhardt. Installing an eventFilter seems to be the required solution to fix the incorrect QComboBox behavior.
On Aug 20, 2015, at 8:03 AM, Reinhardt Behm <rbehm at hushmail.com<mailto:rbehm at hushmail.com>> wrote:
*External Message - use caution*
On Thursday 20 August 2015 12:55:12 Edward Sutton wrote:
If user hovers mouse cursor (with out clicking) over a QComboBox and scrolls
the mouse wheel the combo index scrolls. This is unexpected behavior for
both OS X and Windows users. The result is to cause users to make
unintentional changes in my app.
Is there an easy way to prevent this unexpecetd behavior?
Or does it require replacing al QComboBox items with a derived version that
filters events?
-Ed
Install an eventFilter on the QComboBox?
I was hoping that focusPolicy would provide an easy solution. Neither StrongFocus nor NoFocus prevents this behavior.
This behavior is considered a bug in the QComboBox behavior by *both* OS X and Windows users.
-Ed
This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest
This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150820/abc9dc01/attachment.html>
More information about the Interest
mailing list