I just want to display the filenames in the QStringList
I don't believe you can do that.
To stay in one directory and only offer a passed-in list of filenames is not the job for a QFileDialog. You might just as well just present the user with a list of those filenames to pick from, and you don't need to bother showing a directory because you don't want the user to change it or navigate elsewhere.
@JonB Yep, I've just found that I need to wait for loading page before printing and the solution is connect loadFinished signal to method I need, that do printToPdf() in it. I thought that WebEngineView does not need to wait for the local html file to load, but it was mistaken.
UPD: Also, I've found a way to print multiple pdfs. You need to make a QEventLoop obj, connect loadFinished signal to QEventLoop::quit and after setHtml just call loop.exec() and you can guarantee that file you need will load and prints correctly only after loading of the previous page code.
class MyClass : public QObject
MyClass::MyClass(QObject *parent ): QObject(parent)
webView = new QWebEngineView();
connect(webView, &QWebEngineView::loadFinished, &loop, &QEventLoop::quit);
// Load your html code..
webView->setHtml(html); // html - string of one page
// Modify name for another file
webView->setHtml(html1); // html1 - string of another page
It's not perfect solution, but I think you understand the idea