1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

add copy to selection buffer (middle mouse-button issue #6)

This commit is contained in:
krepa098 2015-02-08 10:32:52 +01:00
parent 5ec3a2db85
commit e86b03b4f7
2 changed files with 13 additions and 3 deletions

View File

@ -180,6 +180,16 @@ void ChatLog::mousePressEvent(QMouseEvent* ev)
if(!isOverSelection(scenePos))
clearSelection();
}
#ifdef Q_OS_LINUX
if(ev->button() == Qt::MiddleButton)
{
copySelectedText(true);
if(!isOverSelection(scenePos))
clearSelection();
}
#endif
}
void ChatLog::mouseReleaseEvent(QMouseEvent* ev)
@ -528,13 +538,13 @@ void ChatLog::clear()
updateSceneRect();
}
void ChatLog::copySelectedText() const
void ChatLog::copySelectedText(bool toSelectionBuffer) const
{
QString text = getSelectedText();
QClipboard* clipboard = QApplication::clipboard();
if(clipboard && !text.isNull())
clipboard->setText(text);
clipboard->setText(text, toSelectionBuffer ? QClipboard::Selection : QClipboard::Clipboard);
}
void ChatLog::setBusyNotification(ChatLine::Ptr notification)

View File

@ -43,7 +43,7 @@ public:
void insertChatlineOnTop(const QList<ChatLine::Ptr>& newLines);
void clearSelection();
void clear();
void copySelectedText() const;
void copySelectedText(bool toSelectionBuffer = false) const;
void setBusyNotification(ChatLine::Ptr notification);
void setTypingNotification(ChatLine::Ptr notification);
void setTypingNotificationVisible(bool visible);