1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "newspiece.h"
- #include "ui_newspiece.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: #cfa644; 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;
- }
|