MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / paint

Method paint

Components/BackgroundTasksDialog.cpp:36–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void
37ProgressBarDelegate::paint(
38 QPainter *painter,
39 const QStyleOptionViewItem &option,
40 const QModelIndex &index) const
41{
42 const MultitaskControllerModel *model =
43 static_cast<const MultitaskControllerModel *>(index.model());
44
45 if (model != nullptr) {
46 QStyleOptionProgressBar progressBarOption;
47 qreal progress = model->data(index, Qt::DisplayRole).value<qreal>();
48 int intProgress = static_cast<int>(progress * 100);
49 progressBarOption.rect = option.rect;
50 progressBarOption.minimum = 0;
51 progressBarOption.maximum = 100;
52 progressBarOption.progress = intProgress;
53 progressBarOption.text = QString::number(intProgress) + "%";
54 progressBarOption.textVisible = true;
55
56 QApplication::style()->drawControl(
57 QStyle::CE_ProgressBar,
58 &progressBarOption,
59 painter);
60 }
61}
62
63BackgroundTasksDialog::BackgroundTasksDialog(QWidget *parent) :
64 QDialog(parent),

Callers

nothing calls this directly

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected