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

Method showMenu

src/plugins/codeeditor/gui/tabbar.cpp:109–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void TabBarPrivate::showMenu(QPoint pos)
110{
111 int curIndex = tabBar->tabAt(pos);
112 DMenu menu;
113
114 menu.addAction(tr("Copy File Path"), [=]() {
115 auto file = tabBar->tabToolTip(curIndex);
116 QGuiApplication::clipboard()->setText(file);
117 });
118 menu.addAction(tr("Copy File Name"), [=]() {
119 auto file = tabBar->tabToolTip(curIndex);
120 auto fileName = QFileInfo(file).fileName();
121 QGuiApplication::clipboard()->setText(fileName);
122 });
123
124 menu.addSeparator();
125 menu.addAction(tr("Close This File"), [=]() {
126 auto file = tabBar->tabToolTip(curIndex);
127 q->removeTab(file);
128 });
129 menu.addAction(tr("Close All Files"), [=]() {
130 q->closeAllTab({});
131 });
132 menu.addAction(tr("Close All Files Except This"), [=]() {
133 auto curFile = tabBar->tabToolTip(curIndex);
134 QStringList exceptList { curFile };
135 q->closeAllTab(exceptList);
136 });
137
138 menu.addSeparator();
139 menu.addAction(tr("Show Containing Folder"), [=]() {
140 auto file = tabBar->tabToolTip(curIndex);
141 DDesktopServices::showFileItem(file);
142 });
143
144 menu.exec(QCursor::pos());
145}
146
147TabBar::TabBar(QWidget *parent)
148 : QWidget(parent),

Callers

nothing calls this directly

Calls 7

fileNameMethod · 0.80
addSeparatorMethod · 0.80
closeAllTabMethod · 0.80
addActionMethod · 0.45
setTextMethod · 0.45
removeTabMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected