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

Method addAutoFocusSwitcher

src/plugins/project/projectcore.cpp:123–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void ProjectCore::addAutoFocusSwitcher(WindowService *windowService, DToolButton *autoFocusSwitcher, DToolButton *focusFile)
124{
125 autoFocusSwitcher->setToolTip(tr("Auto Focus"));
126 autoFocusSwitcher->setIcon(QIcon::fromTheme("focus_auto"));
127 autoFocusSwitcher->setCheckable(true);
128 autoFocusSwitcher->setChecked(true);
129
130 focusFile->setToolTip(tr("Focus File"));
131 focusFile->setIcon(QIcon::fromTheme("focus"));
132
133 connect(focusFile, &DToolButton::clicked, this, []() {
134 ProjectKeeper::instance()->treeView()->focusCurrentFile();
135 },
136 Qt::DirectConnection);
137 focusFile->hide();
138
139 connect(autoFocusSwitcher, &DToolButton::clicked, this, [=]() {
140 bool state = ProjectKeeper::instance()->treeView()->getAutoFocusState();
141 ProjectKeeper::instance()->treeView()->setAutoFocusState(!state);
142 if (state) {
143 focusFile->show();
144 } else {
145 focusFile->hide();
146 }
147 },
148 Qt::DirectConnection);
149}
150
151void ProjectCore::addProjectProperty(WindowService *windowService, DToolButton *projectProperty)
152{

Callers

nothing calls this directly

Calls 10

connectFunction · 0.85
setCheckableMethod · 0.80
focusCurrentFileMethod · 0.80
getAutoFocusStateMethod · 0.80
setAutoFocusStateMethod · 0.80
setIconMethod · 0.45
setCheckedMethod · 0.45
treeViewMethod · 0.45
hideMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected