Warning, file /graphics/glaxnimate/src/gui/style/fixed_height_delegate.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #include <QStyledItemDelegate>
0008 
0009 namespace glaxnimate::gui::style {
0010 
0011 class FixedHeightDelegate : public QStyledItemDelegate
0012 {
0013 public:
0014     explicit FixedHeightDelegate(qreal height = -1) : height (height) {}
0015 
0016     void set_height(qreal height)
0017     {
0018         this->height = height;
0019     }
0020 
0021     QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const override
0022     {
0023         auto size = QStyledItemDelegate::sizeHint(option, index);
0024         size.setHeight(height);
0025         return size;
0026     }
0027 
0028 private:
0029     qreal height;
0030 };
0031 
0032 } // namespace glaxnimate::gui::style