void MonitorSettingDialog::onMonitorResolutionSelected(const int index)
{
    const bool intersect = m_primary && m_model->monitorsIsIntersect();

    if (intersect)
    {
        const ResolutionList modeList = m_model->monitorsSameModeList();
        Q_ASSERT(modeList.size() > index);
        const Resolution mode = modeList[index];

        for (Monitor* mon : m_model->monitorList()) {
            const ResolutionList& list = mon->modeList();
            for (auto it = list.cbegin(); it != list.cend(); ++it) {
                if (it->width() == mode.width() && it->height() == mode.height()) {
                    Q_EMIT requestSetMonitorResolution(mon, it->id());
                    break;
                }
            }
        }
    } else {
        const auto modeList = m_monitor->modeList();
        Q_ASSERT(modeList.size() > index);

        Q_EMIT requestSetMonitorResolution(m_monitor, modeList[index].id());
    }
}
bool contains(const QList<Resolution> &container, const Resolution &item)
{
    for (auto r : container)
        if (r.width() == item.width() && r.height() == item.height())
            return true;

    return false;
}