Results 1 to 5 of 5

Thread: Qworkspace

  1. #1
    Join Date
    Jul 2006
    Location
    France
    Posts
    34
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Qworkspace

    Hye every body,

    I'm developping an application that I want it to be MDI, just like QtDesigner V4 (in workspace mode), with some docked windows.

    But I do not know how to instense a QWorkspace as main windows.

    Does anyone know how could I?

    Should I developp my own widget? If I must, how do you do it ?

    Thanks for your help

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qworkspace

    You can't instantiate a QWorkspace as main window. I bet instantiating it as top level window would'nt help it because there would be no wxay to add docks...
    Here is the way to go :
    Qt Code:
    1. QMainWindow *pMain = new QMainWindow;
    2.  
    3. QWorkspace *pWorkspace = new QWorkspace(pMain);
    4. pMain->setCentralWidget(pWorkspace);
    5.  
    6. //add your dock stuff here
    To copy to clipboard, switch view to plain text mode 

    Current Qt projects : QCodeEdit, RotiDeCode

  3. The following user says thank you to fullmetalcoder for this useful post:

    weepdoo (21st July 2006)

  4. #3
    Join Date
    Jul 2006
    Location
    France
    Posts
    34
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qworkspace

    Thanks for your help and that's exactly the problem I against actually.
    But I do code in Python (with PyQt from riverbankcomputing), and here is what I did:

    Qt Code:
    1. class MainWindow (QtGui.QMainWindow):
    2. def __init__ (self, parent=None):
    3. QtGui.QMainWindow.__init__ (self, parent)
    4.  
    5. self.workspace = QtGui.QWorkspace ()
    6. self.setCentralWidget (self.workspace)
    7.  
    8. self.connect (self.workspace, QtCore.SIGNAL ("windowActivated (QWidget *)"), self.updateMenus)
    9. self.windowMapper = QtCore.QSignalMapper (self)
    10. self.connect (self.windowMapper, QtCore.SIGNAL ("mapped (QWidget *)"),
    11. self.workspace, QtCore.SLOT ("setActiveWindow (QWidget *)"))
    12.  
    13. self.createActions ()
    14. self.createMenus ()
    15. self.createToolBars ()
    16. self.createStatusBar()
    17. self.createDockWindows () #<= Here is my problem
    18. self.updateMenus ()
    19. self.readSettings ()
    To copy to clipboard, switch view to plain text mode 

    If I do create the DockWindow, that do not work anymore...

    I would prefere to do the same thing with QtDesigner, so that I quiet do not have to code with Qt :P

    PS: this code came from the samples given by trolltech, and compile in Python by RiverBank

  5. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qworkspace

    How do you setup your dock widgets???
    You say the problem occurs in a function but you don't show the code...

    Anyway, if you want to do it through designer, there's one way only : hack...
    You must modify the content of your *.ui file by hand, at least at the beginning and AVOID selecting the QWorkspace widget (designer would crash...)

    I've attached an example ui file, try it out...
    Attached Files Attached Files
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #5
    Join Date
    Jul 2006
    Location
    France
    Posts
    34
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qworkspace

    Sorry my mistake that I do not show the code :P

    But I choose to do it "manually", and not with QtDesigner, because I tried tha same sort of solution that you propose with your .ui, but "pyuic" the compiler of '.ui' in python, do not seems to very like workspace... so I can't use it :'(

    However, thanks for your help.

Similar Threads

  1. How to resize a QMainWindow in QWorkspace.
    By s_a_white in forum Newbie
    Replies: 2
    Last Post: 17th July 2006, 18:22
  2. MDI windows without QWorkspace
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 17:15
  3. Retrieving offsets of scroll in QWorkspace
    By hardgeus in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 02:25
  4. QWorkspace
    By fellobo in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 19:31

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.