source: trunk/doc/src/snippets/code/doc_src_qt4-styles.qdoc@ 5

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

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

File size: 1.0 KB
Line 
1//! [0]
2const QStyleOptionFocusRect *focusRectOption =
3 qstyleoption_cast<const QStyleOptionFocusRect *>(option);
4if (focusRectOption) {
5 ...
6}
7//! [0]
8
9
10//! [1]
11void MyWidget::paintEvent(QPaintEvent *event)
12{
13 QPainter painter(this);
14 ...
15
16 QStyleOptionFocusRect option(1);
17 option.init(this);
18 option.backgroundColor = palette().color(QPalette::Window);
19
20 style().drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter,
21 this);
22}
23//! [1]
24
25
26//! [2]
27void drawControl(ControlElement element,
28 QPainter *painter,
29 const QWidget *widget,
30 const QRect &rect,
31 const QColorGroup &colorGroup,
32 SFlags how = Style_Default,
33 const QStyleOption &option = QStyleOption::Default) const;
34//! [2]
35
36
37//! [3]
38void drawControl(ControlElement element,
39 const QStyleOption *option,
40 QPainter *painter,
41 const QWidget *widget = 0) const;
42//! [3]
Note: See TracBrowser for help on using the repository browser.