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. UI loaded with QUILoader, cannot stretch properly and clears when pressing escape

UI loaded with QUILoader, cannot stretch properly and clears when pressing escape

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 1.6k 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.
  • E Offline
    E Offline
    ESP123
    wrote on last edited by
    #1

    We are using QT 5.6, and using QUILoader to load ui files at runtime, from within qt resource files ... this all works great and there is no issue loading the ui or operation, connecting buttons and getting field values, etc ... what i do i create a top level QDialog, grab its layout, and add the loaded widget to the layout .. the issue is that (1) i want all the children to stretch nicely as the top level dialog is scaled, (how can i tell the top level all should stretch horizonally for example?) and (2) when i press escape the contents of my top level dialog are cleared, so the entire ui loaded from xml dissapears ... no idea why ... any help appreciated

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

      Two things based on your description.

      1. Did you add the stretch factor for UILoaded widget when adding into layout ?
      2. Have you set the stretch factor for widgets present in the UILoaded widget ?
      3. When you are clearing the dialog, what is the code you ? Are you deleting the top level widget ? I suspect so. When you delete the widgets all the children are also deleted.

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

      E 1 Reply Last reply
      1
      • dheerendraD dheerendra

        Two things based on your description.

        1. Did you add the stretch factor for UILoaded widget when adding into layout ?
        2. Have you set the stretch factor for widgets present in the UILoaded widget ?
        3. When you are clearing the dialog, what is the code you ? Are you deleting the top level widget ? I suspect so. When you delete the widgets all the children are also deleted.
        E Offline
        E Offline
        ESP123
        wrote on last edited by
        #3

        @dheerendra

        1. i tried all sort of combinations of setting stretch factor, none seemed to work .. what is the recommended way? do i need to set on all objects?
        2. no i did not but i did try programmatically
        3. this happens automatically somehow, this is not programmed in, which is why i am asking how/why it happens?
        E 1 Reply Last reply
        0
        • E ESP123

          @dheerendra

          1. i tried all sort of combinations of setting stretch factor, none seemed to work .. what is the recommended way? do i need to set on all objects?
          2. no i did not but i did try programmatically
          3. this happens automatically somehow, this is not programmed in, which is why i am asking how/why it happens?
          E Offline
          E Offline
          ESP123
          wrote on last edited by
          #4

          @ESP123 to clarify on #3, i open and create a dialog, then i add the loaded widget onto it .. when i press escape, the added widget dissapears, the parent widget is still open it is just empty

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi and welcome to devnet,

            Please show us the code you use, that will make things easier.

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

            E 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi and welcome to devnet,

              Please show us the code you use, that will make things easier.

              E Offline
              E Offline
              ESP123
              wrote on last edited by
              #6

              @SGaist

              after loading widget using quiloader, then i instantiate a child of QDialog, where in the constructor i use:

              QLayout *layout = this->layout();
              QWidget *myWidget = (loaded widget);
              myWidget->show();
              layout->addWidget(myWidget);
              this->show();
              this->activateWindow();
              this->raise();
              
              1 Reply Last reply
              0
              • dheerendraD Offline
                dheerendraD Offline
                dheerendra
                Qt Champions 2022
                wrote on last edited by
                #7

                This code piece does not have any issue. I suggest you prepare a complete sample which is giving a problem.

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

                1 Reply Last reply
                1
                • E Offline
                  E Offline
                  ESP123
                  wrote on last edited by
                  #8

                  I figured it out, i needed an event filter to capture the child events, so when escape is pressed, it did not go blank, since qt dialog wants to close .. but the parent was still open .. works now thank you

                  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