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())
|
writeConfigFile("lastProfile.txt",self.cProfileDropdown.currentText())
|
||||||
windows.remove(self)
|
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 = []
|
windows = []
|
||||||
def main():
|
def main():
|
||||||
if not os.path.isdir(p(configDir,"profiles")):
|
if not os.path.isdir(p(configDir,"profiles")):
|
||||||
@ -617,6 +631,7 @@ def main():
|
|||||||
saveProfile(defaultProfile,"default")
|
saveProfile(defaultProfile,"default")
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
app.focusChanged.connect(onFocusChanged)
|
||||||
windows.append(mainWindow())
|
windows.append(mainWindow())
|
||||||
app.exec_()
|
app.exec_()
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user