forked from qt-creator/qt-creator
Add API for FileName to PathChooser
Add a API to enable use of Utils::FileName in the PathChooser. Change-Id: I787ef0e23001188fda10497c8ee22a5c2352de4d Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -309,11 +309,21 @@ QString PathChooser::rawPath() const
|
||||
return QDir::fromNativeSeparators(d->m_lineEdit->text());
|
||||
}
|
||||
|
||||
FileName PathChooser::fileName() const
|
||||
{
|
||||
return Utils::FileName::fromString(path());
|
||||
}
|
||||
|
||||
void PathChooser::setPath(const QString &path)
|
||||
{
|
||||
d->m_lineEdit->setText(QDir::toNativeSeparators(path));
|
||||
}
|
||||
|
||||
void PathChooser::setFileName(const Utils::FileName &fn)
|
||||
{
|
||||
d->m_lineEdit->setText(fn.toUserOutput());
|
||||
}
|
||||
|
||||
bool PathChooser::isReadOnly() const
|
||||
{
|
||||
return d->m_lineEdit->isReadOnly();
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include "fileutils.h"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -53,6 +55,7 @@ class QTCREATOR_UTILS_EXPORT PathChooser : public QWidget
|
||||
Q_OBJECT
|
||||
Q_ENUMS(Kind)
|
||||
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
||||
Q_PROPERTY(Utils::FileName fileName READ fileName WRITE setFileName DESIGNABLE true)
|
||||
Q_PROPERTY(QString promptDialogTitle READ promptDialogTitle WRITE setPromptDialogTitle DESIGNABLE true)
|
||||
Q_PROPERTY(Kind expectedKind READ expectedKind WRITE setExpectedKind DESIGNABLE true)
|
||||
Q_PROPERTY(QString baseDirectory READ baseDirectory WRITE setBaseDirectory DESIGNABLE true)
|
||||
@@ -91,6 +94,7 @@ public:
|
||||
|
||||
QString path() const;
|
||||
QString rawPath() const; // The raw unexpanded input.
|
||||
Utils::FileName fileName() const;
|
||||
|
||||
QString baseDirectory() const;
|
||||
void setBaseDirectory(const QString &directory);
|
||||
@@ -139,6 +143,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void setPath(const QString &);
|
||||
void setFileName(const Utils::FileName &);
|
||||
|
||||
private slots:
|
||||
void slotBrowse();
|
||||
|
||||
Reference in New Issue
Block a user