|
26 | 26 | #include <QComboBox> |
27 | 27 | #include <QPainter> |
28 | 28 | #include <QShortcut> |
| 29 | +#include <QProgressDialog> |
29 | 30 |
|
30 | 31 | #include <limits> |
31 | 32 |
|
@@ -506,7 +507,6 @@ void ExtendedTableWidget::reloadSettings() |
506 | 507 |
|
507 | 508 | void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMimeData* mimeData, const bool withHeaders, const bool inSQL) |
508 | 509 | { |
509 | | - QApplication::setOverrideCursor(Qt::WaitCursor); |
510 | 510 | QModelIndexList indices = fromIndices; |
511 | 511 |
|
512 | 512 | // Remove all indices from hidden columns, because if we don't, we might copy data from hidden columns as well which is very |
@@ -624,6 +624,11 @@ void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMime |
624 | 624 | } |
625 | 625 | } |
626 | 626 |
|
| 627 | + QProgressDialog progress(this); |
| 628 | + progress.setWindowModality(Qt::ApplicationModal); |
| 629 | + progress.setRange(*rowsInIndexes.begin(), *rowsInIndexes.end()); |
| 630 | + progress.setMinimumDuration(2000); |
| 631 | + |
627 | 632 | // Iterate over rows x cols checking if the index actually exists when needed, in order |
628 | 633 | // to support non-rectangular selections. |
629 | 634 | for(const int row : rowsInIndexes) { |
@@ -713,14 +718,19 @@ void ExtendedTableWidget::copyMimeData(const QModelIndexList& fromIndices, QMime |
713 | 718 | else |
714 | 719 | htmlResult.append("</tr>"); |
715 | 720 | result.append(rowSepText); |
| 721 | + |
| 722 | + progress.setValue(row); |
| 723 | + // Abort the operation if the user pressed ESC key or Cancel button |
| 724 | + if (progress.wasCanceled()) { |
| 725 | + return; |
| 726 | + } |
716 | 727 | } |
717 | 728 |
|
718 | 729 | if (!inSQL) { |
719 | 730 | htmlResult.append("</table></body></html>"); |
720 | 731 | mimeData->setHtml(htmlResult); |
721 | 732 | } |
722 | 733 | mimeData->setText(result); |
723 | | - QApplication::restoreOverrideCursor(); |
724 | 734 | } |
725 | 735 |
|
726 | 736 | void ExtendedTableWidget::copy(const bool withHeaders, const bool inSQL ) |
|
0 commit comments