Add "browse" button using Qt's file browser to settings dialog

This commit is contained in:
Sky 2013-10-05 02:02:47 +01:00
parent 1dee4bb60d
commit 932376c6e0
3 changed files with 26 additions and 8 deletions

View File

@ -189,3 +189,12 @@ void SettingsDialog::on_pushButton_clicked()
ui->javaPathTextBox->setText(paths.at(0));
}
void SettingsDialog::on_btnBrowse_clicked()
{
QString dir = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
if(!dir.isNull())
{
ui->javaPathTextBox->setText(dir);
}
}

View File

@ -55,6 +55,8 @@ private slots:
void on_pushButton_clicked();
void on_btnBrowse_clicked();
private:
Ui::SettingsDialog *ui;
};

View File

@ -379,26 +379,33 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="javaPathTextBox"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="labelJVMArgs">
<property name="text">
<string>JVM arguments:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="1" column="3">
<widget class="QPushButton" name="btnBrowse">
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="javaPathTextBox"/>
</item>
<item row="2" column="1" colspan="3">
<widget class="QLineEdit" name="jvmArgsTextBox"/>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Auto-detect</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="jvmArgsTextBox"/>
</item>
</layout>
</widget>
</item>