diff --git a/src/libs/qmleditorwidgets/filewidget.cpp b/src/libs/qmleditorwidgets/filewidget.cpp index 47a0020a871b7f592ac2811f90adcafa483f1cd0..5a405d64b4cd1f1b9e5edd35789bc4b66172aa63 100644 --- a/src/libs/qmleditorwidgets/filewidget.cpp +++ b/src/libs/qmleditorwidgets/filewidget.cpp @@ -53,9 +53,8 @@ FileWidget::FileWidget(QWidget *parent) : QWidget(parent), m_filter("(*.*)"), m_ layout->addWidget(m_pushButton); m_pushButton->setText("..."); connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(lineEditChanged())); - connect(m_pushButton, SIGNAL(pressed()), this, SLOT(buttonPressed())); + connect(m_pushButton, SIGNAL(released()), this, SLOT(onButtonReleased())); connect(m_comboBox, SIGNAL(editTextChanged(const QString &)), this, SLOT(comboBoxChanged())); - m_currentPath = QDir::currentPath(); } FileWidget::~FileWidget() @@ -83,14 +82,11 @@ void FileWidget::comboBoxChanged() setFileNameStr(m_comboBox->currentText()); } -void FileWidget::buttonPressed() +void FileWidget::onButtonReleased() { - QString path = m_currentPath; - QString newFile = QFileDialog::getOpenFileName(0, tr("Open File"), path, m_filter); + QString newFile = QFileDialog::getOpenFileName(0, tr("Open File"), m_path.toLocalFile(), m_filter); if (!newFile.isEmpty()) setFileNameStr(newFile); - - m_currentPath = QFileInfo(newFile).absolutePath(); } void FileWidget::setFileNameStr(const QString &fileName) diff --git a/src/libs/qmleditorwidgets/filewidget.h b/src/libs/qmleditorwidgets/filewidget.h index a1c1e37bec2deec941f9b9ab923f120e0ee0e96d..971a28f5c768c79a2788ee782e276b88d23eaf6a 100644 --- a/src/libs/qmleditorwidgets/filewidget.h +++ b/src/libs/qmleditorwidgets/filewidget.h @@ -91,7 +91,7 @@ public: public slots: void setFileName(const QUrl &fileName); void setFileNameStr(const QString &fileName); - void buttonPressed(); + void onButtonReleased(); void lineEditChanged(); void comboBoxChanged(); @@ -113,7 +113,6 @@ private: QString m_filter; bool m_showComboBox; bool m_lock; - QString m_currentPath; };