[vlc-commits] gui/qt: update look and feel related to extra metadata

Filip Roséen git at videolan.org
Sat Feb 25 15:22:15 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Feb 25 07:36:17 2017 +0100| [28e94cc9561834e0a8da59da4d84891cf8913ff5] | committer: Jean-Baptiste Kempf

gui/qt: update look and feel related to extra metadata

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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28e94cc9561834e0a8da59da4d84891cf8913ff5
---

 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 111474d..f008922 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 ) ) );
         }
 



More information about the vlc-commits mailing list