Hello to all! Interested in solving this issue. There is a code:
QString path = QApplication::applicationDirPath() + "/readme/1.pdf"; Next, I use the check for the existence of a file.
if(!File::exists(path)) { QMessageBox msgBox; msgBox(trUtf8("Невозможно открыть файл") + path + trUtf8(" Файл не существует!")); msgBox.setIcon(QMessageBox::Warning); msgBox.exec(); } File launch:
QDesktopServices::openUrl(QUrl(path, QUrl::TolerantMode)); And now the question ... How to check if there is no program to open the file on the computer? Now, if there is no program, a window is displayed. Windows could not open the file: Search for a match on the Internet, Selecting a program from the list of installed programs. I want to make it so that MessageBox would be displayed if the program with which the file can be opened is not installed on the computer. Check in style:
if(!QDesktopServices::openUrl(QUrl(path, QUrl::TolerantMode))) Does not help. Displayed 2nd same window as above, with Windows, ie, they become 2.