How to put an icon on file extensions of a Qt program on Windows Explorer

141 views Asked by At

Here is the program. On the Web I found:

QSettings reg("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\.sp\\DefaultIcon",
                 QSettings::NativeFormat);
reg.setValue("Default", "C:\\Users\\Tomy\\Desktop\\package_directory"
               "\\packages\\com.vendor.product\\data\\Spreadsheet.ico");

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);

I put this in void MainWindow::writeSettings() and void MainWindow::readSettings() in the code. And then created an installer using Qt Installer Framework and installed it on Windows.
No icon! Any idea?

EDIT:
I this time removed the code above from both void MainWindow::readSettings() and void MainWindow::writeSettings() functions and added it to the MainWindow's constructor body, then re-did the rest and installed that new on my Windows.
Again, no changes in result.
There might be a problem either in the code or the script file. I'm using Qt 5.9.

0

There are 0 answers