How can I align The images and Text I have in the manner shown in the image provided?
-

I honestly don't know where to begin originally I did the following:
for(int i=0; i<COVDATA.COV_ComponentName.size(); i++){ //------------------------------------------------------------------------------------ x = x + 550 ; y = y + 150; // ScreenShot_path = COVDATA.COV_ComponentScreenShot[i]; // img = QImage(ScreenShot_path); // painter.drawImage(QRect(100,y,210,150),img.scaled( 800 , 800, Qt::KeepAspectRatio) ); // painter.setPen(QPen(Qt::black, 5)); // painter.setFont(OpenSans); // painter.setFont(QFont("Open Sans",10,QFont::Normal)); // painter.drawText( QRect(0,y,PageWidth-210,150), Qt::AlignRight|Qt::AlignVCenter, COVDATA.COV_ComponentName[i]); }
What this did was align the images at the far left and the text to the far right .
But the thing is I don't know what to do to make all them align like the image provided. The text is stored in a List called COVDATA.COV_ComponentName and the images in COVDATA.COV_ComponentScreenShot. I thought about checking the index as I am looping over the lists if it odd it'd be on the Left and if its even then on the Right, but how do I go on about their coordinates?
Note: These are all printed into a PDf file, like the second screenshot I have added here
-
@Kokoy Why do you draw manually?
Why don't you simply use https://doc.qt.io/qt-5/layout.html ? -
@jsulm As @J.Hilk pointed out to my Note at the very end of my post. All the stuff drawn by the QPainter class is done in the PDF. Basiclaly what the class this is in does is handle how data collected will be displayed in a PDF format in tables and other things you'd expect in a document.
So with that cleared out, any idea how to go on about what I need?