git repos / SagoImageBrowser

blame: src/thumbnaildelegate.h

normal view · raw

14cf904f Poul Sander 2026-06-22 18:18 1
/*
14cf904f Poul Sander 2026-06-22 18:18 2
MIT License
14cf904f Poul Sander 2026-06-22 18:18 3
14cf904f Poul Sander 2026-06-22 18:18 4
Copyright (c) 2026 Poul Sander
14cf904f Poul Sander 2026-06-22 18:18 5
14cf904f Poul Sander 2026-06-22 18:18 6
Permission is hereby granted, free of charge, to any person obtaining a copy
14cf904f Poul Sander 2026-06-22 18:18 7
of this software and associated documentation files (the "Software"), to deal
14cf904f Poul Sander 2026-06-22 18:18 8
in the Software without restriction, including without limitation the rights
14cf904f Poul Sander 2026-06-22 18:18 9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14cf904f Poul Sander 2026-06-22 18:18 10
copies of the Software, and to permit persons to whom the Software is
14cf904f Poul Sander 2026-06-22 18:18 11
furnished to do so, subject to the following conditions:
14cf904f Poul Sander 2026-06-22 18:18 12
14cf904f Poul Sander 2026-06-22 18:18 13
The above copyright notice and this permission notice shall be included in all
14cf904f Poul Sander 2026-06-22 18:18 14
copies or substantial portions of the Software.
14cf904f Poul Sander 2026-06-22 18:18 15
14cf904f Poul Sander 2026-06-22 18:18 16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14cf904f Poul Sander 2026-06-22 18:18 17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14cf904f Poul Sander 2026-06-22 18:18 18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14cf904f Poul Sander 2026-06-22 18:18 19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14cf904f Poul Sander 2026-06-22 18:18 20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14cf904f Poul Sander 2026-06-22 18:18 21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
14cf904f Poul Sander 2026-06-22 18:18 22
SOFTWARE.
14cf904f Poul Sander 2026-06-22 18:18 23
14cf904f Poul Sander 2026-06-22 18:18 24
*/
14cf904f Poul Sander 2026-06-22 18:18 25
1dcea855 Poul Sander 2026-05-26 21:48 26
#pragma once
1dcea855 Poul Sander 2026-05-26 21:48 27
1dcea855 Poul Sander 2026-05-26 21:48 28
#include <QStyledItemDelegate>
1dcea855 Poul Sander 2026-05-26 21:48 29
1dcea855 Poul Sander 2026-05-26 21:48 30
class ThumbnailDelegate : public QStyledItemDelegate
1dcea855 Poul Sander 2026-05-26 21:48 31
{
1dcea855 Poul Sander 2026-05-26 21:48 32
    Q_OBJECT
1dcea855 Poul Sander 2026-05-26 21:48 33
public:
1dcea855 Poul Sander 2026-05-26 21:48 34
    static constexpr int IconZoneHeight = 128;
1dcea855 Poul Sander 2026-05-26 21:48 35
1dcea855 Poul Sander 2026-05-26 21:48 36
    explicit ThumbnailDelegate(QObject *parent = nullptr);
1dcea855 Poul Sander 2026-05-26 21:48 37
1dcea855 Poul Sander 2026-05-26 21:48 38
    void paint(QPainter *painter, const QStyleOptionViewItem &option,
1dcea855 Poul Sander 2026-05-26 21:48 39
               const QModelIndex &index) const override;
1dcea855 Poul Sander 2026-05-26 21:48 40
1dcea855 Poul Sander 2026-05-26 21:48 41
    QSize sizeHint(const QStyleOptionViewItem &option,
1dcea855 Poul Sander 2026-05-26 21:48 42
                   const QModelIndex &index) const override;
1dcea855 Poul Sander 2026-05-26 21:48 43
};
1970-01-01 00:00 44