Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QWindowsContext::windowsProc: No Qt Window found for event



  • Hello,

    I built an Qt for Python application. Unfortunately I have quite a lot of warnings (see below) during execution:

    QWindowsContext::windowsProc: No Qt Window found for event 0x1c (WM_ACTIVATEAPP), hwnd=0x0x90e72.
    QWindowsContext::windowsProc: No Qt Window found for event 0x46 (WM_WINDOWPOSCHANGING), hwnd=0x0x90e72.
    QWindowsContext::windowsProc: No Qt Window found for event 0x83 (WM_NCCALCSIZE), hwnd=0x0x90e72.
    

    Does anyone has an idea what could cause this warnings. I can not really give an example, since the application is too huge and do not know what to show.
    Sometime, when we open a popup window, the application is sent to the back, so is not visible anymore. It is basically minimized. Is it possible that there is a correlation to the warnings?
    Sometimes the app also does not start. Just loading for a few seconds and it is closed again. Very strange behavior.

    We are using python 3.7 and pyside2 5.12.1. However, the warnings also occur with python 3.6 and older qt versions.

    As I said, would be great, if I could get some hints on what might cause such warnings and the problems?

    Thanks
    Daniel


  • Lifetime Qt Champion

    Hi
    Searching for bugs i found
    https://bugreports.qt.io/browse/QTBUG-26933
    should be fixed.
    https://bugreports.qt.io/browse/QTBUG-32588
    which seems to be related to QDesktopWidget

    So not sure what else would cause such warning.

    Seems to be related to child windows.

    where does these warning show ?



  • @mrjj
    Thanks for your fast reply. I start the application from console and they are prompted there.
    Yes, I think it is realted to child windows. New warnings are added when I switch to another application (any program) and go back to my program, or when I open a popup and switch back to the main window.

    I did not use the Class QDesktopWidget. So no clue


  • Lifetime Qt Champion

    @Dagginio
    Did you use nativeEvent filter or anything like that ?



  • @mrjj
    No, no event filter. I use a splash screen (app logo with a progress bar) during startup while the application load some data. This splash screen is not my main window of course. After disabling the splash screen, the warnings disappear. Any idea on that? I could imagine that it has something to do with window modality.

    However, the problem that the application is send to background remains. For instance, when executing a message box, the main window is sent to background. Really strange. I thought there might be a link to the warnings but obviously there is not. But I think this is new and came with the last qt update. Will downgrade to 5.11.x to see if the behavior is there the same.


  • Lifetime Qt Champion

    Hi,

    Can you show how you handle your splash screen ?



  • @SGaist

    from PySide2 import QtWidgets, QtCore
    
    class WidgetInitLoading(QtWidgets.QWidget):
        def __init__(self):
            super().__init__()
    
            self.setWindowFlags(QtCore.Qt.SplashScreen)
            self.setFixedWidth(400)
            self.setFixedHeight(400)
    
            self.setStyleSheet("WidgetInitLoading {"
                               "background-color: white;}")
    
            self.setWindowModality(QtCore.Qt.ApplicationModal)
    
    class WidgetWithLogoAndProgressBar(WidgetInitLoading):
        def __init__(self, app):
            super().__init__()
            self.verticalLayout = self.createVerticalLayout()
            self.verticalLayout.setContentsMargins(20,20,20,20)
            self.setLayout(self.verticalLayout)
    
            self.verticalLayout.addSpacing(20)
            self.labelWithPixmap = self.createLabelWithPixmap()
            self.verticalLayout.addWidget(self.labelWithPixmap)
    
            spacer = SpacerItem(None, None)
            self.verticalLayout.addSpacerItem(spacer)
    
            self.statusLabel = self.createStatusLabel()
            self.verticalLayout.addWidget(self.statusLabel)
    
            self.progressBar = self.createProgressBar()
            self.verticalLayout.addWidget(self.progressBar)
            spacer = SpacerItem(None, None)
            self.verticalLayout.addSpacerItem(spacer)
    
            app.processEvents()
    
    
        def createVerticalLayout(self):
            verticalLayout = QtWidgets.QVBoxLayout()
            return verticalLayout
    
        def createLabelWithPixmap(self):
            labelWithPixmap = LabelWithPixmap(None, None, None, ":/logoLoading.png")
            return labelWithPixmap
    
        def createStatusLabel(self):
            label = QtWidgets.QLabel()
            label.setAlignment(QtCore.Qt.AlignCenter)
            return label
    
        def createProgressBar(self):
            progressBar = ProgressBar()
            return progressBar
    
    

    Just downgraded to PySide2 5.11.2. There I do not have the problem that the app is send to the back. However, the warnings are back, also with disabled splash screen.

    Daniel



  • Actually the warnings are not nice but also not that big problem if everything seems work fine. However, that the app is sent to the back for instance by executing a message box is really a problem. This is only on 5.12.1/0, not on 5.11.x. Thus it seems to be a bug.

    Daniel


  • Lifetime Qt Champion

    Looks like there's some kind regression indeed.

    Out of curiosity, why not use QSplashScreen ?



  • I testet now PyQt5 (5.12.1) instead of PySide2 (5.12.1). Also with PyQt5, the app is sent sometimes to the back. This was not the case for Qt 5.11.x. Is it possible, that this a Qt bug?


  • Lifetime Qt Champion

    Since both have the same behavior, that's likely the case.

    You should take a look at the bug report system to see if it's something known. If not, please open a new report providing a minimal complete example project.


Log in to reply