I am trying to implement finding text in a TextEdit. I have written my own dialog to do this, and i got it to return the right string. Whenever i call find on the QTextEdit it never finds what im looking for. Here is my code for the find.

Qt Code:
  1. void VashTextEditor::find()
  2. {
  3. FindDialog findDialog(this);
  4. if (!findDialog.exec())
  5. return;
  6.  
  7. const QString searchString = findDialog.getSearchString();
  8. bool test = documentEdit->find(searchString);
  9.  
  10. if (test)
  11. {
  12. QMessageBox::information(this, tr("Vash Text Editor"), tr("Expression found."));
  13. }
  14. else
  15. {
  16. QMessageBox::information(this, tr("Vash Text Editor"), tr("Expression not found."));
  17. }
  18. }
To copy to clipboard, switch view to plain text mode 

Here is the code for my FindDialog

Qt Code:
  1. #include <QtGui>
  2.  
  3. #include "finddialog.h"
  4.  
  5. FindDialog::FindDialog(QWidget *parent)
  6. : QDialog(parent)
  7. {
  8. setupUi(this);
  9.  
  10. findButton->setEnabled(false);
  11.  
  12. connect(findButton, SIGNAL(clicked()), this, SLOT(accept()));
  13. connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
  14. connect(findLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(toggleFindButton()));
  15.  
  16. }
  17.  
  18. QString FindDialog::getSearchString()
  19. {
  20. return findLineEdit->text();
  21. }
  22.  
  23. void FindDialog::toggleFindButton()
  24. {
  25. QString currentText = findLineEdit->text();
  26.  
  27. if (!currentText.isEmpty())
  28. {
  29. findButton->setEnabled(true);
  30. }
  31. else
  32. {
  33. findButton->setEnabled(false);
  34. }
  35. }
To copy to clipboard, switch view to plain text mode 

Maybe im missing something simple. Any help would be appreciated. And if more code is needed feel free to ask and I will gladly post it for you.