Results 1 to 5 of 5

Thread: How to Promote QWebview (Custom widget)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    22
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60

    Default How to Promote QWebview (Custom widget)

    Hi,

    I'm trying to recreate these tutorials:
    http://labs.qt.nokia.com/2008/07/03/...h-google-maps/
    http://efforts.embedded.ufcg.edu.br/qt/?p=80

    There is one thing I cant understand, how to promote QWebview.

    I make identical class, project file, I only make custom Ui. but then I add QWebView to Ui, I can't promote it. Do I need edit mainwindow.ui manually ? as far as I know, this file is generated automatically by Qt Gui designer.
    For example, I create Header file map.h (I will add functionality later)
    Qt Code:
    1. #ifndef MAP_H
    2. #define MAP_H
    3. #include <QWebView>
    4. class map : public QWebView
    5. {
    6. Q_OBJECT
    7. public:
    8. explicit map(QWidget *parent = 0);
    9. signals:
    10. public slots:
    11. };
    12. #endif // MAP_H
    To copy to clipboard, switch view to plain text mode 
    and source file map.cpp with class
    Qt Code:
    1. #include "map.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. map::map(QWidget *parent) :
    5. QWebView(parent)
    6. {
    7. }
    To copy to clipboard, switch view to plain text mode 

    then in UI designer "mainwindow.ui" I add QWebview Widget, Reneame Object name to "map", then I click on it right mouse button, but I can't see "Promote to" option.

    other project files
    mainwindow.h
    Qt Code:
    1. #ifndef MAINWINDOW_H
    2. #define MAINWINDOW_H
    3. #include <QMainWindow>
    4. namespace Ui {
    5. class MainWindow;
    6. }
    7. class MainWindow : public QMainWindow
    8. {
    9. Q_OBJECT
    10. public:
    11. explicit MainWindow(QWidget *parent = 0);
    12. ~MainWindow();
    13. private:
    14. Ui::MainWindow *ui;
    15. };
    16.  
    17. #endif // MAINWINDOW_H
    To copy to clipboard, switch view to plain text mode 

    mainwindow.cpp
    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. MainWindow::MainWindow(QWidget *parent) :
    5. QMainWindow(parent),
    6. ui(new Ui::MainWindow)
    7. {
    8. ui->setupUi(this);
    9. }
    10.  
    11. MainWindow::~MainWindow()
    12. {
    13. delete ui;
    14. }
    To copy to clipboard, switch view to plain text mode 
    untitled1.pro
    Qt Code:
    1. QT += core gui
    2.  
    3. TARGET = untitled1
    4. TEMPLATE = app
    5.  
    6.  
    7. SOURCES += main.cpp\
    8. mainwindow.cpp \
    9. map.cpp
    10.  
    11. HEADERS += mainwindow.h \
    12. map.h
    13.  
    14. FORMS += mainwindow.ui
    15. QT+= network \
    16. xml\
    17. webkit
    To copy to clipboard, switch view to plain text mode 

    If I try to add promoted widget manually from menu "Promoted widgets..." in drop box "base class name:" I cant see QWebView

    Thank you in advice.
    Last edited by Tadas; 18th September 2010 at 14:12.

Similar Threads

  1. code for promote to
    By andreime in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2009, 15:18
  2. how to promote layout in Designer?
    By homerli in forum Qt Tools
    Replies: 1
    Last Post: 11th May 2009, 16:40
  3. promote to...
    By uygar in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2007, 09:07
  4. How Could I promote Qt's Drawing performance?
    By joeshow in forum Qt Programming
    Replies: 5
    Last Post: 11th September 2007, 18:04
  5. promote the contents of a dockwidget!
    By notsonerdysunny in forum Qt Tools
    Replies: 1
    Last Post: 30th July 2007, 05:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.