基本上代码的目标是在单击按钮后打开一个包含 QWebView (带有一些内容)的对话框
这就是我所做的:
主窗口.h:
class MainWindow : public QMainWindow, public Ui::MainWindowUi
{
...
private slots:
void on_ViewDatabase_clicked();
...
}
主窗口.cpp:
#include "mainwindow.h"
#include "onlinedb.h"
void MainWindow::on_ViewDatabase_clicked()
{
OnlineDB dlg(this);
dlg.exec();
}
在线数据库.h:
#ifndef OnlineDB_H
#define OnlineDB_H
#include "ui_onlinedb.h"
#include <QDialog>
class MainWindow;
class OnlineDB : public QDialog, public Ui::OnlineDB
{
Q_OBJECT
public:
OnlineDB(LkMainWindow *parent);
~OnlineDB();
private:
MainWindow *MainWindow;
};
#endif
在线数据库.cpp:
#include "onlinedb.h"
#include "mainwindow.h"
///////////////////////////////////////////////////////////////////////////////
//
// OnlineDB class constructor
//
// Create a OnlineDB
//
OnlineDB::OnlineDB(MainWindow *parent) : QDialog(parent), MainWindow(parent)
{
setupUi(this);
QUrl url("http://google.com"); //whatever
webView->load(url);
}
///////////////////////////////////////////////////////////////////////////////
//
// OnlineDB class destructor
//
// Clean up the OnlineDB
//
OnlineDB::~OnlineDB()
{
}
我有几个链接错误
请问有人可以帮忙吗?
3>Linking...
3>onlinedb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebView::load(class QUrl const &)" (__imp_?load@QWebView@@QAEXABVQUrl@@@Z) referenced in function "public: __thiscall OnlineDB::OnlineDB(class LkMainWindow *)" (??0OnlineDB@@QAE@PAVLkMainWindow@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall OnlineDB::metaObject(void)const " (?metaObject@OnlineDB@@UBEPBUQMetaObject@@XZ)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall OnlineDB::qt_metacast(char const *)" (?qt_metacast@OnlineDB@@UAEPAXPBD@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall OnlineDB::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@OnlineDB@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
3>onlinedb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWebView::setUrl(class QUrl const &)" (__imp_?setUrl@QWebView@@QAEXABVQUrl@@@Z) referenced in function "public: void __thiscall Ui_OnlineDB::setupUi(class QDialog *)" (?setupUi@Ui_OnlineDB@@QAEXPAVQDialog@@@Z)
3>onlinedb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWebView::QWebView(class QWidget *)" (__imp_??0QWebView@@QAE@PAVQWidget@@@Z) referenced in function "public: void __thiscall Ui_OnlineDB::setupUi(class QDialog *)" (?setupUi@Ui_OnlineDB@@QAEXPAVQDialog@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QWebView::metaObject(void)const " (?metaObject@QWebView@@UBEPBUQMetaObject@@XZ)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QWebView::qt_metacast(char const *)" (?qt_metacast@QWebView@@UAEPAXPBD@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QWebView::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QWebView@@UAEHW4Call@QMetaObject@@HPAPAX@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall QWebView::event(class QEvent *)" (?event@QWebView@@UAE_NPAVQEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual class QSize __thiscall QWebView::sizeHint(void)const " (?sizeHint@QWebView@@UBE?AVQSize@@XZ)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mousePressEvent(class QMouseEvent *)" (?mousePressEvent@QWebView@@MAEXPAVQMouseEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseReleaseEvent(class QMouseEvent *)" (?mouseReleaseEvent@QWebView@@MAEXPAVQMouseEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseDoubleClickEvent(class QMouseEvent *)" (?mouseDoubleClickEvent@QWebView@@MAEXPAVQMouseEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::mouseMoveEvent(class QMouseEvent *)" (?mouseMoveEvent@QWebView@@MAEXPAVQMouseEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::wheelEvent(class QWheelEvent *)" (?wheelEvent@QWebView@@MAEXPAVQWheelEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::keyPressEvent(class QKeyEvent *)" (?keyPressEvent@QWebView@@MAEXPAVQKeyEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::keyReleaseEvent(class QKeyEvent *)" (?keyReleaseEvent@QWebView@@MAEXPAVQKeyEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::focusInEvent(class QFocusEvent *)" (?focusInEvent@QWebView@@MAEXPAVQFocusEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::focusOutEvent(class QFocusEvent *)" (?focusOutEvent@QWebView@@MAEXPAVQFocusEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::paintEvent(class QPaintEvent *)" (?paintEvent@QWebView@@MAEXPAVQPaintEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::resizeEvent(class QResizeEvent *)" (?resizeEvent@QWebView@@MAEXPAVQResizeEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::contextMenuEvent(class QContextMenuEvent *)" (?contextMenuEvent@QWebView@@MAEXPAVQContextMenuEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragEnterEvent(class QDragEnterEvent *)" (?dragEnterEvent@QWebView@@MAEXPAVQDragEnterEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragMoveEvent(class QDragMoveEvent *)" (?dragMoveEvent@QWebView@@MAEXPAVQDragMoveEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dragLeaveEvent(class QDragLeaveEvent *)" (?dragLeaveEvent@QWebView@@MAEXPAVQDragLeaveEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::dropEvent(class QDropEvent *)" (?dropEvent@QWebView@@MAEXPAVQDropEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::changeEvent(class QEvent *)" (?changeEvent@QWebView@@MAEXPAVQEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall QWebView::inputMethodEvent(class QInputMethodEvent *)" (?inputMethodEvent@QWebView@@MAEXPAVQInputMethodEvent@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "public: virtual class QVariant __thiscall QWebView::inputMethodQuery(enum Qt::InputMethodQuery)const " (?inputMethodQuery@QWebView@@UBE?AVQVariant@@W4InputMethodQuery@Qt@@@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QWebView::focusNextPrevChild(bool)" (?focusNextPrevChild@QWebView@@MAE_N_N@Z)
3>onlinedb.obj : error LNK2001: unresolved external symbol "protected: virtual class QWebView * __thiscall QWebView::createWindow(enum QWebPage::WebWindowType)" (?createWindow@QWebView@@MAEPAV1@W4WebWindowType@QWebPage@@@Z)
3>onlinedb.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWebView::~QWebView(void)" (__imp_??1QWebView@@UAE@XZ) referenced in function "public: virtual void * __thiscall QWebView::`scalar deleting destructor'(unsigned int)" (??_GQWebView@@UAEPAXI@Z)