mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
When copy-pasting from a treeview, trim each line individually
* This helps with views that have icon-only columns at the start or end, which would generate unnecessary whitespace when copying multiple lines.
This commit is contained in:
@@ -604,6 +604,8 @@ void RDTreeView::copySelection()
|
||||
|
||||
int depth = GetDepth(model(), idx);
|
||||
|
||||
QString line;
|
||||
|
||||
for(int i = 0; i < colCount; i++)
|
||||
{
|
||||
QString format = i == 0 ? QFormatStr("%1") : QFormatStr(" %1");
|
||||
@@ -614,14 +616,14 @@ void RDTreeView::copySelection()
|
||||
if(i == 0)
|
||||
text.prepend(QString((depth - minDepth) * 2, QLatin1Char(' ')));
|
||||
|
||||
clipData += format.arg(text, -widths[i]);
|
||||
line += format.arg(text, -widths[i]);
|
||||
}
|
||||
|
||||
clipData += lit("\n");
|
||||
clipData += line.trimmed() + lit("\n");
|
||||
}
|
||||
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setText(clipData.trimmed());
|
||||
clipboard->setText(clipData);
|
||||
}
|
||||
|
||||
void RDTreeView::updateExpansionFromRow(RDTreeViewExpansionState &state, QModelIndex idx, uint seed,
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "RDTreeWidget.h"
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <QHeaderView>
|
||||
|
||||
Reference in New Issue
Block a user