Добавил карты в приложение через QQuickWidget и тут Runtime Error.
Пометил в коде, что добавил комментарием - ////добавил и после этого возникла ошибка.
src.pro :
QT += core gui sql
QT += quickwidgets positioning ////добавил и после этого возникла ошибка.
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = src
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
login.cpp \
mainwindow.cpp
HEADERS += \
login.h \
mainwindow.h
FORMS += \
login.ui \
mainwindow.ui
RESOURCES += \
resource.qrc
mainwindow.cpp :
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "login.h"
#include <QQmlContext>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->quickWidget->rootContext()->setContextProperty("lineEdit", ui->lineEdit); //добавил и после этого возникла ошибка.
Login conn;
if(!conn.connOpen())
ui->label_sec_status->setText("Не удачная попытка открыть базу ecologydatabase");
else
ui->label_sec_status->setText("База подключена...");
}
MainWindow::~MainWindow()
{
delete ui;
}
places_map.qml :
import QtQuick 2.0
import QtLocation 5.6
import QtPositioning 5.6
Rectangle {
id: rect
Plugin {
id: mapPlugin
name: "osm" // "mapboxgl", "esri", ...
// specify plugin parameters if necessary
// PluginParameter {
// name:
// value:
// }
}
Map {
id: map
anchors.fill: parent
plugin: mapPlugin
center: QtPositioning.coordinate(59.91, 10.75) // Oslo
zoomLevel: 14
}
MouseArea{
anchors.fill: parent
onClicked: lineEdit.text = ""+ map.toCoordinate(Qt.point(mouse.x,mouse.y))
}
}
Удаление Microsoft Visual Studio 2017 помогает.
Сборка персонального компьютера от Artline: умный выбор для современных пользователей