Multiple requests in the same method
-
@Chris-Kawa Playing around I noticed that I needed extra information on my
searchmethod, two more arguments asQString. The thing is that I will be needing that two extra arguments later in another method/slot.More or less like this:
search>processJson>processProductsI will need the extra arguments in the
processProducts.The option I thought was:
1 - store the values passed to
searchin a member and get later in another method.Is there a better alternative for that?
-
If one instance of your class does only one search at a time then sounds like a reasonable thing to store the extra state as members. No point in complicating things.
-
@Chris-Kawa I have a few more questions:
The searcher will also be a downloader.
The idea behind this application is that the user can search for a product and the product will appear in a tree view. I will explain the tree view.
I want to do something like this:
1 - The user fills a line edit with the product he wants to search and press the search button.
2 - A new tab will be created in theQTabWidgetwith a tree view and an instance of theSearcher.
3 - When the search is done andSearcheremits a signal that the search is done I want to display the results in a tree view.
4 - The results thatSearcherwill return is a collection ofProducts, a struct with a few information such as the name, color and other information, but the most important one, it will have a link to a zip file.
5 - I want to create a button on the tree view that is calledDownloadin eachProductwhich contains the zip link.
6 - When the user clicks on that button I want to download that zip file and get the file names and put as children to the download clicked item on the tree view.For me its kinda complicated, any ideas of what I can do to archive that?

The
Product Bhas a zip link so it will have a download button on the tree view. Imagine that the user clicked on the button, it downloaded the zip file, got its the file names and put as children forProductB.