diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-11 15:18:07 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-23 07:46:01 +0000 |
commit | 324e221bee71b4fe4d525626acfa8edbcec3f16b (patch) | |
tree | 5659bbeda0f6b6f52a9d8e8079856eabe9288c3c /src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp | |
parent | 6b4963b5499269062e2cffe9e70df4f022c5bf8c (diff) |
QmlProfiler: Simplify painting of state widget
There is no reason to have an elaborate painting routine with rounded
corners and shadows. It doesn't fit the new "flat" paradigm and it's
unnecessarily complex.
Change-Id: I83ace95fdcccfc4cc41b17640a10154f7f64f89c
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp | 77 |
1 files changed, 3 insertions, 74 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp index 4165ecfe90..4086e12269 100644 --- a/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerstatewidget.cpp @@ -45,7 +45,6 @@ class QmlProfilerStateWidget::QmlProfilerStateWidgetPrivate QLabel *text; QProgressBar *progressBar; - QPixmap shadowPic; QmlProfilerStateManager *m_profilerState; QmlProfilerModelManager *m_modelManager; @@ -53,18 +52,18 @@ class QmlProfilerStateWidget::QmlProfilerStateWidgetPrivate QmlProfilerStateWidget::QmlProfilerStateWidget(QmlProfilerStateManager *stateManager, QmlProfilerModelManager *modelManager, QWidget *parent) - : QWidget(parent), d(new QmlProfilerStateWidgetPrivate(this)) + : QFrame(parent), d(new QmlProfilerStateWidgetPrivate(this)) { setObjectName(QLatin1String("QML Profiler State Display")); + setFrameStyle(QFrame::StyledPanel); // UI elements QVBoxLayout *layout = new QVBoxLayout(this); resize(200,70); - d->shadowPic.load(QLatin1String(":/timeline/dialog_shadow.png")); - d->text = new QLabel(this); d->text->setAlignment(Qt::AlignCenter); + setAutoFillBackground(true); layout->addWidget(d->text); d->progressBar = new QProgressBar(this); @@ -101,76 +100,6 @@ void QmlProfilerStateWidget::reposition() move(parentWidget->width()/2 - width()/2, parentWidget->height()/3 - height()/2); } -void QmlProfilerStateWidget::paintEvent(QPaintEvent *event) -{ - QWidget::paintEvent(event); - - QPainter painter(this); - painter.save(); - - // Shadow - // there is no actual qpainter borderimage, hacking it here - int borderWidth = 4; - - // topleft - painter.drawPixmap(QRect(0, 0, borderWidth, borderWidth), - d->shadowPic, - QRect(0, 0, borderWidth, borderWidth)); - // topright - painter.drawPixmap(QRect(width()-borderWidth, 0, borderWidth, borderWidth), - d->shadowPic, - QRect(d->shadowPic.width()-borderWidth, 0, borderWidth, borderWidth)); - // bottomleft - painter.drawPixmap(QRect(0, height()-borderWidth, borderWidth, borderWidth), - d->shadowPic, - QRect(0, d->shadowPic.height()-borderWidth, borderWidth, borderWidth)); - // bottomright - painter.drawPixmap(QRect(width()-borderWidth, height()-borderWidth, borderWidth, borderWidth), - d->shadowPic, - QRect(d->shadowPic.width()-borderWidth, - d->shadowPic.height()-borderWidth, - borderWidth, - borderWidth)); - // top - painter.drawPixmap(QRect(borderWidth, 0, width()-2*borderWidth, borderWidth), - d->shadowPic, - QRect(borderWidth, 0, d->shadowPic.width()-2*borderWidth, borderWidth)); - // bottom - painter.drawPixmap(QRect(borderWidth, height()-borderWidth, width()-2*borderWidth, borderWidth), - d->shadowPic, - QRect(borderWidth, - d->shadowPic.height()-borderWidth, - d->shadowPic.width()-2*borderWidth, - borderWidth)); - // left - painter.drawPixmap(QRect(0, borderWidth, borderWidth, height()-2*borderWidth), - d->shadowPic, - QRect(0, borderWidth, borderWidth, d->shadowPic.height()-2*borderWidth)); - // right - painter.drawPixmap(QRect(width()-borderWidth, borderWidth, borderWidth, height()-2*borderWidth), - d->shadowPic, - QRect(d->shadowPic.width()-borderWidth, - borderWidth, - borderWidth, - d->shadowPic.height()-2*borderWidth)); - // center - painter.drawPixmap(QRect(borderWidth, borderWidth, width()-2*borderWidth, height()-2*borderWidth), - d->shadowPic, - QRect(borderWidth, - borderWidth, - d->shadowPic.width()-2*borderWidth, - d->shadowPic.height()-2*borderWidth)); - - - // Background - painter.setBrush(Utils::creatorTheme()->color(Utils::Theme::BackgroundColorNormal)); - painter.drawRoundedRect(QRect(borderWidth, 0, width()-2*borderWidth, height()-borderWidth), 6, 6); - - // restore painter - painter.restore(); - -} - void QmlProfilerStateWidget::showText(const QString &text, bool showProgress) { setVisible(true); |