summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2014-09-22 14:04:34 +0400
committerAlexander Volkov <a.volkov@rusbitech.ru>2016-03-22 14:48:22 +0000
commit17d3825874b1333a0aa50ba1b8fe1c51d9c9a8db (patch)
treeb93062dc7f82176ce600632885d9229cde18b2ff /src/widgets
parenta02863234d76abb6c9f289026ae4ea3145924f30 (diff)
Don't use obsolete QStyle::PixelMetric enum items
There is only one place in Qt Widgets where they are still present - QProgressDialogPrivate::layout(). Change-Id: I53742dd6d5a61e468a90c6a487cf2a67f89b244c Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index f3fe500d26..26a8fcc92d 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -138,9 +138,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
void QProgressDialogPrivate::layout()
{
Q_Q(QProgressDialog);
- int sp = q->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
- int mtb = q->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin);
- int mlr = qMin(q->width() / 10, mtb);
+ int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q);
+ int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q);
+ int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q));
+ int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q));
const bool centered =
bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q));
@@ -154,12 +155,12 @@ void QProgressDialogPrivate::layout()
// dialog can be made very small if the user demands it so.
for (int attempt=5; attempt--;) {
cspc = cancel ? cs.height() + sp : 0;
- lh = qMax(0, q->height() - mtb - bh.height() - sp - cspc);
+ lh = qMax(0, q->height() - mb - bh.height() - sp - cspc);
if (lh < q->height()/4) {
// Getting cramped
sp /= 2;
- mtb /= 2;
+ mb /= 2;
if (cancel) {
cs.setHeight(qMax(4,cs.height()-sp-2));
}
@@ -171,14 +172,14 @@ void QProgressDialogPrivate::layout()
if (cancel) {
cancel->setGeometry(
- centered ? q->width()/2 - cs.width()/2 : q->width() - mlr - cs.width(),
- q->height() - mtb - cs.height(),
+ centered ? q->width()/2 - cs.width()/2 : q->width() - mr - cs.width(),
+ q->height() - mb - cs.height(),
cs.width(), cs.height());
}
if (label)
- label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh);
- bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height());
+ label->setGeometry(ml, additionalSpacing, q->width() - ml - mr, lh);
+ bar->setGeometry(ml, lh + sp + additionalSpacing, q->width() - ml - mr, bh.height());
}
void QProgressDialogPrivate::retranslateStrings()