source: trunk/doc/src/snippets/customviewstyle.cpp@ 244

Last change on this file since 244 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 854 bytes
Line 
1#include <QtGui>
2
3#include "customviewstyle.h"
4
5
6
7void CustomViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
8{
9
10//![0]
11 switch (element) {
12 case (PE_PanelItemViewItem): {
13 painter->save();
14
15 QPoint topLeft = option->rect.topLeft();
16 QPoint bottomRight = option->rect.topRight();
17 QLinearGradient backgroundGradient(topLeft, bottomRight);
18 backgroundGradient.setColorAt(0.0, QColor(Qt::yellow).lighter(190));
19 backgroundGradient.setColorAt(1.0, Qt::white);
20 painter->fillRect(option->rect, QBrush(backgroundGradient));
21
22 painter->restore();
23 break;
24 }
25 default:
26 QWindowsStyle::drawPrimitive(element, option, painter, widget);
27 }
28//![0]
29}
Note: See TracBrowser for help on using the repository browser.