Hello there, I've coded a bestiary in C++ that allows users to enter in their own monsters and then access those monsters stats through a database but I am having trouble implementing the search functionality in Qt .
Qt Code:
  1. string search;
  2. int stop(0);
  3. getline (cin, search);
  4. ifstream File ("creatures.txt");
  5. if(File.is_open())
  6. {
  7. string line;
  8. int curLine = 0;
  9. while(getline(File, line))
  10. {
  11. curLine++;
  12.  
  13. if(line.find(search,0)!=string::npos)
  14. {
  15. for(int line_num = 0; line_num = curLine; line_num++)
  16. {
  17.  
  18. if(getline(File, line) && (line_num == curLine))
  19.  
  20. {
  21. stop++;
  22. if (stop==16)
  23. break;
  24. cout<<line<< "\n";
  25. }
  26. else
  27.  
  28. break;
To copy to clipboard, switch view to plain text mode 
This code is supposed to allow the user to enter in the name of a monster and then return its stat block and basically i just want the user to do the same thing in Qt except they type the name into a line edit and the stat block appears in another box close by but i cannot figure out what the equivalent code would be to do this in qt so any help would be appreciated.