Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. [QTest][GUI] Is possible to show and set window's background?
Forum Updated to NodeBB v4.3 + New Features

[QTest][GUI] Is possible to show and set window's background?

Scheduled Pinned Locked Moved Unsolved Game Development
2 Posts 2 Posters 552 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
    EsmeraldaQuintero
    wrote on last edited by EsmeraldaQuintero
    #1

    Hi!

    I found QTest useful for DirectX compute shader's output test, but for that purpose I need a fully initialized windows.

    I tried in several ways but it seems like I'm unable to create a simple QMainWindow.

    Main.CPP

    #include "DirectX11TestShader.h"
    
    QTEST_MAIN(DirectX11TestShader)
    

    TestScreen.H

    class TestScreen : public QMainWindow
    {
        Q_OBJECT
    public:
    };
    

    DirectX11TestShader.H

    class DirectX11TestShader: public QObject
    {
        Q_OBJECT
    private slots:
        void initTestCase();
    private:
        TestScreen mScreen;
    };
    

    DirectX11TestShader.CPP

    #include "DirectX11TestShader.h"
    
    void DirectX11TestShader::initTestCase()
    {
        mScreen.show();
        mScreen.setStyleSheet("background-color: black;");
    }
    

    This windows is always shown white, and my test always throw DXGI_ERROR_DEVICE_REMOVED / DXGI_ERROR_DEVICE_HUNG. The code is working ok in normal workflow only in QTest is failing.

    I want to guarantee the window creation, what can I do?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you try to use qWaitForWindowExposed ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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