Skip to content

Commit

Permalink
OWFile: focusing URL selects text
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Sep 25, 2016
1 parent ebca371 commit 2ae604a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Orange/widgets/data/owfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ def match(self, context, filename, sheets):
return ContextHandler.NO_MATCH


class LineEditSelectOnFocus(QtGui.QLineEdit):
def focusInEvent(self, event):
super().focusInEvent(event)
# If selectAll is called directly, placing the cursor unselects the text
QtCore.QTimer.singleShot(0, self.selectAll)


class OWFile(widget.OWWidget, RecentPathsWComboMixin):
name = "File"
id = "orange.widgets.data.file"
Expand Down Expand Up @@ -168,6 +175,7 @@ def __init__(self):
self.url_combo = url_combo = QtGui.QComboBox()
url_model = NamedURLModel(self.sheet_names)
url_model.wrap(self.recent_urls)
url_combo.setLineEdit(LineEditSelectOnFocus())
url_combo.setModel(url_model)
url_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)
url_combo.setEditable(True)
Expand Down

0 comments on commit 2ae604a

Please sign in to comment.