On Friday 20 December 2013 08:31:24 Martin Koller wrote:
> On Thursday 19 December 2013 09:19:38 Rick Stockton wrote:
> > On 12/18/2013 01:10 PM, Andreas Aardal Hanssen wrote:
> > > On 18 Dec 2013, at 22:07, Rayner Pupo Gómez <[email protected]> wrote:
> > Inner-most quote is from Martin Koller.
> >
> > >>> I've discovered that with Qt5 I get a different order of mouse events on
> > >>> a QWidget than with Qt4 (openSuse 13.1 Linux, X11):
> > >>> double clicking a widget results in Qt4 in:
> > >>> mousePressEvent
> > >>> mouseReleaseEvent
> > >>> mouseDoubleClickEvent
> > >>> mousePressEvent
> > >>> mouseReleaseEvent
> > >>> but in Qt5 in:
> > >>> mousePressEvent
> > >>> mouseReleaseEvent
> > >>> mousePressEvent
> > >>> mouseDoubleClickEvent
> > >>> mouseReleaseEvent
> > >>> I tested with Qt4.8.5 and Qt5.2.
> > >>> Is this behavioral change intended, undefined, a bug ?
> > >>> (it results in my app not behaving as before ...)
> > >> I think it's a mistake to rely on the order of this kind of events,
> > >> there are
> > >> fired asynchronously, your logic cant depend on this
> > > Wrong! The order is very essential and can and must be relied on.
> > > The behaviour in Qt 5 is questionable. I believe the double-click must
> > > come first to be able to distinguish from two presses.
> > >
> > > I also wonder if it's accurate / true that Qt 4 sends the second press
> > > after the double-click. AFAIR:
> > >
> > > Press
> > > Release
> > > DoubleClick
> > > Release
> > >
> > > Is the right events for double-clicking.
> > >
> > > Andreas
> > Andreas, I'm confirming the QT5 behavior, to be as Martin describe. BUT,
> > the Qt4 behavior seems to be as YOU recall - no ButtonPress" at all for
> > the fast-enough second click which invoked a "DoubleClick event.
>
> I'm not making things up. This is what my testprogram gives.
> I attach it here.
I see now the problem with my testprogram.
I also called the basclass implementation, which leads to the extra
mousePressEvent.
(fixed prog attached)
when I just print the events in my implementation, I get:
Qt4:
mousePressEvent
mouseReleaseEvent
mouseDoubleClickEvent
mouseReleaseEvent
Qt5:
mousePressEvent
mouseReleaseEvent
mousePressEvent
mouseDoubleClickEvent
mouseReleaseEvent
so it's just the extra mousePressEvent in Qt5 which is wrong.
--
Best regards/Schöne Grüße
Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at
#include <QApplication>
#include <QWidget>
#include <QMouseEvent>
class Widget : public QWidget
{
public:
Widget(QWidget *parent) : QWidget(parent)
{
}
virtual void mousePressEvent(QMouseEvent *event)
{
qWarning("mousePressEvent");
event->accept();
}
virtual void mouseReleaseEvent(QMouseEvent *event)
{
qWarning("mouseReleaseEvent");
event->accept();
}
virtual void mouseDoubleClickEvent(QMouseEvent *event)
{
qWarning("mouseDoubleClickEvent");
event->accept();
}
};
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Widget *w = new Widget(0);
w->show();
return app.exec();
}
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development