Dynamically add QWebEngineView to layout

haxscramper

I'm trying to dynamically QWebEngineView to already existing layout.

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QWebEngineView view;
    view.setUrl(QUrl(QStringLiteral("http://www.qt.io")));
    view.resize(1024, 750);
    view.show();
    ui->splitter->addWidget(view);  
}

When running this i'm getting error: C2664: 'void QSplitter::addWidget(QWidget *)': cannot convert argument 1 from 'QWebEngineView' to 'QWidget *'

I'm trying to create program for previewing and editing html/text/image files in local file system. This means that i need to switch widget in main window for different tasks. In my designer form I have splitter layout in which I'm trying to add QWebEngineView.

I tried default examples from Qt Designer for WebEngine and WebKit. They work just as planned but instead of using UI layout they are using only code for adding and managing widgets. I want to use form layouts, which means that this option is not suited for me.

How i can fix this issue ? Is this viable solution for what i'm trying to achieve or there is a better one ?

Marco

Try this way:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QWebEngineView *view;
    view = new QWebEngineView(this);
    view->setUrl(QUrl(QStringLiteral("http://www.qt.io")));
    view->resize(1024, 750);
    view->show();
    ui->splitter->addWidget(view);  
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Dynamically add layout to another layout

From Dev

Dynamically add element to layout

From Dev

How to add the layout dynamically

From Dev

Add a TextView dynamically in a layout ANDROID

From Dev

Add a layout dynamically, to overlapp the other layout

From Dev

Dynamically add Layout after some layout?

From Dev

How to dynamically add ImageView to layout using Adapter

From Dev

Dynamically add content to layout in MVC4

From Dev

How to add this type of layout dynamically (android)

From Dev

How to add 2 fragments dynamically in a single layout?

From Dev

Add Buttons to Relative Layout Dynamically or Extended Linear Layout android

From Dev

Add Buttons to Relative Layout Dynamically or Extended Linear Layout android

From Dev

Android: How to dynamically add a "Custom View" into a linear layout

From Dev

Add EditText to another LinearLayout from non children layout dynamically

From Dev

Row cannot add dynamically using code to Table Layout in Android

From Dev

Add nodes dynamically to a D3 Tree layout request (on toggle)

From Dev

Dynamically add custom layout to ArrayList based on data from excel file

From Dev

how can i add and remove element dynamically from linear layout?

From Dev

How to add relative Layout below some element dynamically

From Dev

how to add controls dynamically to table layout panel from panel

From Dev

how to add to layout dynamically with multiple RelativeLayout.LayoutParams

From Dev

How do I add a LinearLayoutCompat view to an existing xml layout dynamically?

From Dev

How to add row dynamically in table layout or How to show full db Records in single table Layout

From Dev

Dynamically setting Yii layout

From Dev

Set layout params dynamically

From Dev

Updating layout part dynamically

From Dev

WPF Make layout dynamically

From Dev

change Auto Layout dynamically

From Dev

Dynamically setting the table layout

Related Related

  1. 1

    Dynamically add layout to another layout

  2. 2

    Dynamically add element to layout

  3. 3

    How to add the layout dynamically

  4. 4

    Add a TextView dynamically in a layout ANDROID

  5. 5

    Add a layout dynamically, to overlapp the other layout

  6. 6

    Dynamically add Layout after some layout?

  7. 7

    How to dynamically add ImageView to layout using Adapter

  8. 8

    Dynamically add content to layout in MVC4

  9. 9

    How to add this type of layout dynamically (android)

  10. 10

    How to add 2 fragments dynamically in a single layout?

  11. 11

    Add Buttons to Relative Layout Dynamically or Extended Linear Layout android

  12. 12

    Add Buttons to Relative Layout Dynamically or Extended Linear Layout android

  13. 13

    Android: How to dynamically add a "Custom View" into a linear layout

  14. 14

    Add EditText to another LinearLayout from non children layout dynamically

  15. 15

    Row cannot add dynamically using code to Table Layout in Android

  16. 16

    Add nodes dynamically to a D3 Tree layout request (on toggle)

  17. 17

    Dynamically add custom layout to ArrayList based on data from excel file

  18. 18

    how can i add and remove element dynamically from linear layout?

  19. 19

    How to add relative Layout below some element dynamically

  20. 20

    how to add controls dynamically to table layout panel from panel

  21. 21

    how to add to layout dynamically with multiple RelativeLayout.LayoutParams

  22. 22

    How do I add a LinearLayoutCompat view to an existing xml layout dynamically?

  23. 23

    How to add row dynamically in table layout or How to show full db Records in single table Layout

  24. 24

    Dynamically setting Yii layout

  25. 25

    Set layout params dynamically

  26. 26

    Updating layout part dynamically

  27. 27

    WPF Make layout dynamically

  28. 28

    change Auto Layout dynamically

  29. 29

    Dynamically setting the table layout

HotTag

Archive