我一直在使用MinGW,我不得不做的就是将臭名昭着的输出复制到32位libmysql.dll文件到可执行文件所在的位置:
QSqlDatabase:未加载MYSQL驱动程序
QSqlDatabase:可用的驱动程序:QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
现在我正在尝试使用MSVS2017 64位编译器编译我的应用程序。我试图使用32位和64位<style type="text/css">
html, body, #map_canvas {
margin: 0;
padding: 0;
height: 100%;
}
#map_canvas {
width : 770px;
height : 400px;
}
</style>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>-->
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false&key=AIzaSyDESxPrtya1459HVTiokw-zjaZkmgaGhe8"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
/*
* Use bindTo to allow dynamic drag of markers to refresh poly.
*/
function MVCArrayBinder(mvcArray) {
this.array_ = mvcArray;
}
MVCArrayBinder.prototype = new google.maps.MVCObject();
MVCArrayBinder.prototype.get = function (key) {
if (!isNaN(parseInt(key))) {
return this.array_.getAt(parseInt(key));
} else {
this.array_.get(key);
}
}
MVCArrayBinder.prototype.set = function (key, val) {
if (!isNaN(parseInt(key))) {
this.array_.setAt(parseInt(key), val);
} else {
this.array_.set(key, val);
}
}
/**
* Handles click events on a map, and adds a new point to the Polyline.
* @param {MouseEvent} mouseEvent
*/
function addLatLng(event) {
var path = poly.getPath();
path.push(event.latLng);
var len = path.getLength();
var marker = new google.maps.Marker({
position: event.latLng,
title: '#' + len,
map: map,
//draggable: true
});
marker.bindTo('position', poly.binder, (len - 1).toString());
}
var poly;
var map;
function initialize(locations_map, address_latlong) {
//alert('dsdsd');
var latlong = address_latlong.split('-');
var polyOptions = {
strokeColor: '#000000',
strokeOpacity: 1.0,
strokeWeight: 3, map: map
};
poly = new google.maps.Polygon(polyOptions);
var bounds = new google.maps.LatLngBounds();
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(latlong[0], latlong[1]),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
//mapTypeIds: ['satellite', 'nearmap']
mapTypeIds: ['satellite']
},
});
var locations = locations_map;
poly.binder = new MVCArrayBinder(poly.getPath());
var arr_data = new Array();
//alert(locations.length);
for (var i = 0; i < locations.length; i++) {
var evt = {};
evt.latLng = new google.maps.LatLng(locations[i][0], locations[i][1]);
//console.log(evt.latLng);
bounds.extend(evt.latLng);
addLatLng(evt);
}
poly.setMap(map);
map.fitBounds(bounds);
google.maps.event.addListener(map, 'click', function (evt) {
});
}
function show_modal_map(id) {
get_map_data(id);
}
function load_modal(locations_map, address_latlong) {
jQuery('#mapModal').modal({
backdrop: 'static',
keyboard: false
}).on('shown.bs.modal', function () {
jQuery(".modal-backdrop").attr('style', 'display:none;');
jQuery(".modal-backdrop").removeClass('fade');
jQuery(".modal-backdrop").removeClass('show');
initialize(locations_map, address_latlong);
google.maps.event.trigger(map, "resize");
var latlong = address_latlong.split('-');
var center = new google.maps.LatLng(latlong[0], latlong[1]);
map.setCenter(center);
}).on("hidden.bs.modal", function() {
//alert('sdsd');
jQuery("#map_canvas").html('');
});
}
//google.maps.event.addDomListener(window, "load", initialize);
jQuery(document).ready(function () {
//var center = new google.maps.LatLng(10.9386, -84.888);
});
function get_map_data(quote_id) {
//alert('sdsdsd');
var data = {};
data.id = quote_id;
data.action = 'WCP_Quote_Controller::get_map_data';
jQuery.ajax({
type: "POST",
url: '/wp-admin/admin-ajax.php',
data: data,
dataType: 'json',
success: function (response) {
var address_latlong = response.address_latlong;
var locations_map = new Array();
var markers_data = response.markers_latlong_data;
if (markers_data != '') {
var count = 1;
var markers = markers_data.split('#');
for (var n = 0; n < markers.length; n++) {
var lat_long_data = markers[n].split('*');
locations_map.push([lat_long_data[0], lat_long_data[1], count]);
count++;
}
//locations_map.push([lat_long_data[0], lat_long_data[1], count]);
}
console.log('Get Locations');
console.log(locations_map);
load_modal(locations_map, address_latlong);
}
});
}
/*jQuery("#mapModal").on("hidden.bs.modal", function() {
alert('sdsd');
jQuery("#map_canvas").html('');
});*/
</script>
<!-- <div id="map_canvas"></div>-->
<div id="mapModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content" style="width: auto !important;height: 500px !important;"> <!-- style="width: auto !important;height: 500px !important;" --->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<!-- <h4 class="modal-title">Map</h4>-->
</div>
<div class="modal-body">
<div id="map_canvas"></div>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>-->
</div>
</div>
</div>
文件,但没有运气 - 我收到警告,QSqlDatabase无法打开。我找到了这个网站:https://wiki.qt.io/How_to_load_a_sql_driver_correctly但它似乎已经过时且含糊不清。任何已知的问题解决方案?
答案 0 :(得分:0)
使用MSVS,您需要qsqlmysql4.dll
,通常需要从源代码构建MySQL驱动器,您可以按Qt documentation How to Build the QMYSQL Plugin on Windows进行操作。