mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Move the indentation in a bit
This commit is contained in:
@@ -24,8 +24,8 @@
|
|||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#define ARROW_WIDTH 8
|
#define ARROW_WIDTH 7
|
||||||
#define ARROW_HEIGHT 8
|
#define ARROW_HEIGHT 7
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
#define TREEVIEW_INDENT_ADD -7
|
||||||
|
|
||||||
class SourceDelegate : public QStyledItemDelegate
|
class SourceDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
|||||||
setDropIndicatorShown( false );
|
setDropIndicatorShown( false );
|
||||||
setAllColumnsShowFocus( true );
|
setAllColumnsShowFocus( true );
|
||||||
setUniformRowHeights( false );
|
setUniformRowHeights( false );
|
||||||
setIndentation( 16 );
|
setIndentation( 14 );
|
||||||
setSortingEnabled( true );
|
setSortingEnabled( true );
|
||||||
sortByColumn( 0, Qt::AscendingOrder );
|
sortByColumn( 0, Qt::AscendingOrder );
|
||||||
|
|
||||||
@@ -594,7 +595,23 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
}
|
}
|
||||||
else
|
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
|
#ifdef Q_WS_MAC
|
||||||
|
Reference in New Issue
Block a user