123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "newspiece.h"
- #include "ui_newspiece.h"
- #include "constants.h"
- #include <QDebug>
- NewsPiece::NewsPiece(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::NewsPiece)
- {
- ui->setupUi(this);
- }
- void NewsPiece::setTitle(const QString &title, const QString &url)
- {
- _title = title;
- _url = url;
- ui->news_title->setText("<a style=\"color: #ffaa5e; text-decoration:none;\" href = '" + QString(url).remove("\n") + "'>" + QString(title).remove("\n") + "</a>");
- resize(sizeHint());
- }
- void NewsPiece::setDate(const QString &date)
- {
- ui->news_date->setText(QString(date).remove("\n"));
- resize(sizeHint());
- }
- QString NewsPiece::getTitle()
- {
- return _title;
- }
- QString NewsPiece::getUrl()
- {
- return _url;
- }
- QString NewsPiece::getDate()
- {
- return ui->news_date->text();
- }
- NewsPiece::~NewsPiece()
- {
- delete ui;
- }
- void NewsPiece::updateFontsSizes()
- {
- ui->news_title->setFont(trajan_8pt);
- ui->news_date->setFont(trajan_7pt);
- }
- void NewsPiece::resizeEvent(QResizeEvent *event)
- {
- updateFontsSizes();
- }
|