summaryrefslogtreecommitdiffstats
path: root/src/widget/wlabel.cpp
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2013-12-24 12:22:33 -0500
committerRJ Ryan <rryan@mixxx.org>2013-12-24 12:22:33 -0500
commit8031720dbcdae5839e1c70d1e85df85539003c0f (patch)
treecbd95afff661c251537929a665916896bc456dee /src/widget/wlabel.cpp
parentcdbe4e0f1ff2ab7a017195264ce27ede4d6fdf87 (diff)
Refactor WNumber to inherit from WLabel since they had almost identical code.
Diffstat (limited to 'src/widget/wlabel.cpp')
-rw-r--r--src/widget/wlabel.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/widget/wlabel.cpp b/src/widget/wlabel.cpp
index 147b77e3cb..5926ac81c6 100644
--- a/src/widget/wlabel.cpp
+++ b/src/widget/wlabel.cpp
@@ -15,27 +15,28 @@
* *
***************************************************************************/
+#include "widget/wlabel.h"
+
+#include <QFont>
#include <QVBoxLayout>
-#include "widget/wlabel.h"
#include "widget/wskincolor.h"
-WLabel::WLabel(QWidget * parent) : WWidget(parent)
-{
- m_pLabel = new QLabel(this);
+WLabel::WLabel(QWidget* pParent)
+ : WWidget(pParent),
+ m_pLabel(new QLabel(this)),
+ m_qsText("") {
QLayout* pLayout = new QVBoxLayout(this);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->addWidget(m_pLabel);
setLayout(pLayout);
- m_qsText = "";
}
WLabel::~WLabel() {
delete m_pLabel;
}
-void WLabel::setup(QDomNode node)
-{
+void WLabel::setup(QDomNode node) {
// Colors
QPalette palette = m_pLabel->palette(); //we have to copy out the palette to edit it since it's const (probably for threadsafety)
if (!WWidget::selectNode(node, "BgColor").isNull()) {
@@ -52,13 +53,19 @@ void WLabel::setup(QDomNode node)
m_qsText = selectNodeQString(node, "Text");
m_pLabel->setText(m_qsText);
+ // Font size
+ if (!selectNode(node, "FontSize").isNull()) {
+ int fontsize = 9;
+ fontsize = selectNodeQString(node, "FontSize").toInt();
+ m_pLabel->setFont( QFont("Helvetica",fontsize,QFont::Normal) );
+ }
+
// Alignment
if (!selectNode(node, "Alignment").isNull()) {
- if (selectNodeQString(node, "Alignment")=="right")
+ if (selectNodeQString(node, "Alignment")=="right") {
m_pLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
- // FWI: Begin of font alignment patch
- else if (selectNodeQString(node, "Alignment")=="center")
+ } else if (selectNodeQString(node, "Alignment")=="center") {
m_pLabel->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
- // FWI: End of font alignment patch
+ }
}
}