metainfobox.cpp
Go to the documentation of this file.
00001 #include "metainfobox.h"
00002 
00003 #include <QLabel>
00004 #include <QGridLayout>
00005 #include <QLabel>
00006 #include <QDebug>
00007 
00008 MetaInfoBox::MetaInfoBox(QWidget *parent)
00009     : QGroupBox(parent)
00010     , m_layout(new QGridLayout)
00011 {
00012     setLayout(m_layout);
00013 }
00014 
00015 QString boldText(QString text)
00016 {
00017     return QString("<b>") + text + QString("</b>");
00018 }
00019 
00020 void MetaInfoBox::setMetaInfos(QVector<QStringPair> metaInfos)
00021 {
00022     if (m_metaInfos == metaInfos)
00023         return;
00024 
00025     m_metaInfos = metaInfos;
00026 
00027     qDeleteAll(m_labels);
00028     m_labels.clear();
00029 
00030     foreach (QStringPair metaInfo, metaInfos)
00031     {
00032         QLabel* keyLabel = new QLabel(boldText(metaInfo.first));
00033         QLabel* valueLabel = new QLabel(metaInfo.second);
00034         valueLabel->setWordWrap(true);
00035         // Number of meta infos we've got so far
00036         int metaInfoCount = m_labels.size() / 2;
00037         m_layout->addWidget(keyLabel, metaInfoCount, 0);
00038         m_layout->addWidget(valueLabel, metaInfoCount, 1);
00039         m_labels.append(keyLabel);
00040         m_labels.append(valueLabel);
00041     }
00042 }
00043 
00044 void MetaInfoBox::clear()
00045 {
00046 }
00047 
00048 MetaInfoBox::~MetaInfoBox()
00049 {
00050     clear();
00051 }


hector_nist_arena_designer
Author(s): Stefan Kohlbrecher , Johannes Simon
autogenerated on Wed Oct 4 2017 03:29:29