Multiple QMainWindow instances?

The QMainWindow is the main window in a Qt application. So usually you'd have only one, but would it be possible at all to have multiple QMainWindow instances in your application?

I am working on integrating a Qt-based GUI application B into another Qt-based GUI application A. Both these applications have a QMainWindow, and I was considering as a first step to create a new QMainWindow that has both old QMainWindows on tabs. That way it would allow me to concentrate on wiring the backend of GUI B to the backend of A without having to change anything in the user interface itself. Is this a viable approach, or do you have other suggestions?


You can have as many QMainWindow instances as you want. A QMainWindow is just a QWidget which provides a menu bar, toolbar, status bar and docking framework. But basically it is just a QWidget so you can have as many as you like.

Normally you only have a single QMainWindow for GUI design reasons since it can be confusing to have multiple main windows. However, when implementing applications like QtAssistant which can open a new instance of themselves then the one process has multiple main windows.

What you suggest should work. The window with the tabs would not need to be a QMainWindow unless you want to also want add a toolbar to that window as well.

Need Your Help

Python - Download File Using Requests, Directly to Memory

python python-requests mmap

The goal is to download a file from the internet, and create from it a file object, or a file like object without ever having it touch the hard drive. This is just for my knowledge, wanting to know...

Resetting the bounds of UILabels when view is loaded gives a glitch (iOS)

objective-c ios cocoa-touch animation

I have a UIViewController with a .xib having 2 UILables named "LblA" and "LblB". Lets call this ViewController "A". The bounds or the positioning of LblA and LblB depend on @property's called lblAB...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.