Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How do you add a custom widget to a form within the same project in QtCreator
Forum Updated to NodeBB v4.3 + New Features

How do you add a custom widget to a form within the same project in QtCreator

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 2 Posters 10.4k 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.
  • T Offline
    T Offline
    TwoGunBerg
    wrote on last edited by
    #1

    Hi I have a single project which contains the main app and a custom widget. How do i add the custom widget to the main app's ui file graphically? i don't know how to make the designer recognize the custom widget.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tony
      wrote on last edited by
      #2

      Two ways:

      • promotion (the easy one, you won't see any graphical difference between your custom widget and the parent one, cause it "promises" you only the fact that setupUi method will create a widget of your custom type, and not the original one). In this case, just right-click on your widget, promote it, give your .h header file and the type of your custom widget.

      • writing a component for Qt designer (the long one). In this case, refer to Qt documentation, just look for "Creating Custom Widgets for Qt Designer" in Qt Assistant, or have a look to this example: "Custom Widget Plugin Example":http://doc.trolltech.com/4.6/designer-customwidgetplugin.html

      Tony.

      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