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. Inheritance forms with QUiLoader
Forum Update on Monday, May 27th 2025

Inheritance forms with QUiLoader

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 991 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
    Exotic_Devel
    wrote on 17 May 2014, 02:20 last edited by
    #1

    How do inheritance forms, using QUiLoader?

    @ class MainWindow : public WidgetGeneratedByLoader
    {

        public:
            explicit MainWindow(QWidget *parent = 0);
     
    }
    

    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 17 May 2014, 07:57 last edited by
      #2

      I'm not sure what you mean, but c++ is statically typed language. This means a concept of classes or inheritance is compiled away (apart from rtti and Qt meta system).
      QUiLoader loads Uis at runtime and only instantiates already defined classes. Inheriting from dynamically loaded class would mean dynamically creating new type, which, again, c++ doesn't do.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Exotic_Devel
        wrote on 17 May 2014, 12:21 last edited by
        #3

        I already suspected that.

        Thus, there is no way to inherit forms when using QUiLoader.

        Correct?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on 17 May 2014, 13:10 last edited by
          #4

          It's not clear to me what you want to do. QUiLoader creates instances of a class. You can't inherit an instance.

          You can define a custom class and create instances of it using loader.
          You can't load arbitrary .ui file with class names unknown to your program at compile time.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Exotic_Devel
            wrote on 17 May 2014, 14:00 last edited by
            #5

            Ok,

            Thanks for the clarification

            1 Reply Last reply
            0

            1/5

            17 May 2014, 02:20

            • 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