Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5994797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:52:07+00:00 2026-05-22T23:52:07+00:00

EDIT 4 All this while I was thinking that it is the markers problem,

  • 0

EDIT 4

All this while I was thinking that it is the markers problem, that they do not get dragged!
Now I have realized, that NO mouse click works on the map when it is displayed in Qt widget.

The following code, I pasted in an HTML file and opened through Firefox, this worked flawlessly! and the same doesn’t respond when I click on the map on QtWidget :rolleyes:

Can anyone confirm this for me or tell me what wrong I am doing?

Google Maps JavaScript API Example

<script type="text/javascript"> 

var map;    
var latlng            = new google.maps.LatLng (34.7607233, -117.0107599);

var directionsDisplay = new google.maps.DirectionsRenderer ();;
var directionsService = new google.maps.DirectionsService ();

var pointsArray       = new Array();
var arrayToBeReturned = new Array();

function initialize ()
{
    var myOptions = 
    {
        zoom:8,
        center:latlng,
        mapTypeId:google.maps.MapTypeId.ROADMAP
    };

    map = new google.maps.Map (document.getElementById ("map"), myOptions);
    directionsDisplay.setMap (map); 

    google.maps.event.addListener (map, "click", function ()
                        {
                            alert("You clicked the map.");
                        });
    }

</script> 
</head>
<body onload="initialize()" topmargin="0" leftmargin="0">
<div id="map" style="width: 341px; height: 271px"></div>
<div id="directionsPanel" style="float:right;width:30%;height 100%"></div>
</body>
</html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:52:08+00:00Added an answer on May 22, 2026 at 11:52 pm

    Found the solution:

    Add this class in the source file where you are “loading” the HTML file (containing Javascript API) in the Qt widget.

    class myWebPage : public QWebPage
    {
        virtual QString userAgentForUrl(const QUrl& url) const {
            return "Chrome/1.0";
        }
    };
    

    Then in your own class in the same source file, add the setPage function call as shown below and see the magic happen!

    MainScreen::MainScreen(QWidget *parent):QWidget(parent)
    {
            ...
        ***map->setPage (new myWebPage());***
        map->load (QUrl("./index.html") ) ;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function to edit all fields that come from the form and
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
EDIT: I have fixed all but two warnings now, so thank you all for
General Problem I have some objects that have some variables that are not known
EDIT I've just started skimming Codd's famous 1970 paper that started it all, that
[EDIT]Whoops there was a mistake in the code, and now all the responses to
Is the edit control I'm typing in now, with all its buttons and rules
I have a form that a user would fill out while creating a ticket
EDIT 2009-Nov-04 OK, so it's been a little while since I first posted this
I have written a chart that displays financial data. Performance was good while I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.