April 23, 2012

developer developer
Lab Rat
95 posts

[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

  1. #ifndef TAB_H
  2. #define TAB_H
  3.  
  4. #include <QWidget>
  5. #include "mainwindow.h"
  6. #include "webview.h"
  7. #include <QHBoxLayout>
  8. class MainWindow;
  9. class tab : public QWidget
  10. {
  11.     Q_OBJECT
  12. public:
  13.     tab(MainWindow *parent = 0);
  14.    
  15. signals:
  16.    
  17. public slots:
  18.     void loadurl(QString url);
  19. private:
  20.     webview * view;
  21.     QHBoxLayout * layout;
  22. };
  23.  
  24. #endif // TAB_H

tab.cpp:
  1. #include "tab.h"
  2.  
  3. tab::tab(MainWindow *parent) :
  4.     QWidget(parent)
  5. {
  6.     view = new webview(this);
  7.     layout = new QHBoxLayout(this);
  8.     layout->addWidget(view);
  9. }
  10. void tab::loadurl(QString url)
  11. {
  12.     view->loadurl(url);
  13. }

webview is a QWebView sub class
really strange error but i am sure any body nows the solution

6 replies

April 23, 2012

Volker Volker
Ant Farmer
5331 posts

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?

April 24, 2012

developer developer
Lab Rat
95 posts

  1. #ifndef WEBVIEW_H
  2. #define WEBVIEW_H
  3.  
  4. #include <QWebView>
  5. #include <QWebFrame>
  6. #include <QMenu>
  7. #include "tab.h"
  8. class tab;
  9. class webview : public QWebView
  10. {
  11.     Q_OBJECT
  12. private slots:
  13. public:
  14.     webview(tab *parent = 0);
  15.    
  16. signals:
  17.     void tabcloserequested();
  18. public slots:
  19.     void loadurl(QString url);
  20.     void customContextMenuRequested(const QPoint &pos);
  21. protected:
  22.     QWebView * createWindow(QWebPage::WebWindowType type);
  23. };
  24.  
  25. #endif // WEBVIEW_H

[Edit: Added @ tags around code; mlong]

April 24, 2012

developer developer
Lab Rat
95 posts

i think this is suffeicient

April 25, 2012

Volker Volker
Ant Farmer
5331 posts

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

April 26, 2012

fcrochik fcrochik
Lab Rat
447 posts

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

 Signature 

Certified Specialist & Qt Ambassador Maemo, Meego, Symbian, Playbook, RaspberryPi, Desktop… Qt everywhere!

April 26, 2012

developer developer
Lab Rat
95 posts

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

 
  ‹‹ Simple Encryption/Decryption in QWebView      [Solved] Advice needed: Reload page on "F5" ››

You must log in to post a reply. Not a member yet? Register here!