QDebug operator<<(QDebug dbg, const KScreen::ModePtr &mode) { if (mode) { dbg << "KScreen::Mode(Id:" << mode->id() << ", Size:" << mode->size() << "@" << mode->refreshRate() << ")"; } else { dbg << "KScreen::Mode(NULL)"; } return dbg; }
int QMLOutput::currentOutputWidth() const { if (!m_output) { return 0; } KScreen::ModePtr mode = m_output->currentMode(); if (!mode) { if (m_output->isConnected()) { mode = bestMode(); if (!mode) { return 1000; } m_output->setCurrentModeId(mode->id()); } else { return 1000; } } return mode->size().width(); }
static bool sizeBiggerThan(const KScreen::ModePtr &modeA, const KScreen::ModePtr &modeB) { QSize sizeA = modeA->size(); QSize sizeB = modeB->size(); return sizeA.width() * sizeA.height() > sizeB.width() * sizeB.height(); }
QString modeToString(KScreen::ModePtr mode) { // mode->name() can be anything, not just widthxheight. eg if added with cvt. return QString("%1x%2").arg(mode->size().width()).arg(mode->size().height()); }