forked from qt-creator/qt-creator
Docker: Add history to "Search in Selected Directories"
Also set focus to the line edit when this item gets selected, and remove the arbitrary /usr/bin;/opt default. Slightly better UX. Change-Id: Icdc4e81d6cebd7aed1dd4999c4007a60c8ea53a2 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -382,12 +382,12 @@ public:
|
|||||||
searchDirsComboBox->addItem(tr("Search in PATH"));
|
searchDirsComboBox->addItem(tr("Search in PATH"));
|
||||||
searchDirsComboBox->addItem(tr("Search in Selected Directories"));
|
searchDirsComboBox->addItem(tr("Search in Selected Directories"));
|
||||||
|
|
||||||
auto searchDirsLineEdit = new QLineEdit;
|
auto searchDirsLineEdit = new FancyLineEdit;
|
||||||
searchDirsLineEdit->setText("/usr/bin;/opt");
|
|
||||||
searchDirsLineEdit->setToolTip(
|
searchDirsLineEdit->setToolTip(
|
||||||
tr("Select the paths in the docker image that should be scanned for kit entries."));
|
tr("Select the paths in the docker image that should be scanned for kit entries."));
|
||||||
|
searchDirsLineEdit->setHistoryCompleter("DockerMounts", true);
|
||||||
|
|
||||||
auto searchPaths = [this, searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
|
auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
|
||||||
FilePaths paths;
|
FilePaths paths;
|
||||||
if (searchDirsComboBox->currentIndex() == 0) {
|
if (searchDirsComboBox->currentIndex() == 0) {
|
||||||
paths = dockerDevice->systemEnvironment().path();
|
paths = dockerDevice->systemEnvironment().path();
|
||||||
@@ -458,8 +458,10 @@ public:
|
|||||||
}.attachTo(this);
|
}.attachTo(this);
|
||||||
|
|
||||||
searchDirsLineEdit->setVisible(false);
|
searchDirsLineEdit->setVisible(false);
|
||||||
auto updateDirectoriesLineEdit = [this, searchDirsLineEdit](int index) {
|
auto updateDirectoriesLineEdit = [searchDirsLineEdit](int index) {
|
||||||
searchDirsLineEdit->setVisible(index == 1);
|
searchDirsLineEdit->setVisible(index == 1);
|
||||||
|
if (index == 1)
|
||||||
|
searchDirsLineEdit->setFocus();
|
||||||
};
|
};
|
||||||
QObject::connect(searchDirsComboBox, qOverload<int>(&QComboBox::activated),
|
QObject::connect(searchDirsComboBox, qOverload<int>(&QComboBox::activated),
|
||||||
this, updateDirectoriesLineEdit);
|
this, updateDirectoriesLineEdit);
|
||||||
|
Reference in New Issue
Block a user