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
QtWS25 Last Chance

Inheritance forms with QUiLoader

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 980 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 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
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on 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 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
        • Chris KawaC Online
          Chris KawaC Online
          Chris Kawa
          Lifetime Qt Champion
          wrote on 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 last edited by
            #5

            Ok,

            Thanks for the clarification

            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