Add simple instructions to overlay config

This commit is contained in:
Thorvald Natvig 2010-03-08 14:39:09 +01:00
parent 9c5086c7ca
commit e5e7797c3d
2 changed files with 22 additions and 0 deletions

View File

@ -59,6 +59,16 @@ OverlayConfig::OverlayConfig(Settings &st) : ConfigWidget(st) {
qgpiScreen->setPixmap(qpScreen);
qgpiScreen->setOpacity(0.5f);
qgpiScreen->setZValue(-10.0f);
qgtiInstructions = new QGraphicsTextItem();
qgtiInstructions->setHtml(QString::fromLatin1("<ul><li>%1</li><li>%2</li><li>%3</li></ul>").arg(
tr("To move the users, drag the little red dot."),
tr("To resize the users, mousewheel over a user."),
tr("For more options, rightclick a user.")
));
qgtiInstructions->setOpacity(1.0f);
qgtiInstructions->setZValue(-5.0f);
qgtiInstructions->setDefaultTextColor(Qt::white);
qgs.setSceneRect(QRectF(0, 0, qgpiScreen->pixmap().width(), qgpiScreen->pixmap().height()));
@ -71,6 +81,9 @@ OverlayConfig::OverlayConfig(Settings &st) : ConfigWidget(st) {
qgs.addItem(oug);
oug->show();
qgs.addItem(qgtiInstructions);
qgtiInstructions->show();
qgvView->setScene(&qgs);
qgvView->installEventFilter(this);
@ -146,6 +159,14 @@ void OverlayConfig::resizeScene() {
qgpiScreen->setPixmap(qpScreen.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation));
qgs.setSceneRect(QRectF(0, 0, qgpiScreen->pixmap().width(), qgpiScreen->pixmap().height()));
QFont f = qgtiInstructions->font();
f.setPointSizeF(qgs.sceneRect().height() / 20.0f);
qgtiInstructions->setFont(f);
qgtiInstructions->setPos(qgs.sceneRect().width() / 5.0f, qgs.sceneRect().height() / 5.0f);
qgtiInstructions->setTextWidth(qgs.sceneRect().width() * 6.0f / 10.0f);
qgvView->fitInView(qgs.sceneRect(), Qt::KeepAspectRatio);
oug->updateLayout();
oug->updateUsers();

View File

@ -228,6 +228,7 @@ class OverlayConfig : public ConfigWidget, public Ui::OverlayConfig {
QGraphicsPixmapItem *qgpiScreen;
QGraphicsScene qgs;
OverlayUserGroup *oug;
QGraphicsTextItem *qgtiInstructions;
bool eventFilter(QObject *, QEvent *);
protected slots: