fix qt dialog list resizing (bug 1033)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9802 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2005-04-11 07:00:03 +00:00
parent 882a1f2e7e
commit 9dd60d60b3
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2005-04-11 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* panelstack.C (addCategory): let the listview compute the
correct width.
2005-04-08 Angus Leeming <leeming@lyx.org>
* QAbout.C (build_dialog): specify that the CREDITS data is

View File

@ -15,6 +15,7 @@
#include "qt_helpers.h"
#include <qwidgetstack.h>
#include <qfontmetrics.h>
#include <qlayout.h>
#include <qlistview.h>
@ -87,8 +88,13 @@ void PanelStack::addCategory(string const & n, string const & parent)
item->setOpen(true);
panel_map_[n] = item;
// Qt is just unbelievably moronic
list_->setMinimumSize(QSize(150, list_->minimumHeight()));
// calculate the real size the current item needs in the listview
QFontMetrics fm(list_->font());
int itemsize = item->width(fm, list_, 0) + 10
+ list_->treeStepSize() * (item->depth() + 1) + list_->itemMargin();
// adjust the listview width to the max. itemsize
if (itemsize > list_->minimumWidth())
list_->setMinimumWidth(itemsize);
}