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. I need to display one box with varying size.

I need to display one box with varying size.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 493 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.
  • A Offline
    A Offline
    Ayush Gupta
    wrote on last edited by
    #1

    Hi

    I need to display one white box in QT form with varying size. Whose size would vary from 5x5 cells to 50x50 cells. The calcaulation should be done on basis of some formula.

    So by formula I will get n which will be in range of 1..10

    then I need to display the box of size = n ( 5 x5). How can i do that please help.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Did you look setFixedSize(..) method of QWidget ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      3
      • A Offline
        A Offline
        Ayush Gupta
        wrote on last edited by
        #3

        @dheerendra said in I need to display one box with varying size.:

        etFixedSi

        @dheerendra ok I will have a look. Which widget we should use in design tab of qt to achieve this?

        jsulmJ 1 Reply Last reply
        0
        • A Ayush Gupta

          @dheerendra said in I need to display one box with varying size.:

          etFixedSi

          @dheerendra ok I will have a look. Which widget we should use in design tab of qt to achieve this?

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

          @Ayush-Gupta You should explain better what you want to achieve. Where do you want to have this box? Is it some kind of drawing? Are you using QPainter?

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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Ayush Gupta
            wrote on last edited by
            #5

            @jsulm I have one QDialog box where I need to create one widget whose size i can change through code and the size of the box should be reduce / increase based on the formula I mentioned

            jsulmJ 1 Reply Last reply
            0
            • A Ayush Gupta

              @jsulm I have one QDialog box where I need to create one widget whose size i can change through code and the size of the box should be reduce / increase based on the formula I mentioned

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

              @Ayush-Gupta Well, just do not put this widget in a layout and set its size and position using https://doc.qt.io/qt-5/qwidget.html#setGeometry-1
              Or do what @dheerendra suggested.

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

              1 Reply Last reply
              2

              • Login

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