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 encapsulate ui form inside another
Forum Updated to NodeBB v4.3 + New Features

How to encapsulate ui form inside another

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.3k 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.
  • P Offline
    P Offline
    Pepas
    wrote on last edited by
    #1

    Hello!

    I'm slowly developing the application in Qt in linux environment, it's some kind of port from things I've done in .net environment so I have habits I can't get over.

    The primary thing I'm looking for is how may I achieve form & controls encapsulation; in .net I used to (simple example):

    1. Create mainform (qmainwindow equivalent), put some basic widgets around, dock elements, containers.
    2. Create another form (qmainwindow/qwidget), place controls, build internal logic and behaviors.
    3. Drag 'another' form onto 'mainform' inside the designer, align, dock, done; I could play in separeted environments via events, whatever :)

    Well, I jumped from tutorials to docs and still I can't find some reasonable way to achieve the same thing. The closest part is custom widget done via plugin, but there is so much overhead that i'd rather reconsider that approach.

    I'll be happy to hear some hints which topics I should hit to solve my issue, or at least some general brief.

    jsulmJ 1 Reply Last reply
    0
    • P Pepas

      Hello!

      I'm slowly developing the application in Qt in linux environment, it's some kind of port from things I've done in .net environment so I have habits I can't get over.

      The primary thing I'm looking for is how may I achieve form & controls encapsulation; in .net I used to (simple example):

      1. Create mainform (qmainwindow equivalent), put some basic widgets around, dock elements, containers.
      2. Create another form (qmainwindow/qwidget), place controls, build internal logic and behaviors.
      3. Drag 'another' form onto 'mainform' inside the designer, align, dock, done; I could play in separeted environments via events, whatever :)

      Well, I jumped from tutorials to docs and still I can't find some reasonable way to achieve the same thing. The closest part is custom widget done via plugin, but there is so much overhead that i'd rather reconsider that approach.

      I'll be happy to hear some hints which topics I should hit to solve my issue, or at least some general brief.

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

      @Pepas Sounds like you need http://doc.qt.io/archives/qt-4.8/designer-using-custom-widgets.html

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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pepas
        wrote on last edited by
        #3

        I used to promote classes to extend some basic widgets, today I've tried to extend widget and promote QWidget to my form class and I failed, looks like I've done something wrong because it didn't load controls from another .ui. I've seen an example with custom paint method which worked, so I'll give it a try one more time :)

        CP71C 1 Reply Last reply
        0
        • P Pepas

          I used to promote classes to extend some basic widgets, today I've tried to extend widget and promote QWidget to my form class and I failed, looks like I've done something wrong because it didn't load controls from another .ui. I've seen an example with custom paint method which worked, so I'll give it a try one more time :)

          CP71C Offline
          CP71C Offline
          CP71
          wrote on last edited by
          #4

          @Pepas Hi,
          I used to promote classes to do this and it normally works well, and they normally inherit by QWidget .
          Anyway I did a quick test and here you find result:

          • I Tried to promote a QWidget that exist in my UI in UI that inherits by QDialog : it didn’t work
          • I Tried to promote a QWidget that exist in my UI in UI that inherits by QWidget: it did work well

          Is it possible you are in same first condition?

          How kind of superclass is your UI to promote?

          PS: sorry for my English

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

            Ok, solved that issue. I've made an error, I can promote mainwindow.ui 'dropped' widget to another widget class and controls are loading properly :) The only flaw it has is that promoted widged isn't visible in mainwindow.ui.

            1 Reply Last reply
            1

            • Login

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