mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 14:15:42 +00:00
Add context menu for manipulating watch panel
This commit is contained in:
@@ -86,29 +86,8 @@ void RDTableWidget::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if(!m_customCopyPaste && e->matches(QKeySequence::Copy))
|
||||
{
|
||||
QList<QTableWidgetItem *> items = selectedItems();
|
||||
|
||||
std::sort(items.begin(), items.end(), [this](QTableWidgetItem *a, QTableWidgetItem *b) {
|
||||
if(row(a) != row(b))
|
||||
return row(a) < row(b);
|
||||
return column(a) < column(b);
|
||||
});
|
||||
|
||||
int prevRow = row(items[0]);
|
||||
|
||||
QString clipboardText;
|
||||
for(QTableWidgetItem *i : items)
|
||||
{
|
||||
clipboardText += i->text();
|
||||
|
||||
if(prevRow != row(i))
|
||||
clipboardText += lit("\n");
|
||||
else
|
||||
clipboardText += lit(" | ");
|
||||
}
|
||||
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(clipboardText.trimmed());
|
||||
copySelection();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,3 +96,30 @@ void RDTableWidget::keyPressEvent(QKeyEvent *e)
|
||||
|
||||
emit(keyPress(e));
|
||||
}
|
||||
|
||||
void RDTableWidget::copySelection()
|
||||
{
|
||||
QList<QTableWidgetItem *> items = selectedItems();
|
||||
|
||||
std::sort(items.begin(), items.end(), [this](QTableWidgetItem *a, QTableWidgetItem *b) {
|
||||
if(row(a) != row(b))
|
||||
return row(a) < row(b);
|
||||
return column(a) < column(b);
|
||||
});
|
||||
|
||||
int prevRow = row(items[0]);
|
||||
|
||||
QString clipboardText;
|
||||
for(QTableWidgetItem *i : items)
|
||||
{
|
||||
clipboardText += i->text();
|
||||
|
||||
if(prevRow != row(i))
|
||||
clipboardText += lit("\n");
|
||||
else
|
||||
clipboardText += lit(" | ");
|
||||
}
|
||||
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(clipboardText.trimmed());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user