Results 1 to 2 of 2

Thread: Creating dock widget as tab dynamically

  1. #1
    Join Date
    Jul 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Creating dock widget as tab dynamically

    I am creating a dock widget dynamically at runtime.
    problem i am facing is
    1> i have to open a dock widget containing two tree widgets as a tab dynamically at runtime
    2>also the tabs of dock widget should be placed above the dock widget and not below the widget .

    please help me out as i have no one here to answer my question and on my own to complete the project.

    Thanking you in advance.
    here is my code..

    def createdockProject(self):
    self.dockUser = QtGui.QDockWidget(self.obj)
    self.dockUser.setFeatures(QtGui.QDockWidget.DockWi dgetClosable|QtGui.QDockWidget.DockWidgetMovable)
    #self.dockUser.setObjectName("dockUser_%s"%(self.t itle))
    self.dockWidgetContents = QtGui.QWidget(self.dockUser)
    self.dockWidgetContents.setObjectName("dockWidgetC ontents")
    self.gridLayout = QtGui.QGridLayout(self.dockWidgetContents)
    #self.gridLayout.setObjectName("gridLayout")
    self.tree = QtGui.QTreeWidget(self.dockWidgetContents)
    self.tree.setAlternatingRowColors(True)
    self.tree.setHeaderLabel("")
    self.tree.setHeaderHidden(True)
    self.tree.setObjectName("tree1")
    self.gridLayout.addWidget(self.tree,0,1,1,2)
    self.tree1 = QtGui.QTreeWidget(self.dockWidgetContents)
    self.tree1.setAlternatingRowColors(True)
    self.tree1.setHeaderLabel("")
    self.tree1.setHeaderHidden(True)
    self.gridLayout.addWidget(self.tree1,0,0,1,1)
    self.dockUser.setWidget(self.dockWidgetContents)
    self.obj.addDockWidget(QtCore.Qt.BottomDockWidgetA rea,self.dockUser,QtCore.Qt.Horizontal)
    self.firstDockWidget.setWidget(self.dockUser)

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Creating dock widget as tab dynamically

    Quote Originally Posted by vidyadhar View Post
    1> i have to open a dock widget containing two tree widgets as a tab dynamically at runtime
    You could use a single dock widget with a QTabWidget inside. Or tab three dock widgets.

    2>also the tabs of dock widget should be placed above the dock widget and not below the widget .
    -> QTabWidget::TabPosition; QMainWindow::setTabPosition()

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Creating an OSX-like dock widget
    By k2 in forum Qt Programming
    Replies: 0
    Last Post: 1st June 2009, 22:16
  3. Dock Widget problems
    By dbrmik in forum Newbie
    Replies: 5
    Last Post: 17th April 2009, 12:39
  4. sliding dock widget
    By manishkyl in forum Qt Programming
    Replies: 0
    Last Post: 28th July 2008, 14:04
  5. Pin/Unpin Dock Widget
    By charlesD in forum Newbie
    Replies: 1
    Last Post: 21st June 2006, 06:57

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.