Commit 3fbd088b authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QuickToolBars: bugfix for FileWidget

The document path is now taken into account when opening
a document.
Also we use released() instead of pressed()

Task-number: QTCREATORBUG-2621

Reviewed-by: Kai Koehne
parent bf6009ab
...@@ -53,9 +53,8 @@ FileWidget::FileWidget(QWidget *parent) : QWidget(parent), m_filter("(*.*)"), m_ ...@@ -53,9 +53,8 @@ FileWidget::FileWidget(QWidget *parent) : QWidget(parent), m_filter("(*.*)"), m_
layout->addWidget(m_pushButton); layout->addWidget(m_pushButton);
m_pushButton->setText("..."); m_pushButton->setText("...");
connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(lineEditChanged())); 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())); connect(m_comboBox, SIGNAL(editTextChanged(const QString &)), this, SLOT(comboBoxChanged()));
m_currentPath = QDir::currentPath();
} }
FileWidget::~FileWidget() FileWidget::~FileWidget()
...@@ -83,14 +82,11 @@ void FileWidget::comboBoxChanged() ...@@ -83,14 +82,11 @@ void FileWidget::comboBoxChanged()
setFileNameStr(m_comboBox->currentText()); setFileNameStr(m_comboBox->currentText());
} }
void FileWidget::buttonPressed() void FileWidget::onButtonReleased()
{ {
QString path = m_currentPath; QString newFile = QFileDialog::getOpenFileName(0, tr("Open File"), m_path.toLocalFile(), m_filter);
QString newFile = QFileDialog::getOpenFileName(0, tr("Open File"), path, m_filter);
if (!newFile.isEmpty()) if (!newFile.isEmpty())
setFileNameStr(newFile); setFileNameStr(newFile);
m_currentPath = QFileInfo(newFile).absolutePath();
} }
void FileWidget::setFileNameStr(const QString &fileName) void FileWidget::setFileNameStr(const QString &fileName)
......
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
public slots: public slots:
void setFileName(const QUrl &fileName); void setFileName(const QUrl &fileName);
void setFileNameStr(const QString &fileName); void setFileNameStr(const QString &fileName);
void buttonPressed(); void onButtonReleased();
void lineEditChanged(); void lineEditChanged();
void comboBoxChanged(); void comboBoxChanged();
...@@ -113,7 +113,6 @@ private: ...@@ -113,7 +113,6 @@ private:
QString m_filter; QString m_filter;
bool m_showComboBox; bool m_showComboBox;
bool m_lock; bool m_lock;
QString m_currentPath;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment