Re: How to port KTabBar::mouseMiddleClick?

2014-11-11 Thread David Gil Oliva
El 11/11/2014 10:50, "Kevin Funk"  escribió:
>
> On Monday 10 November 2014 15:19:22 Nicolás Alvarez wrote:
> > 2014-11-09 7:28 GMT-03:00 Frank Reininghaus :
> > > Hi,
> > >
> > > 2014-11-06 2:59 GMT+01:00 Milian Wolff:
> > >> Hey all,
> > >>
> > >> what do I do to get middle-click-closes-tab in Qt 5 without KTabBar?
> > >> Previously, we used KTabBar and its mouseMiddleClick signal.
> > >
> > > AFAIK, currently the only solution is to subclass QTabBar, override
> > > the mousePressEvent method and emit a signal from there. Dolphin uses
> > > this approach. There were many other reasons why Emmanuel created a
> > > custom QTabBar subclass for Dolphin though .
> > >
> > > If many apps need the "middle click to close" bevavior, then
> > > reanimating KTabBar or getting this functionality into QTabBar might
> > > be better than making every app create its own tab bar class.
> >
> > Or maybe contribute mouseMiddleClick to QTabBar?
> > (I'm not volunteering :P)
>
> Yep. I'm wondering if an a patch just reacting on middle clicks would be
> accepted. It's not like it breaks existing work flows, it's just there for
> convenience.
>
> Grepping qtbase showed that QMdiArea has a similar feature:
>
> widgets/qmdiarea.cpp
> 582-void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event)
> 583-{
> 584:if (event->button() != Qt::MidButton) {
> 585-QTabBar::mousePressEvent(event);
> 586-return;
> 587-}
> 588-
> 589-QMdiSubWindow *subWindow =
subWindowFromIndex(tabAt(event->pos()));
> 590-if (!subWindow) {
> 591-event->ignore();
> 592-return;
> 593-}
> 594-
> 595-subWindow->close();
> 596-}
>
> Worth trying to patch this into QTabBar right away, I think.

Didn't see it. Sorry for the noise.

David Gil

> Cheers
>
> --
> Kevin Funk | kf...@kde.org | http://kfunk.org
> ___
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel@kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
___
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


Re: How to port KTabBar::mouseMiddleClick?

2014-11-11 Thread David Gil Oliva
El 10/11/2014 19:19, "Nicolás Alvarez"  escribió:
>
> 2014-11-09 7:28 GMT-03:00 Frank Reininghaus :
> > Hi,
> >
> > 2014-11-06 2:59 GMT+01:00 Milian Wolff:
> >> Hey all,
> >>
> >> what do I do to get middle-click-closes-tab in Qt 5 without KTabBar?
> >> Previously, we used KTabBar and its mouseMiddleClick signal.
> >
> > AFAIK, currently the only solution is to subclass QTabBar, override
> > the mousePressEvent method and emit a signal from there. Dolphin uses
> > this approach. There were many other reasons why Emmanuel created a
> > custom QTabBar subclass for Dolphin though .
> >
> > If many apps need the "middle click to close" bevavior, then
> > reanimating KTabBar or getting this functionality into QTabBar might
> > be better than making every app create its own tab bar class.
>
> Or maybe contribute mouseMiddleClick to QTabBar?
> (I'm not volunteering :P)

I am, but only if it can wait until after the 29 of November. Is it ok?

Cheers,

David Gil

>
> --
> Nicolás
> ___
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel@kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
___
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


Re: How to port KTabBar::mouseMiddleClick?

2014-11-11 Thread Kevin Funk
On Monday 10 November 2014 15:19:22 Nicolás Alvarez wrote:
> 2014-11-09 7:28 GMT-03:00 Frank Reininghaus :
> > Hi,
> > 
> > 2014-11-06 2:59 GMT+01:00 Milian Wolff:
> >> Hey all,
> >> 
> >> what do I do to get middle-click-closes-tab in Qt 5 without KTabBar?
> >> Previously, we used KTabBar and its mouseMiddleClick signal.
> > 
> > AFAIK, currently the only solution is to subclass QTabBar, override
> > the mousePressEvent method and emit a signal from there. Dolphin uses
> > this approach. There were many other reasons why Emmanuel created a
> > custom QTabBar subclass for Dolphin though .
> > 
> > If many apps need the "middle click to close" bevavior, then
> > reanimating KTabBar or getting this functionality into QTabBar might
> > be better than making every app create its own tab bar class.
> 
> Or maybe contribute mouseMiddleClick to QTabBar?
> (I'm not volunteering :P)

Yep. I'm wondering if an a patch just reacting on middle clicks would be 
accepted. It's not like it breaks existing work flows, it's just there for 
convenience.

Grepping qtbase showed that QMdiArea has a similar feature:

widgets/qmdiarea.cpp
582-void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event)
583-{
584:if (event->button() != Qt::MidButton) {
585-QTabBar::mousePressEvent(event);
586-return;
587-}
588-
589-QMdiSubWindow *subWindow = subWindowFromIndex(tabAt(event->pos()));
590-if (!subWindow) {
591-event->ignore();
592-return;
593-}
594-
595-subWindow->close();
596-}

Worth trying to patch this into QTabBar right away, I think.

Cheers

-- 
Kevin Funk | kf...@kde.org | http://kfunk.org
___
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


Re: How to port KTabBar::mouseMiddleClick?

2014-11-10 Thread Nicolás Alvarez
2014-11-09 7:28 GMT-03:00 Frank Reininghaus :
> Hi,
>
> 2014-11-06 2:59 GMT+01:00 Milian Wolff:
>> Hey all,
>>
>> what do I do to get middle-click-closes-tab in Qt 5 without KTabBar?
>> Previously, we used KTabBar and its mouseMiddleClick signal.
>
> AFAIK, currently the only solution is to subclass QTabBar, override
> the mousePressEvent method and emit a signal from there. Dolphin uses
> this approach. There were many other reasons why Emmanuel created a
> custom QTabBar subclass for Dolphin though .
>
> If many apps need the "middle click to close" bevavior, then
> reanimating KTabBar or getting this functionality into QTabBar might
> be better than making every app create its own tab bar class.

Or maybe contribute mouseMiddleClick to QTabBar?
(I'm not volunteering :P)

-- 
Nicolás
___
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


Re: How to port KTabBar::mouseMiddleClick?

2014-11-09 Thread Frank Reininghaus
Hi,

2014-11-06 2:59 GMT+01:00 Milian Wolff:
> Hey all,
>
> what do I do to get middle-click-closes-tab in Qt 5 without KTabBar?
> Previously, we used KTabBar and its mouseMiddleClick signal.

AFAIK, currently the only solution is to subclass QTabBar, override
the mousePressEvent method and emit a signal from there. Dolphin uses
this approach. There were many other reasons why Emmanuel created a
custom QTabBar subclass for Dolphin though .

If many apps need the "middle click to close" bevavior, then
reanimating KTabBar or getting this functionality into QTabBar might
be better than making every app create its own tab bar class.

Best regards,
Frank
___
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel


How to port KTabBar::mouseMiddleClick?

2014-11-05 Thread Milian Wolff
Hey all,

what do I do to get middle-click-closes-tab in Qt 5 without KTabBar? 
Previously, we used KTabBar and its mouseMiddleClick signal.

Bye
-- 
Milian Wolff
m...@milianw.de
http://milianw.de
___
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel