Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.3.0
-
None
Description
The following example demonstrates a bug on MacOSX with 4.3.0.
Running on other platforms or with 4.2.x it works as expected:
#include <QtGui>
class Editor : public QWidget
{
Q_OBJECT
public:
Editor(QWidget * parent = 0)
: QWidget(parent)
};
class Delegate : public QItemDelegate
{
Q_OBJECT
public:
Delegate(QObject *parent = 0)
: QItemDelegate(parent)
{}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
{ return QItemDelegate::sizeHint(option, index) + QSize(0, 4); }};
#include "main.moc"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStandardItemModel model(4, 2);
QTreeView treeView;
treeView.setModel(&model);
Delegate delegate;
treeView.setItemDelegate(&delegate);
for (int row = 0; row < 4; ++row) {
for (int column = 0; column < 2; ++column)
}
treeView.show();
return app.exec();
}
To reproduce:
start app
double click on a cell to start editing
notice how the lineedit doesn't use all the available space
This patch prevents the problem:
— /tmp/tmp.18648.11 2007-07-10 16:34:15.000000000 -0700
+++ /Users/anders/dev/qt-4.3/src/gui/kernel/qboxlayout.cpp 2007-07-10 16:24:34.000000000 -0700
@@ -132,6 +132,7 @@ void QBoxLayoutPrivate::effectiveMargins
int t = topMargin;
int r = rightMargin;
int b = bottomMargin;
+#if 0
#ifdef Q_WS_MAC
Q_Q(const QBoxLayout);
if (horz(dir))
}
#endif
+#endif
if (left)
*left = l;
if (top)