| 135 | } |
| 136 | |
| 137 | bool DockToolbar::eventFilter(QObject* object, QEvent* event) { |
| 138 | if (object == ui_->label && event->type() == QEvent::MouseButtonDblClick) { |
| 139 | enterRenameMode(); |
| 140 | return true; |
| 141 | } |
| 142 | if (object == ui_->lineEditRename) { |
| 143 | // Match the tab-rename UX: focus loss reverts; only Enter (returnPressed) |
| 144 | // commits. Escape reverts explicitly. |
| 145 | if (event->type() == QEvent::FocusOut) { |
| 146 | cancelRename(); |
| 147 | } else if (event->type() == QEvent::KeyPress && static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape) { |
| 148 | cancelRename(); |
| 149 | return true; |
| 150 | } |
| 151 | } |
| 152 | return QObject::eventFilter(object, event); |
| 153 | } |
| 154 | |
| 155 | void DockToolbar::enterRenameMode() { |
| 156 | if (rename_active_) { |
nothing calls this directly
no test coverage detected