From ededa7e3ef24a8cea9e513fa008ef481c1675457 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Fri, 30 Aug 2019 11:43:58 -0400 Subject: Initial check in Initial check in of the original repository: git://github.com/AGLExport/genivi-navi-yelp-client.git as of commit c2691cb265d9198542482a860f1df378e8c2708b. Bug-AGL: SPEC-2787 Signed-off-by: Scott Murray Change-Id: I7405367387622fb788a5712ed24005ee6d7ce495 --- InfoPanelLabel.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 InfoPanelLabel.cpp (limited to 'InfoPanelLabel.cpp') diff --git a/InfoPanelLabel.cpp b/InfoPanelLabel.cpp new file mode 100644 index 0000000..c87e7e5 --- /dev/null +++ b/InfoPanelLabel.cpp @@ -0,0 +1,25 @@ +#include "InfoPanelLabel.h" + +InfoPanelLabel::InfoPanelLabel(QWidget *parent, QRect &r):QLabel(parent),rect(r) +{ +} + +void InfoPanelLabel::Init(int pos, int height, const QString &text, QFont *font) +{ + if (text.length() > 0) + { + setText(text); + if (font) + setFont(*font); + } + setStyleSheet("QLabel { background-color : white; color : #FFFFFF; }"); + setGeometry(QRect(rect.x(), rect.y()+pos, rect.width(), height)); + + /* if text is too big, align left so that we can at least read the beginning : */ + if (this->text().length() > 0 && this->fontMetrics().width(this->text()) >= rect.width()) + setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + else + setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + + setVisible(true); +} -- cgit 1.2.3-korg