@@ -737,6 +737,14 @@ void QtCodeArea::activateLocationId(Id locationId, bool fromMouse)
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::copySelection()
|
||||
{
|
||||
if (textCursor().hasSelection())
|
||||
{
|
||||
copy();
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
QPlainTextEdit::resizeEvent(e);
|
||||
|
||||
@@ -94,6 +94,8 @@ public:
|
||||
bool moveFocusInLine(size_t lineNumber, Id locationId, bool forward);
|
||||
void activateLocationId(Id locationId, bool fromMouse);
|
||||
|
||||
void copySelection();
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent* event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
|
||||
@@ -404,6 +404,14 @@ void QtCodeFile::focusBottom()
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFile::copySelection()
|
||||
{
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
snippet->copySelection();
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFile::clickedMinimizeButton()
|
||||
{
|
||||
MessageChangeFileView msg(
|
||||
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
void focusTop();
|
||||
void focusBottom();
|
||||
|
||||
void copySelection();
|
||||
|
||||
public slots:
|
||||
void clickedMinimizeButton();
|
||||
void clickedSnippetButton();
|
||||
|
||||
@@ -370,6 +370,14 @@ void QtCodeFileList::moveFocus(const CodeFocusHandler::Focus& focus, CodeFocusHa
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileList::copySelection()
|
||||
{
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
file->copySelection();
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileList::maximizeFirstFile()
|
||||
{
|
||||
if (m_files.size())
|
||||
|
||||
@@ -62,6 +62,8 @@ public:
|
||||
void setFocusOnTop() override;
|
||||
void moveFocus(const CodeFocusHandler::Focus& focus, CodeFocusHandler::Direction direction) override;
|
||||
|
||||
void copySelection() override;
|
||||
|
||||
void maximizeFirstFile();
|
||||
|
||||
std::pair<QtCodeFile*, Id> getFirstFileWithActiveLocationId() const;
|
||||
|
||||
@@ -261,6 +261,14 @@ void QtCodeFileSingle::moveFocus(
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileSingle::copySelection()
|
||||
{
|
||||
if (m_area)
|
||||
{
|
||||
m_area->copySelection();
|
||||
}
|
||||
}
|
||||
|
||||
const FilePath& QtCodeFileSingle::getCurrentFilePath() const
|
||||
{
|
||||
return m_currentFilePath;
|
||||
|
||||
@@ -56,6 +56,8 @@ public:
|
||||
void setFocusOnTop() override;
|
||||
void moveFocus(const CodeFocusHandler::Focus& focus, CodeFocusHandler::Direction direction) override;
|
||||
|
||||
void copySelection() override;
|
||||
|
||||
const FilePath& getCurrentFilePath() const;
|
||||
bool hasFileCached(const FilePath& filePath) const;
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
virtual void moveFocus(
|
||||
const CodeFocusHandler::Focus& focus, CodeFocusHandler::Direction direction) = 0;
|
||||
|
||||
virtual void copySelection() = 0;
|
||||
|
||||
protected:
|
||||
void ensureWidgetVisibleAnimated(
|
||||
const QWidget* parentWidget,
|
||||
|
||||
@@ -785,6 +785,13 @@ void QtCodeNavigator::keyPressEvent(QKeyEvent* event)
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_C:
|
||||
if (ctrl && !alt && !shift)
|
||||
{
|
||||
m_current->copySelection();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
QWidget::keyPressEvent(event);
|
||||
return;
|
||||
|
||||
@@ -227,6 +227,11 @@ void QtCodeSnippet::focusBottom()
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeSnippet::copySelection()
|
||||
{
|
||||
m_codeArea->copySelection();
|
||||
}
|
||||
|
||||
void QtCodeSnippet::ensureLocationIdVisible(Id locationId, bool animated)
|
||||
{
|
||||
m_codeArea->ensureLocationIdVisible(locationId, width(), animated);
|
||||
|
||||
@@ -59,6 +59,8 @@ public:
|
||||
void focusTop();
|
||||
void focusBottom();
|
||||
|
||||
void copySelection();
|
||||
|
||||
void ensureLocationIdVisible(Id locationId, bool animated);
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user