Important: Please read the Qt Code of Conduct -

Qt equivalent to MS UserControls

  • I have an app written in C# that we are wanting to port to Qt. The idea of the app is straightforward - it contains several menu items and depending on which menu item you select, different operations appear in the central widget area (different buttons, datagrids, etc.). The functions for each screen was implemented with a UserControl and it was only a matter of displaying the correct UserControl. I thought it would be easy to implement the same thing in Qt using Widget, but I ran into a few oddities:

    1. Creating a Widget gives a caption bar which is not desired for this app (the caption on the application window is fine) - is there a way to turn off the caption in a widget? This way I can dispay the Widget in my main application's central widget area and it appears that various "screens" appear but without a caption.

    2. KDialog is the closest thing I found to solve issue #1, but it has few quirks. I want to overlay each "screen" in the same place on the Qapplication. But Qt wants to build a parent/child relationship with each KDialog that I overlay on the screen.

    As a complete newbie to Qt, I would appreciate any input/thoughts/guideliens/examples.

    Thanks for your time

    1. Widget/Caption
      A widget only has a caption bar when it is displayed as toplevel widget. As soon as you put it into some other widget, it is frameless.

    2. Overlays
      Seems like "QStackedWidget": could do what you want.

    As you are completely new to Qt, I'd propose to go through some tutorials:

Log in to reply