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

Method createToolBtn

src/plugins/core/gui/navigationbar.cpp:99–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99DToolButton *NavigationBar::createToolBtn(QAction *action, bool isNavigationItem)
100{
101 DToolButton *navBtn = new DToolButton(this);
102
103 navBtn->setToolTip(action->text());
104 navBtn->setIcon(action->icon());
105
106 navBtn->setMinimumSize(QSize(36, 36));
107 navBtn->setIconSize(QSize(22, 22));
108 navBtn->setFocusPolicy(Qt::NoFocus);
109
110 if (isNavigationItem) {
111 navBtn->setCheckable(true);
112 navBtn->setChecked(false);
113
114 navBtns.insert(action->text(), navBtn);
115
116 connect(navBtn, &DToolButton::clicked, this, [=]() {
117 Controller::instance()->switchWidgetNavigation(action->text());
118 });
119
120 connect(action, &QAction::triggered, this, [=](){
121 setNavActionChecked(action->text(), true);
122 });
123
124 return navBtn;
125 }
126
127 connect(navBtn, &DToolButton::clicked, action, &QAction::trigger);
128
129 return navBtn;
130}
131
132void NavigationBar::setNavActionChecked(const QString &actionName, bool checked)
133{

Callers

nothing calls this directly

Calls 8

connectFunction · 0.85
setCheckableMethod · 0.80
insertMethod · 0.80
textMethod · 0.45
setIconMethod · 0.45
iconMethod · 0.45
setCheckedMethod · 0.45

Tested by

no test coverage detected