Burning Bridges
Enviado de meu SM-G3502T usando Tapatalk
No. Not a game, and as I wrote we have drawings up to 100,000 polylines. Also it is supposed to run on Android, or at least tablet PCs. GDI would be completely a dead end.
void Helper::paint(QPainter *painter, QPaintEvent *event, int elapsed)
{
//..
painter->fillRect(event->rect(), background);
//..
painter->setBrush(circleBrush);
painter->setPen(circlePen);
//..
QPolygon polygon;
polygon.setPoints(4, 50, 50,
100, 50,
100, 100,
50, 100);
painter->drawPolygon(polygon);
//..
QPolygon polyline;
polyline.setPoints(3, 150, 50,
200, 100,
250, 100);
painter->drawPolyline(polyline);
//..
painter->drawPoint(75,175);
//
painter->drawLine(175,150,175,200);
painter->drawLine(150,175,200,175);
//..
QImage image;
image.load("C:\\joda.jpg");
painter->drawImage(200,200,image);
//..
painter->setPen(textPen);
painter->setFont(textFont);
//..
painter->drawText(50,75,"Polygon");
painter->drawText(200,100,"Polylinie");
painter->drawText(75,200,"Punkt");
painter->drawText(175,175,"Punkt als Symbol");
painter->drawText(200,357,"joda.jpg");
}
class SomeClass:public QWidget
{
protected:
void paintEvent ( QPaintEvent * event );
void wheelEvent ( QWheelEvent * event );
private:
qreal scale;
qreal step;
};
void SomeClass::paintEvent ( QPaintEvent * event )
{
QPainter p;
p.scale(scale,scale);
}
void YourClass::wheelEvent ( QWheelEvent * event )
{
scale+=(event->delta()/step);
}
void View::setupMatrix()
{
QMatrix matrix;
matrix.scale(zoomSlider->value(),zoomSlider->value());
matrix.rotate(rotateSlider->value());
matrix.translate(translateSliderX->value(), translateSliderY->value());
graphicsView->setMatrix(matrix);
}
No. Not a game, and as I wrote we have drawings up to 100,000 polylines.
...
QPolygon polygon;
polygon.setPoints(4, 50, 50,
100, 50,
100, 100,
50, 100);
painter->drawPolygon(polygon);
...
..I just hope they dont use instanced rendering for unrealistic performance gains..
QGraphicsScene *scene;
..
for (int i = -11000; i < 11000; i += 110) {
++xx;
int yy = 0;
for (int j = -7000; j < 7000; j += 70) {
++yy;
qreal x = (i + 11000) / 22000.0;
qreal y = (j + 7000) / 14000.0;
QColor color(image.pixel(int(image.width() * x), int(image.height() * y)));
QGraphicsItem *item = new Chip(color, xx, yy);
item->setPos(QPointF(i, j));
scene->addItem(item);
++nitems;
}
}
Code:... QPolygon polygon; polygon.setPoints(4, 50, 50, 100, 50, 100, 100, 50, 100); painter->drawPolygon(polygon); ...
void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QPointF point;
if (event->button() == Qt::LeftButton){
point = event->scenePos();
..
I got some of those even when I had the files in the right place. Sometimes I have to delete the build files (temporary on the build folder it creates) so it starts anew with a new makefile.
Sometimes the version is not right one when I had multiple qt versions installed. You probably know this but you have to copy some folders from the plugin folder in the qt installation directory.
Platforms is one folder that you find in the plugin one. So you copy it to where the exe is, along with the necessary dlls and also some folders from the qml dir.
So you have to get files and folders from these guys here from you qt install dir.