forked from qt-creator/qt-creator
Debugger: Left-elide path names in breakpoint view
Task-number: QTCREATORBUG-11089 Change-Id: I97e11957c92c4127e3b3de73699ce16b8852c891 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -47,11 +47,25 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class LeftElideDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LeftElideDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||||
|
|
||||||
|
void paint(QPainter *pain, const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||||
|
{
|
||||||
|
QStyleOptionViewItem opt = option;
|
||||||
|
opt.textElideMode = Qt::ElideLeft;
|
||||||
|
QStyledItemDelegate::paint(pain, opt, index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class SmallTextEdit : public QTextEdit
|
class SmallTextEdit : public QTextEdit
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -681,6 +695,7 @@ BreakTreeView::BreakTreeView()
|
|||||||
{
|
{
|
||||||
setWindowIcon(Icons::BREAKPOINTS.icon());
|
setWindowIcon(Icons::BREAKPOINTS.icon());
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
setItemDelegateForColumn(2, new LeftElideDelegate(this));
|
||||||
connect(action(UseAddressInBreakpointsView), &QAction::toggled,
|
connect(action(UseAddressInBreakpointsView), &QAction::toggled,
|
||||||
this, &BreakTreeView::showAddressColumn);
|
this, &BreakTreeView::showAddressColumn);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user