UASQuickViewGaugeItem.cc 716 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "UASQuickViewGaugeItem.h"
#include <QVBoxLayout>
UASQuickViewGaugeItem::UASQuickViewGaugeItem(QWidget *parent) : UASQuickViewItem(parent)
{
    
}
void UASQuickViewGaugeItem::setValue(double value)
{
    valueLabel->setText(QString::number(value,'f',4));
}

void UASQuickViewGaugeItem::setTitle(QString title)
{
    titleLabel->setText(title);
}
void UASQuickViewGaugeItem::resizeEvent(QResizeEvent *event)
{
18 19
    Q_UNUSED(event);
    
20 21 22 23 24 25 26 27
    QFont valuefont = valueLabel->font();
    QFont titlefont = titleLabel->font();
    valuefont.setPixelSize(this->height() / 2.0);
    titlefont.setPixelSize(this->height() / 4.0);
    valueLabel->setFont(valuefont);
    titleLabel->setFont(titlefont);
    update();
}