summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2019-07-04 21:20:19 -0400
committerJoseph Donofry <joedonofry@gmail.com>2019-07-04 21:20:19 -0400
commitc0a010acbb7f0045aa1ce33f82b0d537a715a886 (patch)
treeb3c28203235e32e8e4551fc9948f3b42fbaa3ae1 /src/ui
parentFix some linting issues (diff)
downloadnheko-c0a010acbb7f0045aa1ce33f82b0d537a715a886.tar.xz
Fix deprecated function call issues with Qt 5.13
Update to mtxclient 0.3.0
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/DropShadow.h22
-rw-r--r--src/ui/InfoMessage.cpp4
-rw-r--r--src/ui/Painter.h6
3 files changed, 19 insertions, 13 deletions
diff --git a/src/ui/DropShadow.h b/src/ui/DropShadow.h
index b7ba1985..d322fb42 100644
--- a/src/ui/DropShadow.h
+++ b/src/ui/DropShadow.h
@@ -30,7 +30,11 @@ public:
                 gradient.setStart(right0);
                 gradient.setFinalStop(right1);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(
+                // Deprecated in 5.13: painter.drawRoundRect(
+                //  QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)),
+                //  0.0,
+                //  0.0);
+                painter.drawRoundedRect(
                   QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)),
                   0.0,
                   0.0);
@@ -41,7 +45,7 @@ public:
                 gradient.setStart(left0);
                 gradient.setFinalStop(left1);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(
+                painter.drawRoundedRect(
                   QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0);
 
                 // Top
@@ -50,7 +54,7 @@ public:
                 gradient.setStart(top0);
                 gradient.setFinalStop(top1);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(
+                painter.drawRoundedRect(
                   QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0);
 
                 // Bottom
@@ -59,7 +63,7 @@ public:
                 gradient.setStart(bottom0);
                 gradient.setFinalStop(bottom1);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(
+                painter.drawRoundedRect(
                   QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)),
                   0.0,
                   0.0);
@@ -71,7 +75,7 @@ public:
                 gradient.setFinalStop(bottomright1);
                 gradient.setColorAt(endPosition1, end);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(QRectF(bottomright0, bottomright1), 0.0, 0.0);
+                painter.drawRoundedRect(QRectF(bottomright0, bottomright1), 0.0, 0.0);
 
                 // BottomLeft
                 QPointF bottomleft0(margin, height - margin);
@@ -80,7 +84,7 @@ public:
                 gradient.setFinalStop(bottomleft1);
                 gradient.setColorAt(endPosition1, end);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0);
+                painter.drawRoundedRect(QRectF(bottomleft0, bottomleft1), 0.0, 0.0);
 
                 // TopLeft
                 QPointF topleft0(margin, margin);
@@ -89,7 +93,7 @@ public:
                 gradient.setFinalStop(topleft1);
                 gradient.setColorAt(endPosition1, end);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(QRectF(topleft0, topleft1), 0.0, 0.0);
+                painter.drawRoundedRect(QRectF(topleft0, topleft1), 0.0, 0.0);
 
                 // TopRight
                 QPointF topright0(width - margin, margin);
@@ -98,12 +102,12 @@ public:
                 gradient.setFinalStop(topright1);
                 gradient.setColorAt(endPosition1, end);
                 painter.setBrush(QBrush(gradient));
-                painter.drawRoundRect(QRectF(topright0, topright1), 0.0, 0.0);
+                painter.drawRoundedRect(QRectF(topright0, topright1), 0.0, 0.0);
 
                 // Widget
                 painter.setBrush(QBrush("#FFFFFF"));
                 painter.setRenderHint(QPainter::Antialiasing);
-                painter.drawRoundRect(
+                painter.drawRoundedRect(
                   QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)),
                   radius,
                   radius);
diff --git a/src/ui/InfoMessage.cpp b/src/ui/InfoMessage.cpp
index e9de20cc..b18a80c4 100644
--- a/src/ui/InfoMessage.cpp
+++ b/src/ui/InfoMessage.cpp
@@ -22,7 +22,7 @@ InfoMessage::InfoMessage(QString msg, QWidget *parent)
         initFont();
 
         QFontMetrics fm{font()};
-        width_  = fm.width(msg_) + HPadding * 2;
+        width_  = fm.horizontalAdvance(msg_) + HPadding * 2;
         height_ = fm.ascent() + 2 * VPadding;
 
         setFixedHeight(height_ + 2 * HMargin);
@@ -64,7 +64,7 @@ DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent)
         msg_ = datetime.toString(fmt);
 
         QFontMetrics fm{font()};
-        width_  = fm.width(msg_) + HPadding * 2;
+        width_  = fm.horizontalAdvance(msg_) + HPadding * 2;
         height_ = fm.ascent() + 2 * VPadding;
 
         setFixedHeight(height_ + 2 * HMargin);
diff --git a/src/ui/Painter.h b/src/ui/Painter.h
index 8de39651..8feed17b 100644
--- a/src/ui/Painter.h
+++ b/src/ui/Painter.h
@@ -20,8 +20,10 @@ public:
         void drawTextRight(int x, int y, int outerw, const QString &text, int textWidth = -1)
         {
                 QFontMetrics m(fontMetrics());
-                if (textWidth < 0)
-                        textWidth = m.width(text);
+                if (textWidth < 0) {
+                        // deprecated in 5.13:      textWidth = m.width(text);
+                        textWidth = m.horizontalAdvance(text);
+                }
                 drawText((outerw - x - textWidth), y + m.ascent(), text);
         }