diff --git a/examples/xmlpatterns/filetree/mainwindow.cpp b/examples/xmlpatterns/filetree/mainwindow.cpp
index cec700674966de6f9c970d88b85121947d807c54..9bf71cd609b14878555b4c911e45e9b68dce4675 100644
--- a/examples/xmlpatterns/filetree/mainwindow.cpp
+++ b/examples/xmlpatterns/filetree/mainwindow.cpp
@@ -81,9 +81,9 @@ MainWindow::MainWindow() : m_fileTree(m_namePool)
 //! [0]
 
 //! [2]
-void MainWindow::on_queryBox_currentIndexChanged()
+void MainWindow::on_queryBox_currentIndexChanged(const QString &currentText)
 {
-    QFile queryFile(":/queries/" + queryBox->currentText());
+    QFile queryFile(":/queries/" + currentText);
     queryFile.open(QIODevice::ReadOnly);
 
     queryEdit->setPlainText(QString::fromLatin1(queryFile.readAll()));
diff --git a/examples/xmlpatterns/filetree/mainwindow.h b/examples/xmlpatterns/filetree/mainwindow.h
index 5b39be5c3f76122841acd2b89d1914cb936fb386..aaaec9a8114cef2f8058be0b9f212f3fff8c478a 100644
--- a/examples/xmlpatterns/filetree/mainwindow.h
+++ b/examples/xmlpatterns/filetree/mainwindow.h
@@ -58,7 +58,7 @@ public:
 private slots:
     void on_actionOpenDirectory_triggered();
     void on_actionAbout_triggered();
-    void on_queryBox_currentIndexChanged();
+    void on_queryBox_currentIndexChanged(const QString &);
 
 private:
     void loadDirectory(const QString &directory);