×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Changing QWidget background colour

From Nokia Developer Wiki
Jump to: navigation, search
seppo_fn (Talk | contribs)
m (Protected "Change QWidget background color" [edit=sysop:move=sysop])
seppo_fn (Talk | contribs)
Line 1: Line 1:
 
{{CodeSnippet
 
{{CodeSnippet
 
|id=  
 
|id=  
|platform=Qt
+
|platform=S60 3rd Edition, FP1, FP2, S60 5th Edition
 
|devices=5800 XpressMusic
 
|devices=5800 XpressMusic
 
|category=Qt for S60
 
|category=Qt for S60

Revision as of 13:43, 28 April 2009

Article Metadata
Tested with
Devices(s): 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2, S60 5th Edition
Symbian
Article
Keywords: QPalette
Created: (27 Mar 2009)
Last edited: seppo_fn (28 Apr 2009)

Contents

Overview

This code snippets shows how to change QWidget background color.

Note: In order to use this code, you need to have Qt for S60 installed on your platform.


Preconditions


Main Function

  • Used to set the widget color
 p.setColor(QPalette::Background, Qt::black);

Source

Change background color of the QWidget.

#include <QPalette>
 
QMyWidget::QMyWidget(QWidget *parent)
: QWidget(parent)
{
QPalette p(palette());
// Set background color to black
p.setColor(QPalette::Background, Qt::black);
setPalette(p);
}

See also

More about QPalette

Postconditions

QWidget background color is black.

216 page views in the last 30 days.
×