Browse Source

Select text in search entry also when focusing via shortcut

Based on #945
Closes #945

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
cd6d1d2aea
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 8 additions and 18 deletions
  1. +0
    -16
      resources/ui/carla_database.ui
  2. +8
    -2
      source/frontend/carla_database.py

+ 0
- 16
resources/ui/carla_database.ui View File

@@ -955,21 +955,5 @@
<include location="../resources.qrc"/> <include location="../resources.qrc"/>
</resources> </resources>
<connections> <connections>
<connection>
<sender>act_focus_search</sender>
<signal>triggered()</signal>
<receiver>lineEdit</receiver>
<slot>setFocus()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>448</x>
<y>23</y>
</hint>
</hints>
</connection>
</connections> </connections>
</ui> </ui>

+ 8
- 2
source/frontend/carla_database.py View File

@@ -1409,6 +1409,7 @@ class PluginDatabaseW(QDialog):


self.ui.b_add.setEnabled(False) self.ui.b_add.setEnabled(False)
self.addAction(self.ui.act_focus_search) self.addAction(self.ui.act_focus_search)
self.ui.act_focus_search.triggered.connect(self.slot_focusSearchFieldAndSelectAll)


if BINARY_NATIVE in (BINARY_POSIX32, BINARY_WIN32): if BINARY_NATIVE in (BINARY_POSIX32, BINARY_WIN32):
self.ui.ch_bridged.setText(self.tr("Bridged (64bit)")) self.ui.ch_bridged.setText(self.tr("Bridged (64bit)"))
@@ -1505,7 +1506,7 @@ class PluginDatabaseW(QDialog):
# Post-connect setup # Post-connect setup


self._reAddPlugins() self._reAddPlugins()
self.ui.lineEdit.setFocus()
self.slot_focusSearchFieldAndSelectAll()


# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------


@@ -1532,6 +1533,11 @@ class PluginDatabaseW(QDialog):
if column != self.TABLEWIDGET_ITEM_FAVORITE: if column != self.TABLEWIDGET_ITEM_FAVORITE:
self.slot_addPlugin() self.slot_addPlugin()


@pyqtSlot()
def slot_focusSearchFieldAndSelectAll(self):
self.ui.lineEdit.setFocus()
self.ui.lineEdit.selectAll()

@pyqtSlot() @pyqtSlot()
def slot_addPlugin(self): def slot_addPlugin(self):
if self.ui.tableWidget.currentRow() >= 0: if self.ui.tableWidget.currentRow() >= 0:
@@ -2201,7 +2207,7 @@ class PluginDatabaseW(QDialog):
# -------------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------------


def showEvent(self, event): def showEvent(self, event):
self.ui.lineEdit.setFocus()
self.slot_focusSearchFieldAndSelectAll()
QDialog.showEvent(self, event) QDialog.showEvent(self, event)


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------


Loading…
Cancel
Save