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. How should i do to make a qwidget cover qvulkanwindow
Forum Updated to NodeBB v4.3 + New Features

How should i do to make a qwidget cover qvulkanwindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 31 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.
  • C Offline
    C Offline
    ctrkalk
    wrote last edited by
    #1

    I want to use a qvulkanwindow to show someting rendered by vulkan.And create a qwidget which cover that vulkanwindow,to deal some Qt event like mousemove or keyboard.And add some sub window into that widget such as Game inventory like minecraft.
    but is does not work.i make sure that when i add single widget or single qwidget pointer create by QWdiget::createWindowContainer,they will pretty good.but when i try to combine them,the pointer always occur all area on the top surface of application,and the widget doesn‘t show.
    how can i do to deal it?
    that is the basic code for test:
    main.cpp:

    #include <QApplication>
    #include <QMainWindow>
    #include <QPushButton>
    #include <iostream>
    #include "code.h"
    #include "PGW.h"
    using namespace std;
    
    int main(int argc, char* argv[]) {
        QApplication a(argc, argv);
        code c = code();
        c.show();
        return a.exec();
    
        // RenderPass();
    }
    

    code.cpp:

    #include "code.h"
    #include <QPushButton>
    #include <iostream>
    #include <QDebug>
    #include <QVulkanWindow>
    #include <QVulkanInstance>
    #include "PGW.h"
    //#include "render.h"
    using namespace std;
    code::code() {
        this->setGeometry(0,0,1000,1000);
      
    
       QWindow* a = new QWindow();
        QWidget* b = QWidget::createWindowContainer(a, this);
        b->setGeometry(0,0,1000,1000);
        QWidget* w = new QWidget(this);
        w->setGeometry(0, 0, 100, 100);
        w->setStyleSheet("background-color: red;");
        w->raise();
        w->show();
    }
    code::~code()
    {
    }
    

    this is the header file(code.h):

    #pragma once
    #include <QMainWindow>
    
    class code : public QWidget {
        Q_OBJECT
    
    public:
        code();
        ~code();
    };
    

    the red widget object doesn`t show,whever what i try to codeing.

    Pl45m4P 1 Reply Last reply
    0
    • C ctrkalk

      I want to use a qvulkanwindow to show someting rendered by vulkan.And create a qwidget which cover that vulkanwindow,to deal some Qt event like mousemove or keyboard.And add some sub window into that widget such as Game inventory like minecraft.
      but is does not work.i make sure that when i add single widget or single qwidget pointer create by QWdiget::createWindowContainer,they will pretty good.but when i try to combine them,the pointer always occur all area on the top surface of application,and the widget doesn‘t show.
      how can i do to deal it?
      that is the basic code for test:
      main.cpp:

      #include <QApplication>
      #include <QMainWindow>
      #include <QPushButton>
      #include <iostream>
      #include "code.h"
      #include "PGW.h"
      using namespace std;
      
      int main(int argc, char* argv[]) {
          QApplication a(argc, argv);
          code c = code();
          c.show();
          return a.exec();
      
          // RenderPass();
      }
      

      code.cpp:

      #include "code.h"
      #include <QPushButton>
      #include <iostream>
      #include <QDebug>
      #include <QVulkanWindow>
      #include <QVulkanInstance>
      #include "PGW.h"
      //#include "render.h"
      using namespace std;
      code::code() {
          this->setGeometry(0,0,1000,1000);
        
      
         QWindow* a = new QWindow();
          QWidget* b = QWidget::createWindowContainer(a, this);
          b->setGeometry(0,0,1000,1000);
          QWidget* w = new QWidget(this);
          w->setGeometry(0, 0, 100, 100);
          w->setStyleSheet("background-color: red;");
          w->raise();
          w->show();
      }
      code::~code()
      {
      }
      

      this is the header file(code.h):

      #pragma once
      #include <QMainWindow>
      
      class code : public QWidget {
          Q_OBJECT
      
      public:
          code();
          ~code();
      };
      

      the red widget object doesn`t show,whever what i try to codeing.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote last edited by Pl45m4
      #2

      @ctrkalk

      Try

      QWidget* w = new QWidget(b); // instead of this
      

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ctrkalk
        wrote last edited by
        #3

        @Pl45m4 i do that,and also dosen`t work.

        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