[vlc-devel] [PATCH 3/3] gui/qt: update look and feel related to extra metadata
Filip Roséen
filip at atch.se
Sat Feb 25 07:36:17 CET 2017
These changes allow for several cosmetic/functional advantages, such
as:
- automatically expand right-most column to fill entire width
- automatically expand rows to the contents within them
- scroll the table by pixel instead of by row
- remove edit triggers (as these do not have any meaning currently)
fixes #17656
---
modules/gui/qt/components/info_panels.cpp | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/components/info_panels.cpp b/modules/gui/qt/components/info_panels.cpp
index 111474da64..f008922c5a 100644
--- a/modules/gui/qt/components/info_panels.cpp
+++ b/modules/gui/qt/components/info_panels.cpp
@@ -402,6 +402,18 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent ) : QWidget( parent )
extraMeta->setColumnCount( 2 );
extraMeta->horizontalHeader()->hide();
extraMeta->verticalHeader()->hide();
+
+ extraMeta->horizontalHeader()->setStretchLastSection(true);
+ extraMeta->resizeRowsToContents();
+
+ extraMeta->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
+ extraMeta->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );
+
+ extraMeta->setSelectionBehavior( QAbstractItemView::SelectRows );
+
+ extraMeta->setEditTriggers( QAbstractItemView::NoEditTriggers );
+ extraMeta->setSelectionMode( QAbstractItemView::SingleSelection );
+
layout->addWidget( extraMeta, 1, 0 );
}
@@ -430,7 +442,12 @@ void ExtraMetaPanel::update( input_item_t *p_item )
target->insertRow( idx );
- target->setItem( idx, 0, new QTableWidgetItem( qfu( psz_key ) ) );
+ QTableWidgetItem *key = new QTableWidgetItem( qfu( psz_key ) );
+
+ key->setTextAlignment( Qt::AlignRight );
+ key->setFlags( key->flags() ^ Qt::ItemIsSelectable );
+
+ target->setItem( idx, 0, key );
target->setItem( idx, 1, new QTableWidgetItem( qfu( psz_value ) ) );
}
--
2.11.1
More information about the vlc-devel
mailing list