source: trunk/doc/src/snippets/code/doc_src_groups.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: 487 bytes
Line 
1//! [0]
2void QPen::setStyle(Qt::PenStyle style)
3{
4 detach(); // detach from common data
5 d->style = style; // set the style member
6}
7
8void QPen::detach()
9{
10 if (d->ref != 1) {
11 ... // perform a deep copy
12 }
13}
14//! [0]
15
16
17//! [1]
18QPixmap p1, p2;
19p1.load("image.bmp");
20p2 = p1; // p1 and p2 share data
21
22QPainter paint;
23paint.begin(&p2); // cuts p2 loose from p1
24paint.drawText(0,50, "Hi");
25paint.end();
26//! [1]
Note: See TracBrowser for help on using the repository browser.