Issue
I tried it in simply one example but i cant figure how to do it. I search like 2-3 hours for figure also even in QtDesigner i cant run it correctly. I also tried with .focusProxy not working
import sys
from PyQt5.QtWidgets import *
class Pencere(QWidget):
def __init__(self):
super().__init__()
self.icayarlar()
def icayarlar(self):
self.setWindowTitle("Deneme")
self.b1=QLineEdit()
self.b2=QLineEdit()
self.b3=QLineEdit()
self.v_box=QHBoxLayout()
self.v_box.addWidget(self.b1)
self.v_box.addWidget(self.b2)
self.v_box.addWidget(self.b3)
self.setTabOrder(self.b1,self.b3)
self.setLayout(self.v_box)
app=QApplication(sys.argv)
pencere=Pencere()
pencere.show()
sys.exit(app.exec_())
i also tried this
self.setTabOrder(self.b1,self.b3)
self.setTabOrder(self.b3, self.b2)
self.setTabOrder(self.b2, self.b1)
Solution
Run first setLayout(), then the setTabOrder().
import sys
from PyQt5.QtWidgets import *
class Pencere(QWidget):
def __init__(self):
super().__init__()
self.icayarlar()
self.show()
def icayarlar(self):
self.setWindowTitle("Deneme")
self.b1=QLineEdit()
self.b2=QLineEdit()
self.b3=QLineEdit()
self.v_box=QHBoxLayout()
self.v_box.addWidget(self.b1)
self.v_box.addWidget(self.b2)
self.v_box.addWidget(self.b3)
# first setLayout()
self.setLayout(self.v_box)
# after setTabOrder()
self.setTabOrder(self.b1,self.b3)
app = QApplication(sys.argv)
wid = Pencere()
sys.exit(app.exec_())
Hope this helps.
Answered By - Jonas Vieira de Souza
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.