[Interest] Qt 5: how to disable single-click activation in QAbstractItemView's?
Andreas Pakulat
apaku at gmx.de
Fri Dec 28 09:41:07 CET 2012
Am Freitag, 28. Dezember 2012 schrieb René Reucher :
> Am 27.12.2012 22:14, schrieb Bache-Wiig Jens:
> > That said, it should be relatively easy to work around this in an
> application by creating a custom proxy style:
> >
> > class MyProxyStyle : public QProxyStyle
> > {
> > public:
> > int styleHint(StyleHint hint, const QStyleOption *option = 0,
> > const QWidget *widget = 0, QStyleHintReturn
> *returnData = 0) const {
> > if (hint == QStyle:: SH_ItemView_ActivateItemOnSingleClick)
> > return 0;
> > return QProxyStyle::styleHint(hint, option, widget,
> returnData);
> > }
> > };
> >
> > Just set this as your application style and it should revert to the old
> behaviour regardless what your existing application style is.
>
> @Andreas: yes, I'm sure about this. Changing the default in KDE (or any
> other desktop environment) doesn't change the situation. I haven't yet
> tried it on anything else than Linux, though.
Thats a bug then when you're running KDE session, Qt should respect that
setting. No idea about other DE's.
> Not using the activated() or itemActivated() signals is pointless IMHO
> because it would mean a drastic change in *many* parts of the code and
> doesn't really sound like the way to go, simply because of API
> compatibility (which according to the docs hasn't changed in this
> area)... also, note that I'm still using Qt 4 primarily.
Why would that change the code much? Its assimpe as s/activated/clicked/ on
your connect calls.
Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121228/336a5224/attachment.html>
More information about the Interest
mailing list