changeset 18766:0f9ed79fb206 gui-release

fix performance issue of history viewer with large history entries (bug #42255) * history-dock-widget.cc (constructor): set elide text mode, set max. displayed entry width to the desktop width
author Torsten <ttl@justmail.de>
date Tue, 06 May 2014 18:08:15 +0200
parents 95249367d6fa
children f6f1f27026bb
files libgui/src/history-dock-widget.cc
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/history-dock-widget.cc	Mon May 05 19:49:41 2014 +0200
+++ b/libgui/src/history-dock-widget.cc	Tue May 06 18:08:15 2014 +0200
@@ -29,7 +29,7 @@
 #include <QVBoxLayout>
 #include <QMenu>
 #include <QScrollBar>
-
+#include <QDesktopWidget>
 #include "error.h"
 
 #include "cmd-hist.h"
@@ -93,6 +93,14 @@
            this, SLOT (handle_double_click (QModelIndex)));
 
   setFocusProxy (_filter_line_edit);
+
+  // shrink max. displayed entry size to desktop width
+  QSize screen = QDesktopWidget ().screenGeometry ().size ();
+  int w = screen.width ();
+  QFontMetrics fm = _history_list_view->fontMetrics ();
+  int h = fm.height ();
+  _history_list_view->setGridSize (QSize (w,h));
+  _history_list_view->setTextElideMode (Qt::ElideRight);
 }
 
 void history_dock_widget::ctxMenu (const QPoint &xpos)
@@ -234,4 +242,3 @@
         _history_list_view->selectAll ();
     }
 }
-