| 161 | } |
| 162 | |
| 163 | void FolderIconSelector::contextMenuEvent(QContextMenuEvent* event) |
| 164 | { |
| 165 | QMenu menu(this); |
| 166 | menu.addAction("Open Folder", this, [=]{ |
| 167 | openFolder(); |
| 168 | }); |
| 169 | menu.addAction("Restore Default Icon", this, [=]{ // del desktop.ini |
| 170 | if (Util::restoreFolderIcon(dirPath)) { |
| 171 | QPixmapCache::clear(); // 清除缓存,否则文件夹图标不会更新 |
| 172 | setIcon(iconPro.icon(dirPath)); |
| 173 | } else { |
| 174 | showActionFailed(); |
| 175 | QMessageBox::warning(this, "Failed", "Failed to restore default icon.\nTry restart as [Administrator]."); |
| 176 | } |
| 177 | }); |
| 178 | menu.exec(event->globalPos()); |
| 179 | } |
| 180 | |
| 181 | void FolderIconSelector::mouseDoubleClickEvent(QMouseEvent* event) |
| 182 | { |
nothing calls this directly
no outgoing calls
no test coverage detected