2D array into graphicview to create Objects from 2D-Array
-
QPixmap outPixmap = QPixmap(xarrSize,yarrSize); outPixmap.loadFromData(grid); // Bild-Datei anzeigen ui->label->setPixmap(outPixmap); ui->label->show();
but doesn't know the loadFromData..
i will try more@projectbavaria said in 2D array into graphicview to create Objects from 2D-Array:
outPixmap.loadFromData(grid);
but doesn't know the loadFromData..What type is
grid
? If it's yourchar grid[xarrSize][yarrSize]
then your call does not correspond to either overload https://doc.qt.io/qt-5/qpixmap.html#loadFromData or https://doc.qt.io/qt-5/qpixmap.html#loadFromData-1. -
@projectbavaria said in 2D array into graphicview to create Objects from 2D-Array:
outPixmap.loadFromData(grid);
but doesn't know the loadFromData..What type is
grid
? If it's yourchar grid[xarrSize][yarrSize]
then your call does not correspond to either overload https://doc.qt.io/qt-5/qpixmap.html#loadFromData or https://doc.qt.io/qt-5/qpixmap.html#loadFromData-1.@JonB it is a 2D Array -> array Char [x][y]
yeah i will look on your link -
can't go on i will look From Matrix to QImage and QPixmap on forum.. maybe that will help
-
Hi,
Do you mean you have a two dimensional array of chars that you want to build a grid with and that each of the cell of that grid shall contain the letter at that point of the array ?
-
Hi,
Do you mean you have a two dimensional array of chars that you want to build a grid with and that each of the cell of that grid shall contain the letter at that point of the array ?
This post is deleted! -
This post is deleted!
This post is deleted! -
This post is deleted!
@projectbavaria 
-

now i getting a black screen and try to go on
-
From what you posted, there's nothing added to the scene and your view seems to be a local variable so unless it's in your main function body, it will be destroyed before you can even see it.
-
From what you posted, there's nothing added to the scene and your view seems to be a local variable so unless it's in your main function body, it will be destroyed before you can even see it.
@SGaist but before i destroying it i have to handle that i want to save my array(inside there are my chars) as a QtPiximap -> after that i can show it in GraphisScene ?
-
Except that you are not using your array to draw anything. You are using a QBitArray which contains nothing to draw on a image that you then use as brush.
You should start by just drawing on that QImage properly and set it on a QLabel to see what it would look like. And once you have that working, come back to your QGraphicsView part.
-
Except that you are not using your array to draw anything. You are using a QBitArray which contains nothing to draw on a image that you then use as brush.
You should start by just drawing on that QImage properly and set it on a QLabel to see what it would look like. And once you have that working, come back to your QGraphicsView part.
@SGaist okey i will try