| 197 | |
| 198 | |
| 199 | PathMappingsWidget::PathMappingsWidget(QWidget* parent): QWidget(parent) |
| 200 | { |
| 201 | auto *verticalLayout = new QVBoxLayout(this); |
| 202 | |
| 203 | m_pathMappingTable = new QTableView(this); |
| 204 | m_pathMappingTable->setSelectionBehavior(QAbstractItemView::SelectRows); |
| 205 | m_pathMappingTable->horizontalHeader()->setDefaultSectionSize(150); |
| 206 | m_pathMappingTable->horizontalHeader()->setStretchLastSection(true); |
| 207 | |
| 208 | verticalLayout->addWidget(m_pathMappingTable); |
| 209 | |
| 210 | m_pathMappingTable->setModel(new PathMappingModel()); |
| 211 | connect(m_pathMappingTable->model(), &QAbstractItemModel::dataChanged, this, &PathMappingsWidget::changed); |
| 212 | connect(m_pathMappingTable->model(), &QAbstractItemModel::rowsRemoved, this, &PathMappingsWidget::changed); |
| 213 | connect(m_pathMappingTable->model(), &QAbstractItemModel::rowsInserted, this, &PathMappingsWidget::changed); |
| 214 | |
| 215 | auto* deletePath = new QAction( |
| 216 | QIcon::fromTheme(QStringLiteral("edit-delete")), |
| 217 | i18n( "Delete" ), |
| 218 | this |
| 219 | ); |
| 220 | connect(deletePath, &QAction::triggered, this, &PathMappingsWidget::deletePath); |
| 221 | deletePath->setShortcut(Qt::Key_Delete); |
| 222 | deletePath->setShortcutContext(Qt::WidgetWithChildrenShortcut); |
| 223 | m_pathMappingTable->addAction(deletePath); |
| 224 | |
| 225 | } |
| 226 | |
| 227 | void PathMappingsWidget::deletePath() |
| 228 | { |