Enhance document editing capabilities by adding context menu options for copying, cutting, and pasting rows and cells in DocumentEditWidget. Refactor related methods for improved clipboard handling and data management. Introduce new helper functions for better code organization.
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QClipboard>
|
||||
#include <QMimeData>
|
||||
#include "../model/componenttablemodel.h"
|
||||
#include "../model/projectparamtablemodel.h"
|
||||
#include "../model/perechentablemodel.h"
|
||||
@@ -217,6 +219,14 @@ private slots:
|
||||
void onContextMenuMergeRows(); // Объединение нескольких выделенных строк (все столбцы)
|
||||
void onContextMenuMergeColumn(); // Объединение только определенного столбца
|
||||
void onContextMenuCellSettings();
|
||||
|
||||
// Слоты для копирования/вставки/вырезания
|
||||
void onContextMenuCopyRows(); // Копирование строк
|
||||
void onContextMenuCutRows(); // Вырезание строк
|
||||
void onContextMenuPasteRows(); // Вставка строк
|
||||
void onContextMenuCopyCells(); // Копирование ячеек
|
||||
void onContextMenuCutCells(); // Вырезание ячеек
|
||||
void onContextMenuPasteCells(); // Вставка ячеек
|
||||
|
||||
private:
|
||||
void setUp();
|
||||
@@ -228,6 +238,14 @@ private:
|
||||
// Вспомогательные методы
|
||||
int getCurrentSelectedRow() const;
|
||||
void applyColumnStretching(); // Метод для применения настроек растягивания столбцов
|
||||
|
||||
// Вспомогательные методы для копирования/вставки
|
||||
void copyRowsToClipboard(const QModelIndexList &rows);
|
||||
void pasteRowsFromClipboard(int insertPosition);
|
||||
void cutRows(int insertPosition); // Вырезает строки (копирует и удаляет)
|
||||
void copyCellsToClipboard(const QItemSelection &selection);
|
||||
void pasteCellsFromClipboard(const QModelIndex &topLeft);
|
||||
void cutCells(const QModelIndex &topLeft); // Вырезает ячейки (копирует и очищает)
|
||||
|
||||
DocumentProcessor *m_processor;
|
||||
ComponentTableModel *m_componentModel;
|
||||
|
||||
Reference in New Issue
Block a user