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. What the best way to use the class generated by qt designer?
Forum Updated to NodeBB v4.3 + New Features

What the best way to use the class generated by qt designer?

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

    The Direct Approach: you construct a widget to use as a placeholder for the component, and set up the user interface inside it.
    The Single Inheritance Approach: you subclass the form's base class (QWidget or QDialog, for example), and include a private instance of the form's user interface object.
    The Multiple Inheritance Approach: you subclass both the form's base class and the form's user interface object. This allows the widgets defined in the form to be used directly from within the scope of the subclass.

    this are the 3 ways to use the file coming out of the qt designer, is there any one better than other? or a particular reason why or when to use one over the other?

    thanks guys

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on last edited by
      #2

      Hi,

      I always create my projects with Qt Creator's new project wizard and go with the default method there which is "Aggregation as a pointer member" (Options > C++ > Qt Class Generation). I think this is best one out of the three because it avoids multiple inheritance and makes it explicit that my class is QWidget, i.e. a UI class.

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

        i use it with pyqt, and i just have the designer and then we use that file/ class.

        for basic ui, usually one window allocation, (mostly a qdialog). and not sure if are advantage or disadvantage beaten methods.

        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