+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
#include "qt_helpers.h"
#include <qwidgetstack.h>
+#include <qfontmetrics.h>
#include <qlayout.h>
#include <qlistview.h>
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);
}