MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / createIconButton

Function createIconButton

src/common/util/utils.h:16–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14namespace utils {
15
16 static DToolButton* createIconButton(QAction *action, QWidget *parent) {
17 DToolButton *iconBtn = new DToolButton(parent);
18 iconBtn->setFocusPolicy(Qt::NoFocus);
19 iconBtn->setEnabled(action->isEnabled());
20 iconBtn->setIcon(action->icon());
21 iconBtn->setFixedSize(QSize(36, 36));
22
23 QString toolTipStr = action->text();
24 if (!action->shortcut().isEmpty()) {
25 toolTipStr = toolTipStr + " " + action->shortcut().toString();
26 }
27
28 if (!toolTipStr.isEmpty())
29 iconBtn->setToolTip(toolTipStr);
30
31 QObject::connect(iconBtn, &DToolButton::clicked, action, &QAction::triggered);
32 QObject::connect(action, &QAction::changed, iconBtn, [=] {
33 QString toolTipStr = action->text() + " " + action->shortcut().toString();
34 iconBtn->setToolTip(toolTipStr);
35 iconBtn->setIcon(action->icon());
36 iconBtn->setEnabled(action->isEnabled());
37 });
38
39 return iconBtn;
40 }
41
42 static bool isWayland()
43 {

Callers 5

registerItemToToolBarMethod · 0.85
addTopToolItemMethod · 0.85
addTopToolItemToRightMethod · 0.85
createIconButtonMethod · 0.85
initCompileOutputMethod · 0.85

Calls 9

connectFunction · 0.85
setFixedSizeMethod · 0.80
setEnabledMethod · 0.45
isEnabledMethod · 0.45
setIconMethod · 0.45
iconMethod · 0.45
textMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected