Pop-out widget into a separate window with Qt

Have you ever felt that your application needs an extra window? When the user has 2 screens available how great would it be to separate the widgets you had to push into a tab widget!

I have good news for you: this can be done simply with Qt.

Let’s say we have a window with two widgets. They are quite important so we’d like the user to see both of them if possible. What can we do about it?

First, red and green

Let’s create an other window and use Qt’s slot&signal mechanism to send messages between them.

Second, the red widget is moved to the other window

I had the red widget removed just to let you see that this is no fake so after putting back the red widget they will switch places compared with the original window.

Third, the red widget is returned to the original window.

The source code is available here on github

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.