/////////////////////////////InfoBox.cpp///////////////////////////
#include "infobox.h"
{
int w = 640;// - height
int h = 480;// - width
this->setFixedSize(h,150);
this->setStyleSheet("background-color: black; color: white; border: 1px solid white;");
lblImage_.setFixedSize(80,100);
lblImage_.setAlignment(Qt::AlignTop);
lblTitle_.setText("Title Name");
lblImage_.setText("");
lblDuration_.setText("100 mins");
lblImage_.setStyleSheet("background-color: Blue; color: white; border-radius: 4px; border: 0px solid none;");
lblTitle_.setStyleSheet("background-color: black; color: white; border: 0px solid none;");
lblDuration_.setStyleSheet("background-color: black; color: white; border: 0px solid none;");
lytInfo_->addWidget(&lblTitle_);
lytInfo_->addWidget(&lblDuration_);
lytMain_->addWidget(&lblImage_);
lytMain_->addSpacing(5);
lytMain_->addLayout(lytInfo_);
this->setLayout(lytMain_);
}
InfoBox::~InfoBox()
{
}
////////////////////////////////////////////////////////////////////
////////////////////InfoBox.h///////////////////////////////////
#ifndef INFOBOX_H
#define INFOBOX_H
#include <QWidget>
#include <QObject>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
{
public:
explicit InfoBox
(QWidget *parent
=0);
virtual ~InfoBox();
private:
};
#endif // INFOBOX_H
/////////////////////////////////////////////////////////////////
/////////////////////InfoFlicker.cpp////////////////////////////
#include "infoflicker.h"
InfoFlicker
::InfoFlicker(QWidget *parent
){
int w = 640;// - height
int h = 480;// - width
int iPosY = 0;
for (int i = 0; i < 10 ; ++i) {
pInfoBox_= new InfoBox();
pInfoBox_->resize(h, 150);
proxy = new QGraphicsProxyWidget;
proxy->setWidget(pInfoBox_);
scene->addItem(proxy);
proxy->setPos(0, iPosY);
proxy->resize(h, 150);
iPosY += 150;
}
canvas->setScene(scene);
canvas
->setRenderHints
(QPainter::TextAntialiasing);
canvas
->setFrameShape
(QFrame::NoFrame);
canvas->setFixedHeight(w);
canvas->show();
pFlicker->show();
flick= new FlickCharm;
flick->activateOn(canvas);
}
InfoFlicker::~InfoFlicker()
{
}
////////////////////////////////////////////////////////////////
////////////////////////InfoFlicker.h/////////////////////////
#ifndef INFOFLICKER_H
#define INFOFLICKER_H
#include <QObject>
#include <QWidget>
#include <QList>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsProxyWidget>
#include <flickcharm.h>
#include <infobox.h>
{
public:
explicit InfoFlicker
(QWidget *parent
=0);
virtual ~InfoFlicker();
private:
InfoBox *pInfoBox_;
QGraphicsProxyWidget *proxy;
FlickCharm *flick;
};
#endif // INFOFLICKER_H
//////////////////////////////////////////////////////////////