Mercurial > hg > easaier-soundaccess
view widgets/QueryResultsWidget.cpp @ 7:a5175615d153
add easaier tab widgets, style and pass the layer characteristics in the main window (remove from panestack)
author | lbajardsilogic |
---|---|
date | Fri, 11 May 2007 14:11:19 +0000 |
parents | |
children | 5060939ca69d |
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* Sound Access EASAIER client application. Silogic 2007. Laure Bajard. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #include "QueryResultsWidget.h" #include <QScrollArea> #include <QLabel> #include <iostream> #include "sv/main/MainWindow.h" QueryResultsWidget::QueryResultsWidget() : QWidget(), m_ndResults(0) { m_resultsLayout = new QGridLayout; QWidget *resultsWidget = new QWidget; resultsWidget->setLayout(m_resultsLayout); QScrollArea * scrollArea = new QScrollArea; scrollArea->setWidget(resultsWidget); scrollArea->setWidgetResizable(true); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(scrollArea); setLayout(mainLayout); } QueryResultsWidget::~QueryResultsWidget() {} void QueryResultsWidget::reset() { m_ndResults = 0; QLayoutItem *child; while ((child = m_resultsLayout->takeAt(0)) != 0) { delete child->widget(); } } void QueryResultsWidget::newResult() { m_curResult.clear(); } void QueryResultsWidget::addInfo(const QString& name, const QString& value) { Info info; info.name = name; info.value = value; m_curResult.push_back(info); } void QueryResultsWidget::displayResult() { std::vector<Info>::iterator iter; QLabel* result = new QLabel(); QString text; for (iter = m_curResult.begin(); iter != m_curResult.end(); iter++) { text += "<br>" ; text += (*iter).name; text += " : " ; if (((*iter).value.left(4) == "http") && ((*iter).value.right(4) == ".xml")) { text += "<a href=\""; text += (*iter).value; text += "\">"; text += (*iter).value; text += "</a>"; } else { text += (*iter).value; } text += "</br>" ; } connect(result, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierFile(QString))); result->setText(text); m_resultsLayout->addWidget(result,m_ndResults,0); m_ndResults++; }