[Interest] [External] [External] How to prevent scroll changing QML ComboBox index when mouse hovers?

Edward Sutton edward.sutton at subsite.com
Tue Aug 25 14:47:11 CEST 2015


What *is* correct Windows native behavior of a combo box when scroll wheel is moved while hovering over?

I do not see it move when scroll wheel is moved while hovering over.

This is the behavior I see on Windows 7 and VS2013. Support has told me that the combo box moves and that this is correct Windows native behavior?  I did not see that.

1 - Open VS2013
2 - Tools->Options
3 - Select Environment->General
4 - Verify color displayed is Blue
5 - Move mouse cursor to hover over Color theme combo ( no clicking )
6 - Move scroll wheel scroll ( without clicking the scroll wheel )
7 - Verify combo box remains on Blue and does *not* change when scroll wheel
moves


Is there a Control Panel or mouse setting that could make it behave otherwise? Does behavior change with Windows 8? Windows 10 ?


-Ed


On Aug 20, 2015, at 9:08 AM, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>> wrote:

*External Message - use caution*



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.
_______________________________________________
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/20150825/32b80bff/attachment.html>


More information about the Interest mailing list