Some more debug around this dpi stuff

remotes/origin/KDE/4.13
Albert Astals Cid 12 years ago
parent 4c4825a2a8
commit 48b711002e
  1. 4
      core/document.cpp
  2. 11
      core/utils.cpp

@ -936,7 +936,9 @@ bool DocumentPrivate::openDocumentInternal( const KService::Ptr& offer, bool iss
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
m_generator->setDPI(Utils::realDpi(m_widget)); const QSizeF dpi = Utils::realDpi(m_widget);
kDebug() << "Output DPI:" << dpi;
m_generator->setDPI(dpi);
bool openOk = false; bool openOk = false;
if ( !isstdin ) if ( !isstdin )

@ -79,6 +79,7 @@ double Utils::realDpiX()
{ {
const QDesktopWidget* w = QApplication::desktop(); const QDesktopWidget* w = QApplication::desktop();
if (w->width() > 0 && w->widthMM() > 0) { if (w->width() > 0 && w->widthMM() > 0) {
kDebug() << "Pix:" << w->width() << "MM:" << w->widthMM();
return (double(w->width()) * 25.4) / double(w->widthMM()); return (double(w->width()) * 25.4) / double(w->widthMM());
} else { } else {
return dpiX(); return dpiX();
@ -89,6 +90,7 @@ double Utils::realDpiY()
{ {
const QDesktopWidget* w = QApplication::desktop(); const QDesktopWidget* w = QApplication::desktop();
if (w->height() > 0 && w->heightMM() > 0) { if (w->height() > 0 && w->heightMM() > 0) {
kDebug() << "Pix:" << w->height() << "MM:" << w->heightMM();
return (double(w->height()) * 25.4) / double(w->heightMM()); return (double(w->height()) * 25.4) / double(w->heightMM());
} else { } else {
return dpiY(); return dpiY();
@ -148,10 +150,17 @@ QSizeF Utils::realDpi(QWidget* widgetOnScreen)
kDebug() << "Output is vertical, transposing DPI rect"; kDebug() << "Output is vertical, transposing DPI rect";
res.transpose(); res.transpose();
} }
kDebug() << "Output DPI is " << res;
return res; return res;
} }
} }
else
{
kDebug() << "Didn't find a KScreen selectedOutput to calculate DPI. Falling back";
}
}
else
{
kDebug() << "Didn't find a KScreen config to calculate DPI. Falling back";
} }
#endif #endif
} }

Loading…
Cancel
Save