From 18be12e9e9336ac18e0b97951968e1ff62cb5d29 Mon Sep 17 00:00:00 2001 From: Giuseppe Zizza Date: Fri, 8 Jun 2018 15:26:08 +0200 Subject: [PATCH] [CHG] Removed unnecessary duplicated functions --- src/ExtendedTableWidget.cpp | 13 ++++++++----- src/ExtendedTableWidget.h | 2 -- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ExtendedTableWidget.cpp b/src/ExtendedTableWidget.cpp index c2167ec3..270acef5 100644 --- a/src/ExtendedTableWidget.cpp +++ b/src/ExtendedTableWidget.cpp @@ -209,13 +209,13 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) : model()->setData(index, QVariant()); }); connect(copyAction, &QAction::triggered, [&]() { - copy(false); + copy(false, false); }); connect(copyWithHeadersAction, &QAction::triggered, [&]() { - copy(true); + copy(true, false); }); connect(copyAsSQLAction, &QAction::triggered, [&]() { - copySQL(); + copy(false, true); }); connect(pasteAction, &QAction::triggered, [&]() { paste(); @@ -564,14 +564,17 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event) // Call a custom copy method when Ctrl-C is pressed if(event->matches(QKeySequence::Copy)) { - copy(false); + copy(false, false); return; } else if(event->matches(QKeySequence::Paste)) { // Call a custom paste method when Ctrl-V is pressed paste(); } else if(event->modifiers().testFlag(Qt::ControlModifier) && event->modifiers().testFlag(Qt::ShiftModifier) && (event->key() == Qt::Key_C)) { // Call copy with headers when Ctrl-Shift-C is pressed - copy(true); + copy(true, false); + } else if(event->modifiers().testFlag(Qt::ControlModifier) && event->modifiers().testFlag(Qt::AltModifier) && (event->key() == Qt::Key_C)) { + // Call copy in SQL format when Ctrl-Alt-C is pressed + copy(false, true); } else if(event->key() == Qt::Key_Tab && hasFocus() && selectedIndexes().count() == 1 && selectedIndexes().at(0).row() == model()->rowCount()-1 && selectedIndexes().at(0).column() == model()->columnCount()-1) { diff --git a/src/ExtendedTableWidget.h b/src/ExtendedTableWidget.h index 0855c6ea..572a18f8 100644 --- a/src/ExtendedTableWidget.h +++ b/src/ExtendedTableWidget.h @@ -51,8 +51,6 @@ signals: private: void copy(const bool withHeaders, const bool inSQL ); - void copy(const bool withHeaders = false) { copy( withHeaders, false); } - void copySQL() { copy( false, true ); } void paste(); QString escapeCopiedData(const QByteArray& data) const;