diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index f1c06aaa751..bb16ae1a0c1 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -102,7 +102,6 @@ PathChooser::PathChooser(QWidget *parent) : QWidget(parent), m_d(new PathChooserPrivate(this)) { - m_d->m_hLayout->setContentsMargins(0, 0, 0, 0); connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed())); @@ -166,7 +165,6 @@ void PathChooser::slotBrowse() } // Prompt for a file/dir - QString dialogTitle; QString newPath; switch (m_d->m_acceptingKind) { case PathChooser::Directory: @@ -186,8 +184,10 @@ void PathChooser::slotBrowse() QFileInfo fi(predefined); if (fi.exists()) dialog.setDirectory(fi.absolutePath()); - dialog.setNameFilter(m_d->m_dialogFilter); // fix QFileDialog so that it filters properly: lib*.a - if (dialog.exec() == QDialog::Accepted) { // probably loop here until the *.framework dir match + // FIXME: fix QFileDialog so that it filters properly: lib*.a + dialog.setNameFilter(m_d->m_dialogFilter); + if (dialog.exec() == QDialog::Accepted) { + // probably loop here until the *.framework dir match QStringList paths = dialog.selectedFiles(); if (!paths.isEmpty()) newPath = paths.at(0); @@ -196,7 +196,7 @@ void PathChooser::slotBrowse() } default: - ; + break; } // Delete trailing slashes unless it is "/"|"\\", only @@ -339,4 +339,12 @@ QString PathChooser::makeDialogTitle(const QString &title) return m_d->m_dialogTitleOverride; } +QLineEdit *PathChooser::lineEdit() const +{ + // HACK: Make it work with HistoryCompleter. + if (m_d->m_lineEdit->objectName().isEmpty()) + m_d->m_lineEdit->setObjectName(objectName() + QLatin1String("LineEdit")); + return m_d->m_lineEdit; +} + } // namespace Utils diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 74e1e3acd93..b0eff161533 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -34,7 +34,11 @@ #include -QT_FORWARD_DECLARE_CLASS(QAbstractButton) +QT_BEGIN_NAMESPACE +class QAbstractButton; +class QLineEdit; +QT_END_NAMESPACE + namespace Utils { @@ -94,6 +98,8 @@ public: void addButton(const QString &text, QObject *receiver, const char *slotFunc); QAbstractButton *buttonAtIndex(int index) const; + QLineEdit *lineEdit() const; + private: // Returns overridden title or the one from QString makeDialogTitle(const QString &title);