]> git.sur5r.net Git - minitube/blobdiff - src/thlibrary/thblackbar.cpp
Imported Upstream version 1.4.1
[minitube] / src / thlibrary / thblackbar.cpp
index 0043fc57c54db995ab4910d62d21915382feae3d..993f80256aff0e4966eb3a787bba737f70237819 100644 (file)
@@ -4,6 +4,7 @@
 #include <QtGui>
 
 #include "thblackbar.h"
+#include "../fontutils.h"
 
 /* ============================================================================
  *  PRIVATE Class
@@ -66,8 +67,8 @@ QSize THBlackBar::minimumSizeHint (void) const {
  *  PROTECTED Methods
  */
 void THBlackBar::paintEvent (QPaintEvent *event) {
-    int height = event->rect().height();
-    int width = event->rect().width();
+    int height = rect().height();
+    int width = rect().width();
     // int mh = (height / 2);
 
     // THPainter p(this);
@@ -147,7 +148,7 @@ void THBlackBar::mousePressEvent (QMouseEvent *event) {
 
 void THBlackBar::leaveEvent(QEvent *event) {
     // status tip
-    QMainWindow* mainWindow = static_cast<QMainWindow*>(window());
+    QMainWindow* mainWindow = dynamic_cast<QMainWindow*>(window());
     if (mainWindow) mainWindow->statusBar()->clearMessage();
 }
 
@@ -176,9 +177,7 @@ QAction *THBlackBar::hoveredAction (const QPoint& pos) const {
 }
 
 int THBlackBar::calculateButtonWidth (void) const {
-    QFont smallerBoldFont;
-    smallerBoldFont.setBold(true);
-    smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85);
+    QFont smallerBoldFont = FontUtils::smallBold();
     QFontMetrics fontMetrics(smallerBoldFont);
     int tmpItemWidth, itemWidth = 0;
     foreach (QAction *action, d->actionList) {
@@ -245,11 +244,12 @@ void THBlackBar::drawButton (     QPainter *painter,
 
     painter->fillRect(0, 0, width, mh, QBrush(gradient));
     painter->fillRect(0, mh, width, mh, color);
+#if defined(APP_MAC) | defined(APP_WIN)
+    painter->drawRect(-1, -1, width+1, height);
+#else
     painter->drawRect(0, 0, width, height);
-
-    QFont smallerBoldFont;
-    smallerBoldFont.setBold(true);
-    smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85);
+#endif
+    QFont smallerBoldFont = FontUtils::smallBold();
     painter->setFont(smallerBoldFont);
     painter->setPen(QPen(QColor(0xff, 0xff, 0xff), 1));
     painter->drawText(0, 1, width, height, Qt::AlignCenter, action->text());