mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-05 16:42:26 +02:00
Move the indentation in a bit
This commit is contained in:
parent
92805d37c1
commit
0b2302a675
@ -24,8 +24,8 @@
|
||||
#include <QStyleOption>
|
||||
#include <QWidget>
|
||||
|
||||
#define ARROW_WIDTH 8
|
||||
#define ARROW_HEIGHT 8
|
||||
#define ARROW_WIDTH 7
|
||||
#define ARROW_HEIGHT 7
|
||||
|
||||
|
||||
void
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
#define TREEVIEW_INDENT_ADD -7
|
||||
|
||||
class SourceDelegate : public QStyledItemDelegate
|
||||
{
|
||||
@ -79,7 +80,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
setDropIndicatorShown( false );
|
||||
setAllColumnsShowFocus( true );
|
||||
setUniformRowHeights( false );
|
||||
setIndentation( 16 );
|
||||
setIndentation( 14 );
|
||||
setSortingEnabled( true );
|
||||
sortByColumn( 0, Qt::AscendingOrder );
|
||||
|
||||
@ -594,7 +595,23 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::paint( painter, o, index );
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
|
||||
// shrink the indentations. count how indented this item is and remove it
|
||||
int indentMult = 0;
|
||||
QModelIndex counter = index;
|
||||
while ( counter.parent().isValid() )
|
||||
{
|
||||
indentMult++;
|
||||
counter = counter.parent();
|
||||
}
|
||||
int realX = opt.rect.x() + indentMult * TREEVIEW_INDENT_ADD;
|
||||
|
||||
opt.rect.setX( realX );
|
||||
const QWidget *widget = opt.widget;
|
||||
QStyle *style = widget ? widget->style() : QApplication::style();
|
||||
style->drawControl( QStyle::CE_ItemViewItem, &opt, painter, widget );
|
||||
}
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
|
Loading…
x
Reference in New Issue
Block a user