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. screenCountChanged signal does not trigger second time when three monitors are used

screenCountChanged signal does not trigger second time when three monitors are used

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 536 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.
  • Z Offline
    Z Offline
    Ziga
    wrote on last edited by Ziga
    #1

    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++;
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      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
      • Z Offline
        Z Offline
        Ziga
        wrote on last edited by
        #3

        I have tried also with Qt 5.11.1 and the behaviour hasn't changed. The bug still persists.

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

          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 ?

          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