Tadas
18th September 2010, 13:55
Hi,
I'm trying to recreate these tutorials:
http://labs.qt.nokia.com/2008/07/03/putting-qtwebkit-to-use-with-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)
#ifndef MAP_H
#define MAP_H
#include <QWebView>
class map : public QWebView
{
Q_OBJECT
public:
explicit map(QWidget *parent = 0);
signals:
public slots:
};
#endif // MAP_H
and source file map.cpp with class
#include "map.h"
#include "ui_mainwindow.h"
map::map(QWidget *parent) :
QWebView(parent)
{
}
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
untitled1.pro
QT += core gui
TARGET = untitled1
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
map.cpp
HEADERS += mainwindow.h \
map.h
FORMS += mainwindow.ui
QT+= network \
xml\
webkit
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.
I'm trying to recreate these tutorials:
http://labs.qt.nokia.com/2008/07/03/putting-qtwebkit-to-use-with-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)
#ifndef MAP_H
#define MAP_H
#include <QWebView>
class map : public QWebView
{
Q_OBJECT
public:
explicit map(QWidget *parent = 0);
signals:
public slots:
};
#endif // MAP_H
and source file map.cpp with class
#include "map.h"
#include "ui_mainwindow.h"
map::map(QWidget *parent) :
QWebView(parent)
{
}
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
untitled1.pro
QT += core gui
TARGET = untitled1
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
map.cpp
HEADERS += mainwindow.h \
map.h
FORMS += mainwindow.ui
QT+= network \
xml\
webkit
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.