// myScene.h
#include <QSound>
#include <QGraphicsScene>
{
Q_OBJECT
public:
private slots:
void start();
};
//myScene.cpp
{
setBackgroundBrush
(QPixmap(":/data/bg.png"));
//stLabel3->setHtml(trUtf8("smth"));
stLabel3->setPos(275,260);
stLabel3
->setDefaultTextColor
(QColor(0,
43,
0,
127));
stLabel3
->setFont
(QFont("Comic Sans MS",
24,
QFont::Bold,
QFont::StyleItalic));
stLabel3->adjustSize();
stLabel3->setZValue(1);
QTransform transform = stLabel3->transform();
transform.rotate(80.0, Qt::YAxis);
transform.scale(2., 1.5);
stLabel3->setTransform(transform);
stLabel3->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
connect(stLabel3,SIGNAL(linkActivated(const QString&)),this,SLOT(start()));
menuSound
= new QSound("data/sound/menu.wav");
cSound
= new QSound("data/sound/mus_w1.wav");
menuSound->play();
}
void myScene::start()
{
menuSound->stop();
cSound->play();
}
// myScene.h
#include <QSound>
#include <QGraphicsScene>
class myScene : public QGraphicsScene
{
Q_OBJECT
public:
móScene(QObject *parent = 0);
QSound *menuSound,*cSound;
private slots:
void start();
};
//myScene.cpp
myScene::myScene(QObject *parent) : QGraphicsScene(parent)
{
QPalette p;
setBackgroundBrush(QPixmap(":/data/bg.png"));
QGraphicsTextItem* stLabel3 = addText(trUtf8("smth"));
//stLabel3->setHtml(trUtf8("smth"));
stLabel3->setFlag(QGraphicsItem::ItemIsMovable);
stLabel3->setPos(275,260);
stLabel3->setDefaultTextColor(QColor(0,43,0,127));
stLabel3->setFont(QFont("Comic Sans MS", 24, QFont::Bold,QFont::StyleItalic));
stLabel3->adjustSize();
stLabel3->setZValue(1);
QTransform transform = stLabel3->transform();
transform.rotate(80.0, Qt::YAxis);
transform.scale(2., 1.5);
stLabel3->setTransform(transform);
stLabel3->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
connect(stLabel3,SIGNAL(linkActivated(const QString&)),this,SLOT(start()));
menuSound = new QSound("data/sound/menu.wav");
cSound = new QSound("data/sound/mus_w1.wav");
menuSound->play();
}
void myScene::start()
{
menuSound->stop();
cSound->play();
}
To copy to clipboard, switch view to plain text mode
Bookmarks