fixed ctrl+c to copy text
This commit is contained in:
@@ -161,15 +161,22 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||
notebook->previousTab();
|
||||
}
|
||||
} else if (event->key() == Qt::Key_C && event->modifiers() == Qt::ControlModifier) {
|
||||
event->accept();
|
||||
|
||||
this->chatWidget->doCopy();
|
||||
if (this->chatWidget->view.hasSelection()) {
|
||||
this->chatWidget->doCopy();
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this->textLengthVisibleChangedConnection =
|
||||
SettingsManager::getInstance().showMessageLength.valueChanged.connect(
|
||||
[this](const bool &value) { this->textLengthLabel.setHidden(!value); });
|
||||
|
||||
QObject::connect(&this->textInput, &QTextEdit::copyAvailable, [this](bool available) {
|
||||
if (available) {
|
||||
this->chatWidget->view.clearSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ChatWidgetInput::~ChatWidgetInput()
|
||||
@@ -177,6 +184,16 @@ ChatWidgetInput::~ChatWidgetInput()
|
||||
this->textLengthVisibleChangedConnection.disconnect();
|
||||
}
|
||||
|
||||
void ChatWidgetInput::clearSelection()
|
||||
{
|
||||
QTextCursor c = this->textInput.textCursor();
|
||||
|
||||
c.setPosition(c.position());
|
||||
c.setPosition(c.position(), QTextCursor::KeepAnchor);
|
||||
|
||||
this->textInput.setTextCursor(c);
|
||||
}
|
||||
|
||||
void ChatWidgetInput::refreshTheme()
|
||||
{
|
||||
QPalette palette;
|
||||
|
||||
Reference in New Issue
Block a user