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:
parent
9f71b941ed
commit
32ce9bfea9
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user