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