PathChooser: Allow for chooser-only selection of files/directories

Makes the line edit disabled and read-only in that case.
We also need to change the custom context menu from the line edit to the
path chooser itself, because disabled widgets do not show a context
menu, but we still want to see the select & copy, and the special
items for opening explorer or terminal.

Task-number: QTCREATORBUG-23798
Change-Id: Ib653b4eaaedfbe54c614377795ddc52d21ac12c0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Tobias Hunger
2020-03-16 10:24:35 +01:00
committed by Eike Ziller
parent 5838b40c6d
commit 69b0a2cafc
5 changed files with 66 additions and 18 deletions

View File

@@ -138,6 +138,9 @@ public:
bool isReadOnly() const;
void setReadOnly(bool b);
bool isFileDialogOnly() const;
void setFileDialogOnly(bool b);
void triggerChanged();
// global handler for adding context menus to ALL pathchooser
@@ -156,6 +159,7 @@ private:
QString makeDialogTitle(const QString &title);
void slotBrowse();
void contextMenuRequested(const QPoint &pos);
void updateReadOnlyStateOfSubwidgets();
signals:
void validChanged(bool validState);