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. Inserting the widget in the mainwindow
Forum Updated to NodeBB v4.3 + New Features

Inserting the widget in the mainwindow

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 255 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.
  • C Offline
    C Offline
    Creatorczyk
    wrote on last edited by
    #1

    Hi,
    I would like to ask what is the best way to display my own widget in mainwindow which I created using Qt Designer form class. I would like to make a table of such widgets with the possibility of dynamic insertion and deletion. If there were any ready examples in Qt I would be grateful for the link :)

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome to the forums
      One way is the promotion feature which i love.

      say you made the Widget called MyWidget and it lives in mywidget.h and .cpp

      Then on the MainWindow
      add a plain QWidget
      Then right click it and select Promote
      give it the class name (MyWidget) and the .h file. (mywidget.h)
      then presss Add button, then promote button.

      and then when you run its your widget :)

      also from code using ui->widgetname

      When one is promoted, you can copy & paste to get more.

      However, are you sure bulding a table of widgets is the way to go ? It will be heavy if many.
      Qt has views such as table etc for such tables / lists. if it is.

      https://doc.qt.io/qt-5/designer-using-custom-widgets.html

      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