コード例 #1
0
 def keyPressEvent(self, event):
     key = event.key()
    
     if key != Qt.Key_Backspace and key != Qt.Key_Enter:
         self.inactiveTextInPlace = False
         
     QLineEdit.keyPressEvent(self, event)
コード例 #2
0
 def focusOutEvent(self, event):
     if self.inactiveTextInPlace:
         self.setText(self.tr("Search..."))
         self.inactiveTextStyleSheet()
     QLineEdit.focusOutEvent(self, event)
コード例 #3
0
 def focusInEvent(self, event):
     if self.inactiveTextInPlace:
         self.clear()
         self.setStyleSheet("")
     QLineEdit.focusInEvent(self, event)