summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/code/src_gui_widgets_qabstractbutton.cpp
blob: 099f0708ec18c897253227763991d2027a08861c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [0]
QPushButton *button = new QPushButton(tr("Ro&ck && Roll"), this);
//! [0]


//! [1]
button->setIcon(QIcon(":/images/print.png"));
button->setShortcut(tr("Alt+F7"));
//! [1]


//! [2]
void MyWidget::reactToToggle(bool checked)
{
   if (checked) {
      // Examine the new button states.
      ...
   }
}
//! [2]