screenCountChanged signal does not trigger second time when three monitors are used
-
Hi
I created minimal application in Qt 5.9.1 (tried also Qt 5.11.1) (Windows 10). It does only one thing - it connects screenCountChanged event to a slot.
Then I monitored the number of screens detected, when slot was called.
When I use only two monitors, everything works fine when I disconnect and reconnect one of them. But when I use three, the slot is called only once - the first time. It does not matter if I first connect or disconnect the third monitor, first time it is triggered ok. When I connect or disconnect it again, the slot is not called anymore.
Is this a Qt bug or I don't use it correctly.
Edit:
I pasted the code bellow. I put the breakpoint to screenCountChanged_slot() just to monitor when the slot is called and run the code in the debugger:dummyWidget.h
#include <QtWidgets/QMainWindow> #include "ui_dummyWidget.h" class dummyWidget : public QMainWindow { Q_OBJECT public: dummyWidget(QWidget *parent = Q_NULLPTR); private: Ui::dummyWidgetClass ui; public slots: void screenCountChanged_slot(int newScreenCount); };
dummyWidget.cpp
#include "dummyWidget.h" #include "QApplication" #include "QDesktopWidget" dummyWidget::dummyWidget(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screenCountChanged_slot(int))); } void dummyWidget::screenCountChanged_slot(int newScreenCount) { static int i = 0; i++; }
-
Hi and welcome to devnet,
Your zip is not accessible.
In any case, you should consider updating to the latest version of the 5.9 series if not 5.11 to check whether the behaviour has changed in between.
-
In that case, you should check the bug report system to see if there's anything related. If not, then please consider creating a new report providing your example as well as your complete system specification.
By the way, what graphics card are you using ?