1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-567 don't create a QSpinBox each time BrowserItemDelegate::sizeHint() is called

This commit is contained in:
Philippe Renon 2018-03-12 22:32:56 +01:00
parent 9f71b941ed
commit 32ce9bfea9
2 changed files with 7 additions and 2 deletions

View File

@ -31,7 +31,9 @@
BrowserItemDelegate::BrowserItemDelegate(QObject *parent) :
QStyledItemDelegate(parent)
{}
{
_sizeHint = QSpinBox().sizeHint();
}
QWidget *BrowserItemDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & option,
@ -75,5 +77,5 @@ QSize BrowserItemDelegate::sizeHint(const QStyleOptionViewItem & option, const Q
{
Q_UNUSED(option);
Q_UNUSED(index);
return QSpinBox().sizeHint();
return _sizeHint;
}

View File

@ -47,6 +47,9 @@ public:
const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem & option,
const QModelIndex &index) const;
private:
QSize _sizeHint;
};
#endif // BROWSERITEMDELEGATE_H