Runtime Error после добавления карт в Qt приложение

259
16 января 2018, 13:09

Добавил карты в приложение через 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))
    }
}
Answer 1

Удаление Microsoft Visual Studio 2017 помогает.

READ ALSO
Как отключить предупреждение &ldquo;multiple definition of symbol&rdquo;

Как отключить предупреждение “multiple definition of symbol”

Изучаю работу редактора связей и специально для этого написал программу, в которой два раза появляется один и тот же символХочу посмотреть...

304
Как перемещать карту во время события pressAndHold в Qt приложении

Как перемещать карту во время события pressAndHold в Qt приложении

Есть программа, которая передаёт широту и долготу в "Line Edit", но при этом утрачивается возможность перемещать картуКак мне сделать так, чтобы...

197
Android java. Проблема при скроле

Android java. Проблема при скроле

Всем доброго времени сутокВывожу список постов через RecyclerView, и при быстром скроле вниз или вверх, миниатюры постов путаются между собой

226
Видимость Button&#39;a при написании текста в editText

Видимость Button'a при написании текста в editText

Когда я пишу текст в EditText(multiline) - проподают кнопки ,но после окончания писания кнопки снова появляются

223