LeechCraft 0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
progressdelegate.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QStyledItemDelegate>
12#include "guiconfig.h"
13
14namespace LC::Util
15{
16 class UTIL_GUI_API ProgressDelegate : public QStyledItemDelegate
17 {
18 public:
19 struct Progress
20 {
21 int Minimum_ = 0;
24 QString Text_;
25 };
26
27 using ProgressGetter_t = std::function<std::optional<Progress> (QModelIndex)>;
28 private:
29 ProgressGetter_t ProgressGetter_;
30 public:
31 explicit ProgressDelegate (ProgressGetter_t&& progress, QObject *parent = nullptr);
32
33 void paint (QPainter*, const QStyleOptionViewItem&, const QModelIndex&) const override;
34 };
35}
std::function< std::optional< Progress >(QModelIndex)> ProgressGetter_t
ProgressDelegate(ProgressGetter_t &&progress, QObject *parent=nullptr)
void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override
#define UTIL_GUI_API
Definition guiconfig.h:16