Example #1
0
 def updateTabOrder(self):
     contentsLayout = self.__data.view.gridLayout
     if contentsLayout is not None:
         w = None
         for i in range(contentsLayout.count()):
             item = contentsLayout.itemAt(i)
             if w is not None and item.widget():
                 QWidget.setTabOrder(w, item.widget())
             w = item.widget()
Example #2
0
def qwtSetTabOrder(first, second, with_children):
    tab_chain = [first, second]
    if with_children:
        children = second.findChildren(QWidget)
        w = second.nextInFocusChain()
        while w in children:
            while w in children:
                children.remove(w)
            tab_chain += [w]
            w = w.nextInFocusChain()
    for idx in range(len(tab_chain)-1):
        w_from = tab_chain[idx]
        w_to = tab_chain[idx+1]
        policy1, policy2 = w_from.focusPolicy(), w_to.focusPolicy()
        proxy1, proxy2 = w_from.focusProxy(), w_to.focusProxy()
        for w in (w_from, w_to):
            w.setFocusPolicy(Qt.TabFocus)
            w.setFocusProxy(None)
        QWidget.setTabOrder(w_from, w_to)
        for w, pl, px in ((w_from, policy1, proxy1), (w_to, policy2, proxy2)):
            w.setFocusPolicy(pl)
            w.setFocusProxy(px)