Bug 269410 - Custom title bar widget of QDockWidget can't be moved / floated by mouse in Oxygen/QtCurve (KStyle bug?)
Summary: Custom title bar widget of QDockWidget can't be moved / floated by mouse in O...
Status: RESOLVED FIXED
Alias: None
Product: Oxygen
Classification: Unclassified
Component: style (show other bugs)
Version: 4.0
Platform: Ubuntu Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Hugo Pereira Da Costa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-25 19:37 UTC by Filipe Azevedo
Modified: 2011-03-27 14:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test case for the bug report (5.43 KB, application/x-gzip)
2011-03-25 22:40 UTC, Filipe Azevedo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Filipe Azevedo 2011-03-25 19:37:03 UTC
Version:           4.0 (using KDE 4.6.1) 
OS:                Linux

I'm creating a custom title bar widget for my dock widget.
The widget herits QToolBar, and when i want to move the dock by mouse the dock does not unplug / plug but instead kde window become movable.
Dunnow if it's really caused by the style or the window manager so feel free to move the report.

Reproducible: Always

Steps to Reproduce:
Create a QToolBar, add actions in and set it as custom title bar widget of an instance of QDockWidget.
Add this dock widget into a QMainWindow and show it.
Try to move the dock - the entire windows is moved instead.

Actual Results:  
The windows is moved, not the dock widget.

Expected Results:  
The dock should unplug from main window and be movable.

Really boring bug ;)
Comment 1 Filipe Azevedo 2011-03-25 19:38:34 UTC
Forgot to say only Oxygen/QtCurve are affected, all official Qt Styles and alternate style installed on the system works as expected.
Comment 2 Hugo Pereira Da Costa 2011-03-25 19:57:05 UTC
First: this is the right place.

There is obviously a conflict a conflict between our window grabbing code, and whatever your custom thing does.
It can be either:
1. our window dragging code not working proplerly
2. your custom code not handling events the way it should.

Could you provide a stripped down compilable piece of code that allow us to reproduce the issue ? (your "steps to reproduce" can't really help here).

This way we could sort it out between 1. or 2.
Comment 3 Hugo Pereira Da Costa 2011-03-25 19:59:20 UTC
PS: QtCurve shares the same window dragging code as oxygen. Interestingly you could also try bespin which has a similar (but differently coded) feature. Uou might need to turn on the feature in bespin config though.
Comment 4 Christoph Feck 2011-03-25 20:11:08 UTC
Hugo, see here:

http://doc.qt.nokia.com/latest/qdockwidget.html#setTitleBarWidget
Comment 5 Hugo Pereira Da Costa 2011-03-25 20:31:26 UTC
Thanks Christoph,
will give a shot at one example from the code above to see where the problem is.
Still having the real-case implementation from sNox would help :)
Comment 6 Hugo Pereira Da Costa 2011-03-25 20:32:57 UTC
(in principle, if the QMouseEvent::ignore() is called and do pass events to the dockwidget, then it should not interfere with our window grabbing (since it does not for non-custom dock widgets). But that's what I need to check, I guess ...
Comment 7 Hugo Pereira Da Costa 2011-03-25 20:48:37 UTC
More notes: just tried the /usr/lib/qt4/demos/mainwindow example, for which setTitleBarWidget is used on one of the dock widgets. 
It works just fine with oxygen, in terms of window grabbing.
So this is not a *generic* bug. 
It has to be related to sNox own custom widget. (hence my original request)
Comment 8 Filipe Azevedo 2011-03-25 22:40:55 UTC
Created attachment 58341 [details]
Test case for the bug report

Here is the test case. I took the class as is from my lib and just comment / rework a little the code so it compil fine.
I still can reproduce the bug with oxygen/qtcurve, but not all others ( even bespin having the allow windows move option ).

Hope it can help ;)
Comment 9 Filipe Azevedo 2011-03-25 23:07:30 UTC
Add tested the mainwindow demos and yes it works fine - it use QWidget.
I repalced my custom widget by a frame / label / widget and it works.

And set back QToolBar, no longer works :D
Comment 10 Hugo Pereira Da Costa 2011-03-25 23:17:07 UTC
ah yes. QToolBar. Thats why. We grab explicitly from QToolBar; not from the
mainwindow below. I assume this is why it is not working. 
I'll work on a fix.
Thanks for posting your code !
(cant even remember why I had to force grabbing manually from a toolbar. Will
have a look).
Comment 11 Filipe Azevedo 2011-03-25 23:23:57 UTC
Thanks you ;)
Comment 12 Hugo Pereira Da Costa 2011-03-27 12:20:57 UTC
Git commit 5daddbefdecc0945becfe0aabdc29da514fda315 by Hugo Pereira Da Costa.
Committed on 27/03/2011 at 12:22.
Pushed by hpereiradacosta into branch 'master'.

Make sure widget is not a Dock "title Widget" (passed via QDockWidget::setTitleBarWidget)
before setting as dragable.

CCBUG: 269410

M  +22   -4    kstyles/oxygen/oxygenwindowmanager.cpp     
M  +3    -0    kstyles/oxygen/oxygenwindowmanager.h     

http://commits.kde.org/kde-workspace/5daddbefdecc0945becfe0aabdc29da514fda315
Comment 13 Hugo Pereira Da Costa 2011-03-27 12:22:34 UTC
Git commit 9ee656c206677d2ccf3dcca0079eff9bd3d91ec3 by Hugo Pereira Da Costa.
Committed on 27/03/2011 at 12:22.
Pushed by hpereiradacosta into branch 'KDE/4.6'.

Make sure widget is not a Dock "title Widget" (passed via QDockWidget::setTitleBarWidget)
before setting as dragable.

CCBUG: 269410

M  +22   -4    kstyles/oxygen/oxygenwindowmanager.cpp     
M  +3    -0    kstyles/oxygen/oxygenwindowmanager.h     

http://commits.kde.org/kde-workspace/9ee656c206677d2ccf3dcca0079eff9bd3d91ec3
Comment 14 Hugo Pereira Da Costa 2011-03-27 12:29:28 UTC
Fixed for both KDE/4.6 and master.
Should work with other types of custom titlebar widgets (like menubars, statusbars and tabbars -who would do that :) ?- )

Thanks for reporting (and posting your code), very helpful !

I'd suggest you ping CraigD (http://kde-look.org/content/show.php?content=40492) about the bug report and the fix so that he copy to QtCurve (he uses the exact same code).

Cheers,

Hugo
Comment 15 Hugo Pereira Da Costa 2011-03-27 12:31:29 UTC
PS: I do remember why I grab explicitly from toolbar.
It's because we have a "reduced" window grab mode that allows user to drag from empty areas in menubars and toolbars, and NOT from anywhere else.
Hence the explicit grabbing.

The committed patch above also works in this "reduce" mode.
Comment 16 Filipe Azevedo 2011-03-27 14:53:23 UTC
Thanks you very much for the quick fix!!!
Hope distros will integrate it quickly :D

I have pingued CraigD and link here.

Br,