mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dynamic dive trip list column widths
Compute the default widths for the columns in the dive trip list from their header and (expected) content length rather than some fixed pixel sizes. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
10351b3495
commit
f18bcd6607
3 changed files with 63 additions and 8 deletions
|
@ -32,6 +32,8 @@ static bool keyboardFinished = false;
|
|||
StarWidgetsDelegate::StarWidgetsDelegate(QWidget *parent) : QStyledItemDelegate(parent),
|
||||
parentWidget(parent)
|
||||
{
|
||||
const StarMetrics& metrics = StarWidget::metrics();
|
||||
minStarSize = QSize(metrics.size * TOTALSTARS + metrics.spacing * (TOTALSTARS - 1), metrics.size);
|
||||
}
|
||||
|
||||
void StarWidgetsDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
|
@ -61,8 +63,12 @@ void StarWidgetsDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
|||
|
||||
QSize StarWidgetsDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
const StarMetrics& metrics = StarWidget::metrics();
|
||||
return QSize(metrics.size * TOTALSTARS + metrics.spacing * (TOTALSTARS - 1), metrics.size);
|
||||
return minStarSize;
|
||||
}
|
||||
|
||||
const QSize& StarWidgetsDelegate::starSize() const
|
||||
{
|
||||
return minStarSize;
|
||||
}
|
||||
|
||||
ComboBoxDelegate::ComboBoxDelegate(QAbstractItemModel *model, QObject *parent) : QStyledItemDelegate(parent), model(model)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue