[Solved] 'webivew' does not name a type



  • i am creating a project and a strange error occured
    'webivew' does not name a type
    in this source code:
    tab.h
    @#ifndef TAB_H
    #define TAB_H

    #include <QWidget>
    #include "mainwindow.h"
    #include "webview.h"
    #include <QHBoxLayout>
    class MainWindow;
    class tab : public QWidget
    {
    Q_OBJECT
    public:
    tab(MainWindow *parent = 0);

    signals:

    public slots:
    void loadurl(QString url);
    private:
    webview * view;
    QHBoxLayout * layout;
    };

    #endif // TAB_H
    @
    tab.cpp:
    @#include "tab.h"

    tab::tab(MainWindow *parent) :
    QWidget(parent)
    {
    view = new webview(this);
    layout = new QHBoxLayout(this);
    layout->addWidget(view);
    }
    void tab::loadurl(QString url)
    {
    view->loadurl(url);
    }
    @
    webview is a QWebView sub class
    really strange error but i am sure any body nows the solution



  • what's in your webview.h header file? Is it actually included or do you happen do have a duplicated double-include guard in it?



  • @
    #ifndef WEBVIEW_H
    #define WEBVIEW_H

    #include <QWebView>
    #include <QWebFrame>
    #include <QMenu>
    #include "tab.h"
    class tab;
    class webview : public QWebView
    {
    Q_OBJECT
    private slots:
    public:
    webview(tab *parent = 0);

    signals:
    void tabcloserequested();
    public slots:
    void loadurl(QString url);
    void customContextMenuRequested(const QPoint &pos);
    protected:
    QWebView * createWindow(QWebPage::WebWindowType type);
    };

    #endif // WEBVIEW_H
    @

    [Edit: Added @ tags around code; mlong]



  • i think this is suffeicient



  • This doesn't look suspicious to me. Can you prepare a small, self contained project that just demonstrates the error?



  • Have you tried to comment out the #ifndef line on your webview.h just to make sure?
    The exact/complete output of the compilation would also help



  • the problem has been solved the problem was because webview requires tab and tab requires webview so there will be error now i have done something different thanks all


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.