Results 1 to 5 of 5

Thread: Suggestions for Multiple QGraphicsView in QMainWindow

  1. #1
    Join Date
    Nov 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Suggestions for Multiple QGraphicsView in QMainWindow

    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

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Suggestions for Multiple QGraphicsView in QMainWindow

    I guess what you wanted to ask is, how to keep track of the active QGraphicsView
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Nov 2012
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Suggestions for Multiple QGraphicsView in QMainWindow

    Yes. How do I do that ?

  4. #4
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Suggestions for Multiple QGraphicsView in QMainWindow

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Suggestions for Multiple QGraphicsView in QMainWindow

    Quote Originally Posted by Sri View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 13th March 2012, 05:26
  2. Multiple inheritance of QGraphicsView and QGraphicsItem
    By cookie1909 in forum Qt Programming
    Replies: 9
    Last Post: 15th May 2009, 18:02
  3. Replies: 1
    Last Post: 30th December 2008, 13:28
  4. Replies: 3
    Last Post: 12th August 2008, 19:14
  5. QGraphicsView: Moving multiple selection
    By marcel in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2007, 19:59

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.