Select all text, when a QLineEdit is focused
This commit is contained in:
parent
465b325e5b
commit
84ca8068ee
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user