From 13eb29a93a1208dc4aa4f15950be5c0885e9227b Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sat, 5 Jan 2013 23:03:04 +0100 Subject: [PATCH] qt5: port to new QViewHeader API --- src/libtomahawk/playlist/ViewHeader.cpp | 7 ++++++- src/sourcetree/SourceTreeView.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/playlist/ViewHeader.cpp b/src/libtomahawk/playlist/ViewHeader.cpp index 51ab8a340..02054709d 100644 --- a/src/libtomahawk/playlist/ViewHeader.cpp +++ b/src/libtomahawk/playlist/ViewHeader.cpp @@ -32,10 +32,15 @@ ViewHeader::ViewHeader( QAbstractItemView* parent ) , m_sigmap( new QSignalMapper( this ) ) , m_init( false ) { +#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) + setSectionResizeMode( QHeaderView::Interactive ); + setSectionsMovable( true ); +#else setResizeMode( QHeaderView::Interactive ); + setMovable( true ); +#endif setMinimumSectionSize( 60 ); setDefaultAlignment( Qt::AlignLeft ); - setMovable( true ); setStretchLastSection( true ); // m_menu->addAction( tr( "Resize columns to fit window" ), this, SLOT( onToggleResizeColumns() ) ); diff --git a/src/sourcetree/SourceTreeView.cpp b/src/sourcetree/SourceTreeView.cpp index fce8978c7..f8145d9ac 100644 --- a/src/sourcetree/SourceTreeView.cpp +++ b/src/sourcetree/SourceTreeView.cpp @@ -117,7 +117,11 @@ SourceTreeView::SourceTreeView( QWidget* parent ) setModel( m_proxyModel ); header()->setStretchLastSection( false ); +#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) + header()->setSectionResizeMode( 0, QHeaderView::Stretch ); +#else header()->setResizeMode( 0, QHeaderView::Stretch ); +#endif connect( this, SIGNAL( expanded( QModelIndex ) ), SLOT( onItemExpanded( QModelIndex ) ) ); connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( onSelectionChanged() ) );