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 to easilly add a second 'skin' to my app
Forum Updated to NodeBB v4.3 + New Features

How to easilly add a second 'skin' to my app

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 2 Posters 3.7k 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.
  • P Panoss

    How do I set the size of my ui (of my form)? (in a slot)
    It's a QWidget, with minimumSize and maximumSize set from within the Qt Designer.

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #4

    @Panoss
    you can use setGeometry or resize.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Panoss
      wrote on last edited by Panoss
      #5

      I mean how do I access the form?
      I tried:

      this->resize(500,600);
      
      RepairDevices::resize(500,600);
      
      ui.RepairDevices->resize(500,600);
      

      The first two compile, but don't change the size of the window.
      The third, does not compile.

      This is from Designer:
      alt text

      mrjjM 1 Reply Last reply
      0
      • P Panoss

        I mean how do I access the form?
        I tried:

        this->resize(500,600);
        
        RepairDevices::resize(500,600);
        
        ui.RepairDevices->resize(500,600);
        

        The first two compile, but don't change the size of the window.
        The third, does not compile.

        This is from Designer:
        alt text

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #6

        Hi
        What ever RepairDevices is inside of, is the form.
        MainWindow most likely
        so that would be

        ui->RepairDevices->resize

        unless in a layout of course.

        The form is the Mainwindow. RepairDevices is not the form. ( it seems not)

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Panoss
          wrote on last edited by Panoss
          #7

          Only this works, everything else fails:

          this->setFixedSize(500, 600);
          

          But the widgets on the form became black after resize!!
          I guess it needs something like this->refresh.
          Is there something like that?

          mrjjM 1 Reply Last reply
          0
          • P Panoss

            Only this works, everything else fails:

            this->setFixedSize(500, 600);
            

            But the widgets on the form became black after resize!!
            I guess it needs something like this->refresh.
            Is there something like that?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #8

            @Panoss
            ok but what are you trying ?
            this->setGeometry(0,0,500,500);
            (in mainwindow)
            surely works.

            No, you do not need refresh()
            They should redraw by themself.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Panoss
              wrote on last edited by
              #9

              The "this->setGeometry(0,0,500,500);" only moves it on the top left corner. Doesn't resize.
              Maybe because I have minmumSize and maximumSize set in the Designer.

              They don't redraw by themself.

              mrjjM 1 Reply Last reply
              0
              • P Panoss

                The "this->setGeometry(0,0,500,500);" only moves it on the top left corner. Doesn't resize.
                Maybe because I have minmumSize and maximumSize set in the Designer.

                They don't redraw by themself.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #10

                @Panoss

                Well if u set fixed size, that is 100% what you get. :)

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  Panoss
                  wrote on last edited by
                  #11

                  Also works this:

                  this->setMinimumSize(500,600);
                  this->setMaximumSize(500,600);
                  

                  But the widgets also don't refresh.
                  Is there some way to force them redraw?

                  mrjjM 1 Reply Last reply
                  0
                  • P Panoss

                    Also works this:

                    this->setMinimumSize(500,600);
                    this->setMaximumSize(500,600);
                    

                    But the widgets also don't refresh.
                    Is there some way to force them redraw?

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    @Panoss

                    Its never, ever need to ask them to refresh when resizing the form.
                    Something else is wrong.

                    Did you use layouts at all ? so resize mainwindow will resize the widgets?

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Panoss
                      wrote on last edited by
                      #13

                      No I don't use any layouts at all.

                      mrjjM 1 Reply Last reply
                      0
                      • P Panoss

                        No I don't use any layouts at all.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by mrjj
                        #14

                        @Panoss
                        well then resizing the main form will do absolutely nothing to the
                        widgets in the form. should remain same place and not move/resize at all.

                        If they go black, i wonder if you tried to resize some yourself from a resize event or something like that.
                        it can lead to infinite loops :)

                        Else I am out of idea why they go black.

                        The right way is to use layouts.
                        http://doc.qt.io/qt-5/designer-layouts.html

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          Panoss
                          wrote on last edited by
                          #15

                          I didn't resize any widget, only the form.
                          The reason I didn't use layouts is because they looked to me very complicated.
                          I 'll give it a try.

                          mrjjM 1 Reply Last reply
                          0
                          • P Panoss

                            I didn't resize any widget, only the form.
                            The reason I didn't use layouts is because they looked to me very complicated.
                            I 'll give it a try.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by mrjj
                            #16

                            @Panoss
                            well if you want the widget to become bigger or smaller depending on the size of the window
                            then you must use layouts.
                            Else they wont.

                            So it depends on what your goal is.

                            Yes using layouts takes some practice but the rewards are great.

                            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