Select all text, when a QLineEdit is focused

This commit is contained in:
Fierelier 2023-08-24 09:40:10 +02:00
parent 465b325e5b
commit 84ca8068ee

View File

@ -608,6 +608,20 @@ class mainWindow(QMainWindow):
writeConfigFile("lastProfile.txt",self.cProfileDropdown.currentText())
windows.remove(self)
def onFocusChanged(old,current):
if type(current) == QLineEdit:
def f():
try:
current.selectAll()
except:
pass
global markTimer
markTimer = QTimer()
markTimer.setSingleShot(True)
markTimer.timeout.connect(f)
markTimer.start(0)
windows = []
def main():
if not os.path.isdir(p(configDir,"profiles")):
@ -617,6 +631,7 @@ def main():
saveProfile(defaultProfile,"default")
app = QApplication(sys.argv)
app.focusChanged.connect(onFocusChanged)
windows.append(mainWindow())
app.exec_()
main()