#include <QtGui>
#include "dialog.h"
Dialog::Dialog()
{
setWindowTitle(tr("Basic Layouts"));
scene->addPixmap(*pic);
view->setScene(scene);
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
view
->setRenderHints
(QPainter::Antialiasing|QPainter
::SmoothPixmapTransform);
d->setPos(400,30);
d = scene->addPixmap(*p);
d->setPos(80,220);
d = scene->addPixmap(*p);
d->setPos(60,30);
d = scene->addPixmap(*p);
d->setPos(20,120);
d = scene->addPixmap(*p);
d->setPos(460,120);
p
= new QPixmap("other_cards.png");
d = scene->addPixmap(*p);
d->setPos(120,50);
d = scene->addPixmap(*p);
d->setPos(80,130);
d = scene->addPixmap(*p);
d->setPos(120,200);
d = scene->addPixmap(*p);
d->setPos(440,120);
d = scene->addPixmap(*p);
d->setPos(540,330);
d = scene->addPixmap(*p);
d->setPos(600,330);
setCentralWidget(view);
show();
}
{
}
{
if (event->key() == Qt::Key_Equal)
view->scale(1.1, 1.1);
else if (event->key() == Qt::Key_Minus)
view->scale(0.9, 0.9);
}
#include <QtGui>
#include "dialog.h"
Dialog::Dialog()
{
setWindowTitle(tr("Basic Layouts"));
QGraphicsScene *scene = new QGraphicsScene(this);
QPixmap *pic = new QPixmap("table.png");
scene->addPixmap(*pic);
view = new QGraphicsView();
view->setScene(scene);
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
view->setAlignment(Qt::AlignLeft|Qt::AlignTop);
view->setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
QPixmap *p = new QPixmap("seat_empty.png");
QGraphicsPixmapItem *d = scene->addPixmap(*p);
d->setPos(400,30);
d = scene->addPixmap(*p);
d->setPos(80,220);
d = scene->addPixmap(*p);
d->setPos(60,30);
d = scene->addPixmap(*p);
d->setPos(20,120);
d = scene->addPixmap(*p);
d->setPos(460,120);
p = new QPixmap("other_cards.png");
d = scene->addPixmap(*p);
d->setPos(120,50);
d = scene->addPixmap(*p);
d->setPos(80,130);
d = scene->addPixmap(*p);
d->setPos(120,200);
d = scene->addPixmap(*p);
d->setPos(440,120);
p = new QPixmap("6.png");
d = scene->addPixmap(*p);
d->setPos(540,330);
p = new QPixmap("50.png");
d = scene->addPixmap(*p);
d->setPos(600,330);
setCentralWidget(view);
show();
}
void Dialog::resizeEvent(QResizeEvent* event)
{
}
void Dialog::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Equal)
view->scale(1.1, 1.1);
else if (event->key() == Qt::Key_Minus)
view->scale(0.9, 0.9);
}
To copy to clipboard, switch view to plain text mode
Bookmarks