QDesktopServices openUrl doesnt work compiled



  • Hello

    Hope someone can help me.

    I made a Gui with a pushbutton, and added the slot _clicked() to it. when i run the hole thing from mvsc -> f5, it works fine. But when i try to click on the button when i started the compiled exe itself, it gives me the following error:

    alt text

    I even tried to run the windeployqt.exe to get all libs ect, but it didnt helped.

    What im missing?


  • Lifetime Qt Champion

    Hi,

    What button are you clicking ? What is it supposed to do ?



  • hi

    Its just a push-button that i dragged over with the qt creator.

    Whats supposed todo is open the url:

    void Test::on_pushButton_6_clicked()
    {
        QString link = "http://google.com/";
        QDesktopServices::openUrl(QUrl(link));
    }
    
    

    As said, when i press F5 in VS, it works fine. but when i start the exe manually, it fails to open the url and shows that msg


  • Lifetime Qt Champion

    Looks like a chrome error. Can you try again changing your default navigator temporarily ?



  • This post is deleted!


  • idk how it could be a chorme error when it works inside vc :O

    Anyway, i tried and changed default browser to edge, and it works then.

    Anything i can do to get it working for chrome too?



  • @Aroc You aren't doing anything wrong. Your code is fine.

    I would try reinstalling chrome. I had a similar issue (non-coding related) the other day when using a new browser Vivaldi.

    Every time I set it to handle URLs as default it would crash when applications tried using it. After setting my defaults back to microsoft, rebooting, then resetting vivaldi to handle all it's defaults, it works now.

    So you are probably just experiencing a windows/chrome integration issue like I was with vivaldi.

    Microsoft does this on purpose I think.. they hate when people use anything that isn't IE/Edge. ;)

    Oh and as far as I know there is nothing in Qt's handling of the desktop services that changes what it sends to an application from debug vs release mode. You can of course look at Qt's code if you're truly curious.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.