我正在尝试将MarbleWidget集成到QT项目中。如果我只想显示这样的小部件:
Marble::MarbleWidget *mapWidget = new Marble::MarbleWidget();
mapWidget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
mapWidget->show()
一切都好。但是我想做的是将小部件集成到现有窗口中。我所做的是我使用QtDesigner添加了一个小部件,将该小部件升级为Marble :: MarbleWidget,然后使用以下代码:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->widget = new Marble::MarbleWidget();
ui->widget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
ui->setupUi(this);
}
我可以看到小部件,但没有地图:
并且我在控制台上看到以下错误:
QObject::connect: No such signal MarbleWebView::titleChanged(QString) in ~/marble/sources/src/lib/marble/PopupItem.cpp:71
QObject::connect: (sender name: 'webView')
QObject::connect: (receiver name: 'titleText')
QObject::connect: No such signal MarbleWebView::urlChanged(QUrl) in ~/marble/sources/src/lib/marble/PopupItem.cpp:72
QObject::connect: (sender name: 'webView')
QObject::connect: No such signal MarbleWebView::titleChanged(QString) in ~/marble/sources/src/lib/marble/PopupItem.cpp:71
QObject::connect: (sender name: 'webView')
QObject::connect: (receiver name: 'titleText')
QObject::connect: No such signal MarbleWebView::urlChanged(QUrl) in ~/marble/sources/src/lib/marble/PopupItem.cpp:72
QObject::connect: (sender name: 'webView')
我做错了什么?
最佳答案
凯文说的。从代码角度来看
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->widget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
}
关于c++ - 将MarbleWidget添加到QT的主窗口中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39596953/