i have made this:

Qt Code:
  1. def keyPressEvent(self, event):
  2. if event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return and (self.okButton.hasFocus() or self.cancelButton.hasFocus()):
  3. print "test"
  4. event.accept()
  5. else:
  6. QDialog.keyPressEvent(self, event)
To copy to clipboard, switch view to plain text mode 

and i still have the same problem, when i press the enter in the doublespinbox, the okButton get the focus and automatically it is clicked.