diff options
| author | Krzysztof Starecki <krzysztof.starecki@gmail.com> | 2018-12-31 16:08:47 +0100 |
|---|---|---|
| committer | Krzysztof Starecki <krzysztof.starecki@gmail.com> | 2018-12-31 16:12:25 +0100 |
| commit | 412a0620820d26294ddbc306b137692c65e8e980 (patch) | |
| tree | da224d813b1298d95422cacc2fbfda06a09f71ec /src/downloadlistwidget.cpp | |
| parent | 03823a433a27bb5f9a94973c47e1408dd83cc5c0 (diff) | |
Tweak styling options for downloads tab, port Paper Light theme for reference
Diffstat (limited to 'src/downloadlistwidget.cpp')
| -rw-r--r-- | src/downloadlistwidget.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp index e908faf3..ac327f7b 100644 --- a/src/downloadlistwidget.cpp +++ b/src/downloadlistwidget.cpp @@ -32,21 +32,31 @@ void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewIt if (sourceIndex.column() == DownloadList::COL_STATUS && sourceIndex.row() < m_Manager->numTotalDownloads()
&& m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_DOWNLOADING) {
bool pendingDownload = sourceIndex.row() >= m_Manager->numTotalDownloads();
- QProgressBar progressBarOption;
- progressBarOption.setProperty("compact", option.widget->property("compact"));
- progressBarOption.setMinimum(0);
- progressBarOption.setMaximum(100);
- progressBarOption.setAlignment(Qt::AlignCenter);
- progressBarOption.resize(option.rect.width(), option.rect.height());
- progressBarOption.setValue(m_Manager->getProgress(sourceIndex.row()).first);
- progressBarOption.setFormat(m_Manager->getProgress(sourceIndex.row()).second);
+ QProgressBar progressBar;
+ progressBar.setProperty("downloadView", option.widget->property("downloadView"));
+ progressBar.resize(option.rect.width(), option.rect.height());
+ progressBar.setTextVisible(false);
+ progressBar.setMinimum(0);
+ progressBar.setMaximum(100);
+ progressBar.setValue(m_Manager->getProgress(sourceIndex.row()).first);
+ progressBar.setStyle(QApplication::style());
+
+ QLabel progressText;
+ progressText.setProperty("downloadView", option.widget->property("downloadView"));
+ progressText.setProperty("downloadProgress", true);
+ progressText.resize(option.rect.width(), option.rect.height());
+ progressText.setAttribute(Qt::WA_TranslucentBackground);
+ progressText.setAlignment(Qt::AlignCenter);
+ progressText.setText(m_Manager->getProgress(sourceIndex.row()).second);
+ progressText.setStyle(QApplication::style());
// paint the background with default delegate first to preserve table cell styling
QStyledItemDelegate::paint(painter, option, index);
painter->save();
painter->translate(option.rect.topLeft());
- progressBarOption.render(painter);
+ progressBar.render(painter);
+ progressText.render(painter);
painter->restore();
} else {
QStyledItemDelegate::paint(painter, option, index);
|
