mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 15:21:30 +02:00
CCSWidget: fix misspelling
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// Copyright (c) 2020, The Monero Project.
|
||||
|
||||
#include "ccsprogressdelegate.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
CCSProgressDelegate::CCSProgressDelegate(CCSModel *model, QWidget *parent)
|
||||
: m_model(model)
|
||||
, QStyledItemDelegate(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCSProgressDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const {
|
||||
|
||||
if (index.column() != CCSModel::Progress) {
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
return;
|
||||
}
|
||||
|
||||
QStyleOptionProgressBar progressBarOption;
|
||||
progressBarOption.state = QStyle::State_Enabled;
|
||||
progressBarOption.direction = QApplication::layoutDirection();
|
||||
progressBarOption.rect = option.rect;
|
||||
progressBarOption.fontMetrics = QApplication::fontMetrics();
|
||||
progressBarOption.minimum = 0;
|
||||
progressBarOption.maximum = 100;
|
||||
progressBarOption.textAlignment = Qt::AlignCenter;
|
||||
progressBarOption.textVisible = true;
|
||||
|
||||
QSharedPointer<CCSEntry> entry = m_model->entry(index.row());
|
||||
auto target = QString("%1/%2 XMR").arg(entry->raised_amount).arg(entry->target_amount);
|
||||
auto progress = (int)entry->percentage_funded;
|
||||
progressBarOption.progress = progress < 0 ? 0 : progress;
|
||||
progressBarOption.text = target;
|
||||
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); // Draw the progress bar onto the view.
|
||||
}
|
||||
Reference in New Issue
Block a user