solved by subclassing QItemDelegate and overriding sizehint- function:
.cpp
#include "mylistdelegate.h"
#include <QDebug>
MyListDelegate
::MyListDelegate(QObject *parent
) :{
}
{
sz.setHeight(fm.height()*1.5);
return sz;
}
#include "mylistdelegate.h"
#include <QDebug>
MyListDelegate::MyListDelegate(QObject *parent) :
QItemDelegate(parent)
{
}
QSize MyListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QFontMetrics fm(option.font);
QRect rect;
QSize sz=QItemDelegate::sizeHint(option, index);
sz.setHeight(fm.height()*1.5);
return sz;
}
To copy to clipboard, switch view to plain text mode
.h
#include <QStyledItemDelegate>
#include <QItemDelegate>
{
Q_OBJECT
public:
explicit MyListDelegate
(QObject *parent
= 0);
};
#include <QStyledItemDelegate>
#include <QItemDelegate>
class MyListDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit MyListDelegate(QObject *parent = 0);
virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
};
To copy to clipboard, switch view to plain text mode
Bookmarks