PDA

View Full Version : Suggestions for Multiple QGraphicsView in QMainWindow



Sri
9th November 2012, 13:22
Hello,

I am designing a module which takes 8 images. Images needs to be drawn over different QGraphicsView on the mainwindow meaning 8 images on main window. I should be able to zoom/pan/draw do operations on the active image.

My approach is to derive a class from QGraphicsView. Create 8 of those and add to QGridLayout. This case i need to store the information of the image which is active for operations to perform and also need to let know the user with some different color which view/image is active.

Any suggestions to approach this is a better way ?

Regards
Sri

Santosh Reddy
9th November 2012, 13:33
I guess what you wanted to ask is, how to keep track of the active QGraphicsView

Sri
12th November 2012, 09:09
Yes. How do I do that ?

sindy
16th November 2012, 21:57
You could set a QMdiArea as the central widget of your QMainWindow. You can then add any number of QGraphicsView as the sub windows to the QMdiArea.
QMdiArea will then act as a window manager for these sub windows (QGraphicsView) and will keep track of the active window.

wysota
17th November 2012, 01:21
Yes. How do I do that ?

You can monitor the QApplication::focusChanged() signal to see which of your graphics views had the keyboard focus last.