Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I align The images and Text I have in the manner shown in the image provided?

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 552 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kokoy
    wrote on last edited by Kokoy
    #1

    ![alt text](d6c0319e-a49c-4420-baab-5879fd811831-image.png image url)

    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 .
    alt text

    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

    jsulmJ 1 Reply Last reply
    0
    • K Kokoy

      ![alt text](d6c0319e-a49c-4420-baab-5879fd811831-image.png image url)

      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 .
      alt text

      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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Kokoy Why do you draw manually?
      Why don't you simply use https://doc.qt.io/qt-5/layout.html ?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J.HilkJ K 2 Replies Last reply
      0
      • jsulmJ jsulm

        @Kokoy Why do you draw manually?
        Why don't you simply use https://doc.qt.io/qt-5/layout.html ?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @jsulm the painter is on a PDF file, not a Qt-GUI

        Note: These are all printed into a PDf file, like the second screenshot I have added here


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        1
        • jsulmJ jsulm

          @Kokoy Why do you draw manually?
          Why don't you simply use https://doc.qt.io/qt-5/layout.html ?

          K Offline
          K Offline
          Kokoy
          wrote on last edited by
          #4

          @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?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved