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

How do I check external monitor resolution?



  • I don't see any classes that allow me to check external monitor resolutions. I have an embedded project where I need to let the user know if they plug in an external monitor that can't support the resolution our application requires. Can I do this with Qt?



  • Hi @graniteDev ,
    you can get screens list
    and use geometry() method to get height and width



  • Thankyou, that worked well. You wouldn't happen to know how to get the screenAdded() and screenRemoved() signals to actually work would you? I've tried plugging in and unplugging the second monitor but the signal is never sent



  • @graniteDev I have never did that yet, and can't try right now.
    Could you show your code please ?



  • @LeLev

    DesktopManager::DesktopManager(QGuiApplication *qga, QObject *parent)
        : QObject(parent),
    {
        m_guiApplication = qga;
        connect(m_guiApplication, &QGuiApplication::screenAdded, this, &DesktopManager::checkScreenCount);
        connect(m_guiApplication, &QGuiApplication::screenRemoved, this, &DesktopManager::checkScreenCount);
    
    }
    .
    .
    .
    .
    void DesktopManager::checkScreenCount()
    {
        qDebug() << "screen count changed";
    }
    

Log in to reply