Changeset View
Changeset View
Standalone View
Standalone View
libapper/TransactionDelegate.cpp
Context not available. | |||||
39 | const QStyleOptionViewItem &option, | 39 | const QStyleOptionViewItem &option, | ||
---|---|---|---|---|---|
40 | const QModelIndex &index) const | 40 | const QModelIndex &index) const | ||
41 | { | 41 | { | ||
42 | QStyleOptionViewItemV4 opt1(option); | | |||
43 | if (opt1.state & QStyle::State_HasFocus) { | | |||
44 | opt1.state ^= QStyle::State_HasFocus; | | |||
45 | } | | |||
46 | QStyledItemDelegate::paint(painter, opt1, index); | | |||
47 | if (index.column() == 0 && !index.data(PkTransactionProgressModel::RoleRepo).toBool()) { | 42 | if (index.column() == 0 && !index.data(PkTransactionProgressModel::RoleRepo).toBool()) { | ||
48 | int progress = index.data(PkTransactionProgressModel::RoleProgress).toInt(); | 43 | int progress = index.data(PkTransactionProgressModel::RoleProgress).toInt(); | ||
49 | QString text = index.data(Qt::DisplayRole).toString(); | 44 | QString text = index.data(Qt::DisplayRole).toString(); | ||
Context not available. | |||||
51 | QStyleOptionProgressBarV2 progressBarOption; | 46 | QStyleOptionProgressBarV2 progressBarOption; | ||
52 | progressBarOption.state = QStyle::State_Enabled; | 47 | progressBarOption.state = QStyle::State_Enabled; | ||
53 | progressBarOption.direction = QApplication::layoutDirection(); | 48 | progressBarOption.direction = QApplication::layoutDirection(); | ||
54 | progressBarOption.rect = opt1.rect; | 49 | progressBarOption.rect = option.rect; | ||
55 | progressBarOption.fontMetrics = QApplication::fontMetrics(); | 50 | progressBarOption.fontMetrics = QApplication::fontMetrics(); | ||
56 | progressBarOption.minimum = 0; | 51 | progressBarOption.minimum = 0; | ||
57 | progressBarOption.maximum = 100; | 52 | progressBarOption.maximum = 100; | ||
Context not available. | |||||
61 | progressBarOption.textVisible = true; | 56 | progressBarOption.textVisible = true; | ||
62 | 57 | | |||
63 | QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); | 58 | QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); | ||
59 | } else { | ||||
60 | QStyleOptionViewItemV4 opt1(option); | ||||
61 | if (opt1.state & QStyle::State_HasFocus) { | ||||
62 | opt1.state ^= QStyle::State_HasFocus; | ||||
63 | } | ||||
64 | QStyledItemDelegate::paint(painter, opt1, index); | ||||
64 | } | 65 | } | ||
65 | } | 66 | } | ||
66 | 67 | | |||
Context not available. |