Hi all!
When I start on my computer (WinXP x32 with Qt 5.1/QtCreator 2.7.2) the binary with appropriate dll’s, I see those pictures:
But when I start the same on the Win7 ×64 I see no splash, no score board…
For information: android build works as expected.
The actual code in methods of QGraphicsView inherited class:
void MainWidget::drawBackground(QPainter *painter, const QRectF& rect) {
scene->setSceneRect(20, 20, geometry().width() - 20, geometry().height() - 20);
QRectF scene_rect = scene->sceneRect();
if (splash) {
splash->setPos(scene_rect.left() + scene_rect.width()/2 - splash->pixmap().width()/2,
scene_rect.top() + scene_rect.height()/2 - splash->pixmap().height()/2);
return;
} else
setCacheMode(CacheBackground);
QRectF right_shadow(scene_rect.right(), scene_rect.top() + 5, 5, scene_rect.height());
QRectF bottom_shadow(scene_rect.left() + 5, scene_rect.bottom(), scene_rect.width(), 5);
if (right_shadow.intersects(rect) || right_shadow.contains(rect))
painter->fillRect(right_shadow, Qt::darkGray);
if (bottom_shadow.intersects(rect) || bottom_shadow.contains(rect))
painter->fillRect(bottom_shadow, Qt::darkGray);
QLinearGradient gradient(scene_rect.topLeft(), scene_rect.bottomRight());
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::lightGray);
painter->fillRect(scene_rect, gradient);
painter->setBrush(Qt::NoBrush);
painter->drawRect(scene_rect);
}
void MainWidget::createGameScene() {
scene->addItem(score = new QGraphicsPixmapItem(QPixmap(":/images/DiscoveryScore.jpg")));
score->setPos(scene->sceneRect().left(), scene->sceneRect().top());
scene->addItem(redMeeple = new QGraphicsPixmapItem(QPixmap(":/images/DiscoveryRedMeeple.png")));
redMeeple->setPos(scene->sceneRect().left() + 5,
scene->sceneRect().top() + score->boundingRect().height() - redMeeple->boundingRect().height());
scene->addItem(blueMeeple = new QGraphicsPixmapItem(QPixmap(":/images/DiscoveryBlueMeeple.png")));
blueMeeple->setPos(scene->sceneRect().left() + 35,
scene->sceneRect().top() + score->boundingRect().height() - blueMeeple->boundingRect().height());
TileItem * starter = new TileItem(this);
starter->setTileNumber(0, true);
starter->setI(84); starter->setJ(84); starter->setPut();
starter->setFlag(QGraphicsItem::ItemIsMovable, false);
starter->setPos(scene->sceneRect().left() + scene->sceneRect().width()/2 - starter->pixmap().width()/2,
scene->sceneRect().top() + scene->sceneRect().height()/2 - starter->pixmap().height()/2);
scene->addItem(starter);
tilesMap[84][84] = starter;
for (qint8 i = 1; i < 84; ++i)
restTiles << i;
TileItem * first_tile = new TileItem(this);
first_tile->setTileNumber(qrand() % 83 + 1);
first_tile->setPos(score->boundingRect().width() + scene->sceneRect().left() - first_tile->boundingRect().width(),
score->boundingRect().height() + scene->sceneRect().top());
scene->addItem(first_tile);
}
Maybe I’m incorrect in usage of QGraphicsView/QGraphicsScene? But why it works on XP and android? I’m not sure, but I’m going to explain the behavior with abscense of Qt x64 dll’s in package. Can I get it separatly to try?
Thanks in advance, Andrey
↧