You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, April 9th 2013, 7:56am

QWebView is not displayed in maximized window

Hi,

I am trying to launch some url in QWebView, but it always launching in minimized state.

i mean if i maximise my parent window, the QWebView window is not getting maximized instead it is opening with scroll bar.

following is my code.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <QMainWindow>
#include <QWidget>
#include<QWebView>

class MainWindow : public QMainWindow
{
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    QWidget *basewindow;
    QWebView *qWebView;
};

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    w.show();
    
    return a.exec();
}

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{

        basewindow = new QWidget;
        basewindow->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

        setCentralWidget(basewindow);

        qWebView = new QWebView(basewindow);
        QString url = tr("http://www.facebook.com");

        qWebView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        qWebView->load(QUrl(url));
        qWebView->resize(this->size());
        qWebView->show();

}


.

This post has been edited 1 times, last edit by "qyog" (Apr 9th 2013, 8:06am) with the following reason: corrected spellings