--- a/src/aboutdialog/AnimatedBarWidget.cpp
+++ b/src/aboutdialog/AnimatedBarWidget.cpp
@@ -20,6 +20,7 @@
 #include <QIcon>
 
 #include <QHBoxLayout>
+#include <QMargins>
 #include <QPainter>
 #include <QStyleOption>
 
@@ -116,23 +117,22 @@ AnimatedBarWidget::paintEvent( QPaintEve
 
     drawHoverBackground(&painter);
 
-    int left, top, right, bottom;
-    getContentsMargins ( &left, &top, &right, &bottom );
+    QMargins margins = contentsMargins();
     const int padding = 2;
     const int iconWidth = iconSize().width();
     const int iconHeight = iconSize().height();
-    const int iconTop = ( (buttonHeight - top - bottom) - iconHeight ) / 2;
+    const int iconTop = ( (buttonHeight - margins.top() - margins.bottom()) - iconHeight ) / 2;
 
     if( !m_animating )
     {
-        const QRect iconRect( left + padding, iconTop, iconWidth, iconHeight );
+        const QRect iconRect( margins.left() + padding, iconTop, iconWidth, iconHeight );
         painter.drawPixmap( iconRect, icon().pixmap( iconSize() ) );
     }
     else
-        m_animatedWidget->move( left + padding, iconTop );
+        m_animatedWidget->move( margins.left() + padding, iconTop );
 
-    const QRect textRect( left + (padding * 3) + iconWidth, top,
-                          buttonWidth - (left + padding * 3 + iconWidth) - padding, buttonHeight);
+    const QRect textRect( margins.left() + (padding * 3) + iconWidth, margins.top(),
+                          buttonWidth - (margins.left() + padding * 3 + iconWidth) - padding, buttonHeight);
     QFontMetrics fm( font() );
     painter.drawText( textRect, Qt::AlignVCenter | Qt::TextWordWrap, text() );
 }
--- a/src/playlist/PlaylistBreadcrumbItemSortButton.cpp
+++ b/src/playlist/PlaylistBreadcrumbItemSortButton.cpp
@@ -18,6 +18,7 @@
 
 #include <QIcon>
 
+#include <QMargins>
 #include <QPainter>
 #include <QStyle>
 #include <QStyleOption>
@@ -68,12 +69,11 @@ BreadcrumbItemSortButton::paintEvent( QP
     const int preferredWidth = qMax( minimumWidth(), sizeHint().width() );
     const int buttonWidth = qMin( preferredWidth, width() );
 
-    int left, top, right, bottom;
-    getContentsMargins ( &left, &top, &right, &bottom );
+    QMargins margins = contentsMargins();
     const int padding = 2;
 
     const int arrowLeft = buttonWidth - m_arrowWidth - padding;
-    const int arrowTop = ( ( buttonHeight - top - bottom) - m_arrowHeight )/2;
+    const int arrowTop = ( ( buttonHeight - margins.top() - margins.bottom()) - m_arrowHeight )/2;
     m_arrowRect = QRect( arrowLeft, arrowTop, m_arrowWidth, m_arrowHeight );
 
     drawHoverBackground( &painter );
--- a/src/widgets/BreadcrumbItemButton.cpp
+++ b/src/widgets/BreadcrumbItemButton.cpp
@@ -31,6 +31,7 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QMimeData>
+#include <QMargins>
 #include <QPainter>
 #include <QStyle>
 #include <QStyleOptionFocusRect>
@@ -127,8 +128,7 @@ BreadcrumbItemButton::paintEvent( QPaint
     }
     drawHoverBackground(&painter);
 
-    int left, top, right, bottom;
-    getContentsMargins ( &left, &top, &right, &bottom );
+    QMargins margins = contentsMargins();
     const int padding = 2;
     int xoffset;
 
@@ -136,15 +136,15 @@ BreadcrumbItemButton::paintEvent( QPaint
     {
         const int iconWidth = iconSize().width();
         const int iconHeight = iconSize().height();
-        const int iconTop = ( (buttonHeight - top - bottom) - iconHeight ) / 2;
-        const QRect iconRect( left + padding, iconTop, iconWidth, iconHeight );
+        const int iconTop = ( (buttonHeight - margins.top() - margins.bottom()) - iconHeight ) / 2;
+        const QRect iconRect( margins.left() + padding, iconTop, iconWidth, iconHeight );
         painter.drawPixmap( iconRect, icon().pixmap( iconSize() ) );
-        xoffset = left + (padding * 2) + iconWidth;
+        xoffset = margins.left() + (padding * 2) + iconWidth;
     }
     else
-        xoffset = left + (padding * 2);
+        xoffset = margins.left() + (padding * 2);
 
-    const QRect textRect( xoffset, top, buttonWidth, buttonHeight);
+    const QRect textRect( xoffset, margins.top(), buttonWidth, buttonHeight);
     painter.drawText(textRect, Qt::AlignVCenter, text());
 }
 
--- a/src/widgets/ElidingButton.cpp
+++ b/src/widgets/ElidingButton.cpp
@@ -20,6 +20,7 @@
 #include "core/support/Debug.h"
 
 #include <QFontMetrics>
+#include <QMargins>
 
 namespace Amarok {
 
@@ -95,9 +96,8 @@ void ElidingButton::elideText( const QSi
     const int width = widgetSize.width();
     const int iconWidth = icon().isNull() ? 0 : iconSize().width();
 
-    int left, top, right, bottom;
-    getContentsMargins( &left, &top, &right, &bottom );
-    int padding = left + right + 4;
+    QMargins margins = contentsMargins();
+    int padding = margins.left() + margins.right() + 4;
     int textWidth = width - ( iconWidth + padding );
 
     QFontMetrics fm( font() );
