blob: 72e86ba593f43cc5dd6c11f6d135e72197729416 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
//! [0]
bool ok;
QGradient gradient = QtGradientDialog::getGradient(&ok, QRadialGradient(), this);
if (ok) {
// the user clicked OK and gradient is set to the gradient the user selected
} else {
// the user canceled the dialog; gradient is set to the initial
// value, in this case radial gradient
}
//! [0]
//! [1]
bool detailsVisible;
QColor::Spec spec;
QGradient gradient;
QtGradientDialog dlg(this);
dlg.setDetailsVisible(detailsVisible);
dlg.setSpec(spec);
dlg.setGradient(gradient);
if (dlg.exec() != QDialog::Accepted)
return;
gradient = dlg.gradient();
// detailsVisible and spec properties can be changed interactively by the user too,
// we store the values of these properties for the next time QtGradientDialog is executed.
detailsVisible = dlg.detailsVisible();
spec = dlg.spec();
//! [1]
//! [2]
QtGradientDialog dlg;
dlg.setBackgroundCheckered(true);
//! [2]
//! [3]
QtGradientDialog dlg;
dlg.setBackgroundCheckered(false);
//! [3]
|