Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue with QVBoxLayout while adding a QWebEngineView and QQuickView
Forum Updated to NodeBB v4.3 + New Features

Issue with QVBoxLayout while adding a QWebEngineView and QQuickView

Scheduled Pinned Locked Moved General and Desktop
qwebengineview
1 Posts 1 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ejos
    wrote on last edited by p3c0
    #1

    I am trying to create e-reader with pages displayed by QWebEngineView and toolbar written in QML and displayed using QQuickView.

    Main.cpp

    include <QVBoxLayout>
    #include <QDesktopWidget>
    #include <toolbar.h>
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QDesktopWidget dw;
        WebEngineView *weView = new WebEngineView();
        weView->setGeometry(0,55,dw.width(),(dw.height()));
        QQuickView view;
        view.setSource(QUrl("qrc:/ReaderToolBar.qml"));
        view.setGeometry(0,0,dw.width(),50);
        view.setMinimumHeight(50);
        view.setMaximumHeight(50);
        QVBoxLayout *lay = new QVBoxLayout();
        lay->addWidget(QWidget::createWindowContainer(&view));
        lay->addWidget(weView);
        QWidget *wid = new QWidget();
        wid->setLayout(lay);
        wid->resize(dw.width(),dw.height());
        wid->show();
        return app.exec();
    }
    

    WebEngineView.qml

    #include "WebEngineView.h"
    WebEngineView::WebEngineView()
    {
    this->setUrl(QUrl("http://www.google.co.in"));
    }
    

    ReaderToolBar.qml

    import QtQuick 2.0
    
    Rectangle {
        id: tbrect
        width: 1200
        height: 50
        color: "transparent"
        visible: true
    
        MouseArea {
            anchors.fill: parent
            hoverEnabled: true
        }
    
        function showicons()
        {     
            libicon.visible = true
            tocicon.visible = true
       }
    Image {
            id: libicon
            x: 30
            smooth: true
            height: 36
            width: 36
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 8
            source: "qrc:/images/library.png"
            visible: true
    
            MouseArea {
                id: libiconma
                anchors.fill: parent
                onClicked: {
                    //rw.showlibrary()
                }
            }
        }
    
        Image {
            id: tocicon
            x: 90
            smooth: true
            height: 50
            width: 50
            anchors.bottom: parent.bottom
            //anchors.bottomMargin: 2
            source: "qrc:/images/toc.png"
            visible: true
    
            MouseArea {
                anchors.fill: parent
                onClicked: {
                    //rw.showtocinwebview();         
                }
            }
    Component.onCompleted: showicons()
    }
    

    Here the WebEngineView alone is displayed and the tool bar is not getting displayed.
    Let me know what I am missing so that tool bar is superimposed on the webenginview

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved