forked from qt-creator/qt-creator
path chooser: provide access to the line edit
To make it work with the HistoryCompleter.
This commit is contained in:
@@ -102,7 +102,6 @@ PathChooser::PathChooser(QWidget *parent) :
|
|||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_d(new PathChooserPrivate(this))
|
m_d(new PathChooserPrivate(this))
|
||||||
{
|
{
|
||||||
|
|
||||||
m_d->m_hLayout->setContentsMargins(0, 0, 0, 0);
|
m_d->m_hLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
|
connect(m_d->m_lineEdit, SIGNAL(validReturnPressed()), this, SIGNAL(returnPressed()));
|
||||||
@@ -166,7 +165,6 @@ void PathChooser::slotBrowse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prompt for a file/dir
|
// Prompt for a file/dir
|
||||||
QString dialogTitle;
|
|
||||||
QString newPath;
|
QString newPath;
|
||||||
switch (m_d->m_acceptingKind) {
|
switch (m_d->m_acceptingKind) {
|
||||||
case PathChooser::Directory:
|
case PathChooser::Directory:
|
||||||
@@ -186,8 +184,10 @@ void PathChooser::slotBrowse()
|
|||||||
QFileInfo fi(predefined);
|
QFileInfo fi(predefined);
|
||||||
if (fi.exists())
|
if (fi.exists())
|
||||||
dialog.setDirectory(fi.absolutePath());
|
dialog.setDirectory(fi.absolutePath());
|
||||||
dialog.setNameFilter(m_d->m_dialogFilter); // fix QFileDialog so that it filters properly: lib*.a
|
// FIXME: fix QFileDialog so that it filters properly: lib*.a
|
||||||
if (dialog.exec() == QDialog::Accepted) { // probably loop here until the *.framework dir match
|
dialog.setNameFilter(m_d->m_dialogFilter);
|
||||||
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
// probably loop here until the *.framework dir match
|
||||||
QStringList paths = dialog.selectedFiles();
|
QStringList paths = dialog.selectedFiles();
|
||||||
if (!paths.isEmpty())
|
if (!paths.isEmpty())
|
||||||
newPath = paths.at(0);
|
newPath = paths.at(0);
|
||||||
@@ -196,7 +196,7 @@ void PathChooser::slotBrowse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete trailing slashes unless it is "/"|"\\", only
|
// Delete trailing slashes unless it is "/"|"\\", only
|
||||||
@@ -339,4 +339,12 @@ QString PathChooser::makeDialogTitle(const QString &title)
|
|||||||
return m_d->m_dialogTitleOverride;
|
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
|
} // namespace Utils
|
||||||
|
|||||||
@@ -34,7 +34,11 @@
|
|||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QAbstractButton)
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QAbstractButton;
|
||||||
|
class QLineEdit;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
@@ -94,6 +98,8 @@ public:
|
|||||||
void addButton(const QString &text, QObject *receiver, const char *slotFunc);
|
void addButton(const QString &text, QObject *receiver, const char *slotFunc);
|
||||||
QAbstractButton *buttonAtIndex(int index) const;
|
QAbstractButton *buttonAtIndex(int index) const;
|
||||||
|
|
||||||
|
QLineEdit *lineEdit() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Returns overridden title or the one from <title>
|
// Returns overridden title or the one from <title>
|
||||||
QString makeDialogTitle(const QString &title);
|
QString makeDialogTitle(const QString &title);
|
||||||
|
|||||||
Reference in New Issue
Block a user