HI Justin,
I total get why you are up in the air with this haha,
It is because I am just prototyping with ideas in my head with what I
want it to do.
My experience in QT is not basic but then again it is
not as strong as I want it to be either.I will try to explain my main
goal more explicitly.
1. The idea is to get a tree that has 3 or 4
topLevelItems and only 1 of them can be dropdraggable (the prebuild)
this is because the top level item will be linked to the rootNode in
maya. and maybe any part can be classed as a root node or joint.
2. I
have a built up library of classes that create joints and limbs and
everything in-between that will hook up to the branches and
topLevelItems.
3. On the right I have a stack with a list and a
table which is entirely just for visuals to show when I am able to
actually get the stack switching from one page to another. The tree
should only work within itself.
4. I want to toy with the idea of
using the lineEdit as both a filter and a node installer. I have various
other nodes that I would like the line edit only to recognize in the
line edit, (** Only when the button is clicked ** ).. Other than this it
should just work as a normal filter.
5.The tree will be relevant to
the stack on the right not only by page but by nodes in mayas, so if i
selected limb on the right a stack will show the limb window with leg/
arm/ finger/ toes etc and to choose how many segments per part.
6. I do have some code to hardcode from before show below
class UI(QMainWindow):
def __init__(self, *args, **kwargs):
QMainWindow.__init__(self, *args, **kwargs)
main_wid = QWidget(self)
self.setCentralWidget(main_wid)
layout = QHBoxLayout(self)
main_wid.setLayout(layout)
self.tree = QTreeWidget(self)
layout.addWidget(self.tree)
item1 = QTreeWidgetItem('Bip')
self.tree.addTopLevelItem(item1)
item2 = QTreeWidgetItem('Quad')
self.tree.addTopLevelItem(item2)
self.stack = QStackedWidget(self)
layout.addWidget(self.stack)
page1 = QLabel('Please Change setting for your preferences', self)
self.stack.addWidget(page1)
page2 = QLabel('Page2 : quad', self)
self.stack.addWidget(page2)
self.tree.itemSelectionChanged.connect(self.update_page)
self.show()
def update_page(self):
item = self.tree.currentItem()
# -- Do nothing if we don't have a current item
if not item:
return
# -- Check the item's text
if item.text(0) == 'Bip':
self.stack.setCurrentIndex(0)
else:
self.stack.setCurrentIndex(1)
# -- Or use the 'row'
top_item_count = self.tree.topLevelItemCount()
for i in xrange(top_item_count):
if item is self.tree.topLevelItem(i):
self.stack.setCurrentIndex(i)
return
This code works fine if it is needed for a hard coded project. But as I need it to be a bit more dynamic and switch from pages that are not even configured. This is where the lineEdit and button comes in.
Don't take notice of the indents as it is just the code that I am concerned about, trying to figure what does what.