Bug 328060

Summary: Oxygen transparent: close confirmation dialog of designer-qt4 is not transparent
Product: [Plasma] Oxygen Reporter: Yichao Yu <yyc1992>
Component: styleAssignee: Hugo Pereira Da Costa <hugo.pereira.da.costa>
Severity: normal CC: hugo.pereira.da.costa, thomas.luebking
Priority: NOR    
Version: 4.11.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Yichao Yu 2013-11-25 14:25:33 UTC
The problem is that Designer set Qt::WindowModal on the message box which when the message box has a parent changes the window type to Qt::Sheet.

Haven't checked qt4 but at least Qt::Dialog and Qt::Sheet are treated the same in the xcb so I think that's the right thing to do for the theme as well (Bespin seems to use different background color for them... which is also fine... if not a bug).

Reproducible: Always

Minimum cpp program to demostrate the problem

class MainWindow: public QMainWindow {
    closeEvent(QCloseEvent *event)
        QMessageBox box(QMessageBox::Information, "", "",
                        QMessageBox::Discard, this);
        // box.setWindowModality(Qt::WindowModal); // uncomment this line to see the problem

main(int argc, char **argv)
    QApplication app(argc, argv);
    MainWindow win;
    return app.exec();
Comment 1 Hugo Pereira Da Costa 2013-11-25 14:41:16 UTC
I'm confused: can't reproduce the issue here with the provided program.
(whether or not I comment the modality line, appearing dialog is always transparent)
Qt version is 4.8.5
What's yours ? 
In any case I am fine with checking on Qt::Sheet windows
Comment 2 Hugo Pereira Da Costa 2013-11-25 14:42:53 UTC
Git commit 059583b8c61ca78b6d8912ee67ad90ed67773b1b by Hugo Pereira Da Costa.
Committed on 25/11/2013 at 14:41.
Pushed by hpereiradacosta into branch 'master'.

Added Qt::Sheet to the list of windows to tag as transparent.

M  +1    -0    style/oxygenargbhelper.cpp

Comment 3 Yichao Yu 2013-11-25 14:52:53 UTC
I'm using Qt 4.8.5 (-6 in arch linux package).
I was on the master of oxygen-transparent (which is just two commit behind right now).
Can you see this problem with designer-qt4 then?

I believe you would probably need to do this at other places as well (drawPrimitive at least? probably). With this patch, the background of the message box is not drawn at all.
Comment 4 Yichao Yu 2013-11-25 14:53:20 UTC
And also blur helper.
Comment 5 Hugo Pereira Da Costa 2013-11-25 15:01:32 UTC
Git commit db5bac3c67321087e98579f3785ac79d4a2a2caf by Hugo Pereira Da Costa.
Committed on 25/11/2013 at 14:59.
Pushed by hpereiradacosta into branch 'master'.

also ensured styled background is painted on Qt::sheet

M  +4    -2    style/oxygenstyle.cpp

Comment 6 Hugo Pereira Da Costa 2013-11-25 15:02:04 UTC
could reproduced with Qt designer
blur helper does not need change (apparently already detect the window it seems)
thanks for investigating this.
Comment 7 Yichao Yu 2013-11-25 15:08:45 UTC
Well, not sure about the internal logic of oxygen-transparent but there wasn't any blur effect with the previous patch..

Anyway, everything looks fine here now.
Comment 8 Yichao Yu 2013-11-25 15:17:02 UTC
P.S. the dialog that has the problem is the one that popup when you close the first window... Hopfully that's not what confuses you ....
(The code was copied from designer and that's why it's in closeEvent)
Comment 9 Thomas Lübking 2013-11-25 21:35:14 UTC
Many thanks for the notification.

Modal dialogs are supposed to invert the color (by default config) but i ruled out sheets[1] from everything because that concept only exists on OSX and there is very obviously the content blocker.

So it makes sense to treat them equally and tagging window only modal dialogs as sheet is "correct", while -tbh- the concept sucks (otherwise I had faked it ;-)

[1] https://developer.apple.com/library/mac/documentation/userexperience/conceptual/applehiguidelines/art/wn_sheetasmodaldlg_2x.png
Comment 10 Yichao Yu 2013-11-25 22:44:06 UTC
Yeah, I have noticed Qt::Sheet should be Mac specific, and that's why I'm confused when I see this[1] in the platform independent code....

Do you think this should be considered as a bug of Qt? Given that in qt's document[2] it says Qt::Sheet "Indicates that the window is a Macintosh sheet." and its certainly not.

[1] https://qt.gitorious.org/qt/qt/source/157da36977213237939df14608753bb3ec280f0b:src/gui/dialogs/qmessagebox.cpp#L2568
[2] http://qt-project.org/doc/qt-4.8/qt.html#WindowType-enum
Comment 11 Thomas Lübking 2013-11-25 22:56:24 UTC
(In reply to comment #10)
> Do you think this should be considered as a bug of Qt?

Rather not.

Setting the attribute (on OSX) for WindowModal windows is reasonable (to not say: "demanded by Apple HIG") and actually you could not prevent setting this attribute anyway (unless you'd introduce strictly platform dependent attributes and had to test the platform and the attribute on every set or get operation)

The fact that the state has in general no further meaning on other platforms (just like the Drawer, an even more stupid concept on OSX ;-) does not imply that setting it is a bug per se.
(In fact I abuse the brushed metal attribute to select windows for the glass look =)