Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4 import QtGui,QtCore
- from PyQt4 import uic
- #from PySide import QtGui,QtCore
- def getMainWindow():
- "returns the main window"
- # using QtGui.qApp.activeWindow() isn't very reliable because if another
- # widget than the mainwindow is active (e.g. a dialog) the wrong widget is
- # returned
- toplevel = QtGui.qApp.topLevelWidgets()
- for i in toplevel:
- if i.metaObject().className() == "Gui::MainWindow":
- return i
- raise Exception("No main window found")
- def getComboView(mw):
- dw=mw.findChildren(QtGui.QDockWidget)
- for i in dw:
- if str(i.objectName()) == "Combo View":
- return i.findChild(QtGui.QTabWidget)
- raise Exception("No tab widget found")
- mw = getMainWindow()
- tab = getComboView(getMainWindow())
- tab2=QtGui.QDialog()
- tab.addTab(tab2,"A Special Tab")
- uic.loadUi("/home/danfalck/Documents/freecad/taskpanel_experiments/TaskPanelforTabs.ui",tab2)
- tab2.show()
- #tab.removeTab(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement