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. Layout problem
Forum Update on Monday, May 27th 2025

Layout problem

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 297 Views
  • 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.
  • M Offline
    M Offline
    MAX001
    wrote on 5 Jan 2023, 17:57 last edited by
    #1

    How can I best make this layout ? Using grid. And make all images with the same size and aspect ratio. If they have a different aspect ratio, then maybe a little crop, but also the same size, and when you increase or decrease the window, they automatically become larger or smaller for adaptive layout.
    7a82994c-16a4-441f-a526-269242eeeb46-image.png
    And there is another problem because of the pictures, my window is larger than the computer window, what could be the problem? Looks like that
    092dfa23-a3bd-474c-98d8-6b27e48f5365-image.png

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 5 Jan 2023, 19:27 last edited by
      #2

      Hi,

      How are you doing it currently ?

      One way is to paint the image on the widget yourself so you can manage the aspect ratio and paint them the way you want.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 5 Jan 2023, 20:10
      0
      • S SGaist
        5 Jan 2023, 19:27

        Hi,

        How are you doing it currently ?

        One way is to paint the image on the widget yourself so you can manage the aspect ratio and paint them the way you want.

        M Offline
        M Offline
        MAX001
        wrote on 5 Jan 2023, 20:10 last edited by
        #3

        @SGaist I spent all day on that layout and nothing good came of it 🥹😰😩
        You mean like create that images in QWidget and set QHBoxLayout not in GridLayout?
        If you can check files i will be so thankful 🙏
        Project Code

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 5 Jan 2023, 20:18 last edited by
          #4

          I haven't said anything about layouts.

          I am suggesting to subclass QWidget and reimplement the paint event. You might also want to consider reimplementing the resize event so you can ensure you have the image of the correct size to paint. Keep the original image as member variable so you can use a resized version of it for the painting.

          Since you have at least three times the same widget, you should create a custom class that implements it and reuse it.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply 5 Jan 2023, 20:27
          1
          • S SGaist
            5 Jan 2023, 20:18

            I haven't said anything about layouts.

            I am suggesting to subclass QWidget and reimplement the paint event. You might also want to consider reimplementing the resize event so you can ensure you have the image of the correct size to paint. Keep the original image as member variable so you can use a resized version of it for the painting.

            Since you have at least three times the same widget, you should create a custom class that implements it and reuse it.

            M Offline
            M Offline
            MAX001
            wrote on 5 Jan 2023, 20:27 last edited by
            #5

            @SGaist Hard to understand, but ok I'll try to understand Thanks.

            1 Reply Last reply
            0

            1/5

            5 Jan 2023, 17:57

            • Login

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