diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2016-11-23 00:36:02 +0100 |
---|---|---|
committer | Anne Jan Brouwer <brouwer@annejan.com> | 2016-11-23 00:36:02 +0100 |
commit | 5776de92efffe8dcba61197773bd7778ad4a178d (patch) | |
tree | 20a4cfb789d94e95f11e12694c9970ca4d201f22 | |
parent | ab4a3b5ddbb13308a2c1586778632bcb8af1d7fa (diff) |
Blink from edit-copy to document-new icon for 500 seconds fixes #229
-rw-r--r-- | deselectabletreeview.h | 1 | ||||
-rw-r--r-- | mainwindow.cpp | 1 | ||||
-rw-r--r-- | qpushbuttonwithclipboard.cpp | 11 | ||||
-rw-r--r-- | qpushbuttonwithclipboard.h | 4 |
4 files changed, 17 insertions, 0 deletions
diff --git a/deselectabletreeview.h b/deselectabletreeview.h index 079019b0..fcd0e63e 100644 --- a/deselectabletreeview.h +++ b/deselectabletreeview.h @@ -54,6 +54,7 @@ private: QTime dieTime= QTime::currentTime().addMSecs(200); while (QTime::currentTime() < dieTime) QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + // could this be done nicer? if (!doubleClickHappened && clickSelected){ QModelIndex item = indexAt(event->pos()); bool selected = selectionModel()->isSelected(indexAt(event->pos())); diff --git a/mainwindow.cpp b/mainwindow.cpp index fdcddea0..1e4237fb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1842,6 +1842,7 @@ void MainWindow::copyTextByButtonClick(bool checked) { if (button == NULL) { return; } + button->changeIconPushed(); QString textToCopy = button->getTextToCopy(); copyTextToClipboard(textToCopy); } diff --git a/qpushbuttonwithclipboard.cpp b/qpushbuttonwithclipboard.cpp index aa956e35..9f9d0d02 100644 --- a/qpushbuttonwithclipboard.cpp +++ b/qpushbuttonwithclipboard.cpp @@ -36,3 +36,14 @@ QString QPushButtonWithClipboard::getTextToCopy() const { return textToCopy; } void QPushButtonWithClipboard::setTextToCopy(const QString &value) { textToCopy = value; } + +void QPushButtonWithClipboard::changeIconPushed() { + this->setIcon(*new QIcon( + QIcon::fromTheme("document-new", QIcon(":/icons/document-new.svg")))); + QTimer::singleShot(500, this, SLOT(changeIconDefault())); +} + +void QPushButtonWithClipboard::changeIconDefault() { + this->setIcon(*new QIcon( + QIcon::fromTheme("edit-copy", QIcon(":/icons/edit-copy.svg")))); +} diff --git a/qpushbuttonwithclipboard.h b/qpushbuttonwithclipboard.h index 057ccf4e..13ea48d9 100644 --- a/qpushbuttonwithclipboard.h +++ b/qpushbuttonwithclipboard.h @@ -14,6 +14,10 @@ public: QString getTextToCopy() const; void setTextToCopy(const QString &value); + void changeIconPushed(); + +private slots: + void changeIconDefault(); private: QString textToCopy; |