Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Qurl

    General and Desktop
    qurl tabs winows tabs qurl google
    3
    6
    679
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      BridgerMiles last edited by BridgerMiles

      How do I open multiple windows using QURL I currently have it set so when I click one button it opens a tab using the default browser. When I click the second button it opens another tab in the same Google chrome window. How do I make it so the second button opens the tab in a new chrome window. I don't want it to use the window that's already open.

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @BridgerMiles last edited by

        @BridgerMiles
        QUrl (https://doc.qt.io/qt-5/qurl.html) in itself just handles URLs, it does not "open windows". Before we can answer whether you can achieve what you ask, tell us what code you have where you are using these QUrls and how you "open" them?

        B 1 Reply Last reply Reply Quote 1
        • B
          BridgerMiles @JonB last edited by

          @JonB QDesktopServices::openUrl("www.google.com");
          QDesktopServices::openUrl("www.facebook.com");
          is Cody's executed Google opens in the first tab and Facebook opens in the second. I needed to open Google in one chrome window and Facebook and another chrome window.

          JonB 1 Reply Last reply Reply Quote 0
          • JonB
            JonB @BridgerMiles last edited by JonB

            @BridgerMiles
            I don't think you're going to be able to make openUrl() open a new window, rather than its default of a new tab.... I don't see it allows target=, and anyway I don't think that would help, it seems to be doing equivalent of target="_blank" already. It's really down to how your browser is set up, I think you'll find your Chrome browser is set to do new tabs rather than new windows, unless you change that there's nothing openUrl() can do to alter that behaviour.

            B 1 Reply Last reply Reply Quote 1
            • B
              BridgerMiles @JonB last edited by

              @JonB ok thank you do you have any links or resources I can look into to find a way to make this work.

              1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion last edited by

                Hi
                Alternatively, you could use QProcess and start it with

                    QString program = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
                    QStringList arguments;
                    arguments << "--new-window" << "https://forum.qt.io";
                    QProcess chromeProcess;
                    if ( ! chromeProcess.startDetached(program, arguments) ) {
                        qDebug() << "error" << chromeProcess.errorString();
                    }
                
                1 Reply Last reply Reply Quote 2
                • First post
                  Last post