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. Black flicker areas resizing Direct3D11 widget in Qt 5.6
Forum Updated to NodeBB v4.3 + New Features

Black flicker areas resizing Direct3D11 widget in Qt 5.6

Scheduled Pinned Locked Moved Unsolved General and Desktop
directxqt 5.6.0openglwin32painting
1 Posts 1 Posters 1.4k Views
  • 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.
  • G Offline
    G Offline
    Goombert
    wrote on 5 Jun 2016, 08:04 last edited by Goombert 6 May 2016, 08:05
    #1

    I am creating a GUI application with Qt 5.6 and using a custom Direct3D11 widget. I've followed the examples from the official Qt blog:
    https://blog.qt.io/blog/2016/01/28/qt-and-direct3d-12-first-encounter/
    And someone else's blog for Qt 4:
    http://blog.jholewinski.org/direct3d-11-with-qt-4/index.html

    While resizing my widget I get black areas:
    enter image description here
    This does not occur with QGraphicsView where the resize is flawless with no stretching.

    I've tried various combination of widget attributes that have not solved it:

    this->setAttribute(Qt::WA_OpaquePaintEvent, true);
    this->setAttribute(Qt::WA_PaintOnScreen, true);
    this->setAttribute(Qt::WA_DontCreateNativeAncestors, true);
    this->setAttribute(Qt::WA_NativeWindow, true);
    this->setAttribute(Qt::WA_NoSystemBackground, true);
    this->setAttribute(Qt::WA_MSWindowsUseDirect3D, true);
    this->setAutoFillBackground(false);
    

    I've also tried handling WM_ERASEBKGND:

    bool D3D11Widget::nativeEvent(const QByteArray& eventType, void *msg, long *result) {
        MSG *message = static_cast<MSG *>( msg );
    
        switch (message->message) {
        case WM_ERASEBKGND:
    	    qDebug() << "erase background\n";
    	    *result = 1L;
    	    return TRUE;
        }
    
        return QWidget::nativeEvent(eventType, message, result);
    }
    

    The only way I've managed to get rid of the flicker was to set DXGI_SCALING_STRETCH in my swap chain. However, the stretching while resizing is undesirable and does not appear in QGraphicsView. So how is it that QGraphicsView resizes without any of this flickering and how can I do the same?

    1 Reply Last reply
    0

    1/1

    5 Jun 2016, 08:04

    • Login

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