Bug 242271 - Oxygen style causes Qt program to not display png background graphic
Summary: Oxygen style causes Qt program to not display png background graphic
Status: RESOLVED FIXED
Alias: None
Product: Oxygen
Classification: Plasma
Component: style (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Hugo Pereira Da Costa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-20 17:18 UTC by philipp_muenzel
Modified: 2011-04-17 16:17 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description philipp_muenzel 2010-06-20 17:18:40 UTC
Version:           unspecified (using KDE 4.3.5) 
OS:                Linux

When loading a png file to a QPixmap and let a QPainter draw this pixmap, the png graphic does not show up when "Oxygen" style is selected via qtconfig. When selecting a different style like "Plastique", the Pixmap is immediately rendered correctly.

Reproducible: Always

Steps to Reproduce:
QPixmap background(QPixmap("example.png"));
QPainter painter;
painter.drawPixmap(background);

Actual Results:  
When selecting "Oxygen" as theme in qtconfig, a grey square is displayed instead of the exmaple.png. When selecting any other style, the png is displayed.

Expected Results:  
png should be drawn also when oxygen style is selected.

Qt is 4.6.3
Comment 1 Christoph Feck 2010-06-21 14:38:31 UTC
Please attach a complete test case. The code fragment above does not state where the painter paints to.
Comment 2 Hugo Pereira Da Costa 2010-06-21 16:10:58 UTC
As noted by Christophe, without the full chunk of code, there is nothing I can do about it. Some png are painted just fine (e.g: icons in toolbars).

Now some widgets have their "paintEvent" method bypassed by oxygen, and that would likely create the issue you mention, though browsing through the code, the only case where that seems to be a problem is for QToolBars, when detached.
Comment 3 nihui 2011-04-14 04:22:41 UTC
I can confirm this problem.
The background pixmap of my widget becomes dark in oxygen style, while fine in plastique style.

example source
run as ./myapp -style oxygen
run as ./myapp -style plastique
You will see the difference.
===================================================

#include <QtGui/QApplication>
#include <QtGui/QPalette>
#include <QtGui/QPixmap>
#include <QtGui/QWidget>

int main( int argc, char* argv[] )
{
    QApplication app( argc, argv );

    QWidget w;
    w.setAutoFillBackground( true );

    QPalette p( w.palette() );
    p.setBrush( QPalette::Window, QBrush( QPixmap( "example.png" ) ) );
    w.setPalette( p );

    w.show();

    return app.exec();
}
Comment 4 nihui 2011-04-14 04:24:36 UTC
My system info
Qt 4.7.2
KDE 4.6.2
Chakra Linux
Comment 5 Hugo Pereira Da Costa 2011-04-14 10:26:25 UTC
yes indeed the palette "brush" is ignored by oxygen when rendering widgets background (and you get the background gradient instead). I'll see to test on it and fix.
Comment 6 Hugo Pereira Da Costa 2011-04-17 16:15:35 UTC
Git commit 573289f1dffbceeaaf1a5e189c075cd84cae17f3 by Hugo Pereira Da Costa.
Committed on 17/04/2011 at 16:15.
Pushed by hpereiradacosta into branch 'master'.

Do not render window background in case a custom texture is attached to a palette.

CCBUG: 242271

M  +8    -1    kstyles/oxygen/oxygenstyle.cpp     

http://commits.kde.org/kde-workspace/573289f1dffbceeaaf1a5e189c075cd84cae17f3
Comment 7 Hugo Pereira Da Costa 2011-04-17 16:15:49 UTC
Git commit e7821f530cc506843523e6b846ba1095cea54513 by Hugo Pereira Da Costa.
Committed on 17/04/2011 at 16:15.
Pushed by hpereiradacosta into branch 'KDE/4.6'.

Do not render window background in case a custom texture is attached to a palette.

CCBUG: 242271

M  +8    -1    kstyles/oxygen/oxygenstyle.cpp     

http://commits.kde.org/kde-workspace/e7821f530cc506843523e6b846ba1095cea54513
Comment 8 Hugo Pereira Da Costa 2011-04-17 16:17:03 UTC
Fixed I think. So closing.