本文整理汇总了C++中QDesktopWidget::physicalDpiY方法的典型用法代码示例。如果您正苦于以下问题:C++ QDesktopWidget::physicalDpiY方法的具体用法?C++ QDesktopWidget::physicalDpiY怎么用?C++ QDesktopWidget::physicalDpiY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDesktopWidget
的用法示例。
在下文中一共展示了QDesktopWidget::physicalDpiY方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rendererForUuid
PDFRenderer* PDFRenderer::rendererForUuid(const QUuid &uuid, const QString &filename, bool importingFile)
{
if (sRenderers.contains(uuid))
{
return sRenderers.value(uuid);
}
else
{
PDFRenderer *newRenderer = new XPDFRenderer(filename,importingFile);
newRenderer->setRefCount(0);
newRenderer->setFileUuid(uuid);
QFile file(filename);
file.open(QIODevice::ReadOnly);
newRenderer->setFileData(file.readAll());
file.close();
sRenderers.insert(newRenderer->fileUuid(), newRenderer);
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
newRenderer->setDPI(dpiCommon);
return newRenderer;
}
}
示例2: UBExportAdaptor
UBExportFullPDF::UBExportFullPDF(QObject *parent)
: UBExportAdaptor(parent)
{
//need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mScaleFactor = 72.0f / dpiCommon;
}
示例3: mShowButtons
UBAbstractDrawRuler::UBAbstractDrawRuler()
: mShowButtons(false)
, mAntiScaleRatio(1.0)
{
//we actually need to evaluate pixels per millimeter
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
sPixelsPerMillimeter = qRound(dpiCommon / UBGeometryUtils::inchSize);
}
示例4: persistsDocument
bool UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QString& filename)
{
QPrinter pdfPrinter;
qDebug() << "exporting document to PDF" << filename;
pdfPrinter.setOutputFormat(QPrinter::PdfFormat);
pdfPrinter.setResolution(UBSettings::settings()->pdfResolution->get().toInt());
pdfPrinter.setOutputFileName(filename);
pdfPrinter.setFullPage(true);
//need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
float scaleFactor = 72.0f / dpiCommon;
QPainter pdfPainter;
bool painterNeedsBegin = true;
int existingPageCount = pDocumentProxy->pageCount();
for(int pageIndex = 0 ; pageIndex < existingPageCount; pageIndex++)
{
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex);
UBApplication::showMessage(tr("Exporting page %1 of %2").arg(pageIndex + 1).arg(existingPageCount));
// set background to white, no crossing for PDF output
bool isDark = scene->isDarkBackground();
bool isCrossed = scene->isCrossedBackground();
scene->setBackground(false, false);
QSize pageSize = scene->nominalSize();
// set high res rendering
scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::NonScreen);
//setting page size to appropriate value
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point);
if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter);
//render to PDF
scene->render(&pdfPainter, QRectF(), scene->normalizedSceneRect());
if (pageIndex < existingPageCount - 1) pdfPrinter.newPage();
//restore screen rendering quality
scene->setRenderingContext(UBGraphicsScene::Screen);
scene->setRenderingQuality(UBItem::RenderingQualityNormal);
//restore background state
scene->setBackground(isDark, isCrossed);
}
if(!painterNeedsBegin) pdfPainter.end();
return true;
}
示例5: setup
void PrintLayout::setup()
{
QDesktopWidget *desktop = QApplication::desktop();
screenDpiX = desktop->physicalDpiX();
screenDpiY = desktop->physicalDpiY();
printerDpi = printer->resolution();
pageRect = printer->pageRect();
scaleX = (qreal)printerDpi/(qreal)screenDpiX;
scaleY = (qreal)printerDpi/(qreal)screenDpiY;
}
示例6: setup
void PrintLayout::setup()
{
QDesktopWidget *desktop = QApplication::desktop();
screenDpiX = desktop->physicalDpiX();
screenDpiY = desktop->physicalDpiY();
printerDpi = printer->resolution();
pageRect = printer->pageRect();
// a printer page in pixels
pageW = pageRect.width();
pageH = pageRect.height();
}
示例7: setup
void PrintLayout::setup()
{
QDesktopWidget *desktop = QApplication::desktop();
screenDpiX = desktop->physicalDpiX();
screenDpiY = desktop->physicalDpiY();
printerDpi = printer->resolution();
pageRect = printer->pageRect();
scaleX = (qreal)printerDpi/(qreal)screenDpiX;
scaleY = (qreal)printerDpi/(qreal)screenDpiY;
// a printer page scalled to screen DPI
scaledPageW = pageRect.width() / scaleX;
scaledPageH = pageRect.height() / scaleY;
}
示例8: QGraphicsRectItem
UBGraphicsCompass::UBGraphicsCompass()
: QGraphicsRectItem()
, mResizing(false)
, mRotating(false)
, mDrawing(false)
, mShowButtons(false)
, mSpanAngleInDegrees(0)
, mDrewCircle(false)
, mCloseSvgItem(0)
, mResizeSvgItem(0)
, mAntiScaleRatio(1.0)
, mDrewCenterCross(false)
{
setRect(sDefaultRect);
//TODO claudio: remove code duplication
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mPixelsPerMillimeter = qRound(dpiCommon / 25.4f);
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
setAcceptsHoverEvents(true);
mCloseSvgItem = new QGraphicsSvgItem(":/images/closeTool.svg", this);
mCloseSvgItem->setVisible(false);
mCloseSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
mResizeSvgItem = new QGraphicsSvgItem(":/images/resizeCompass.svg", this);
mResizeSvgItem->setVisible(false);
mResizeSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
updateResizeCursor();
updateDrawCursor();
unsetCursor();
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly
setFlag(QGraphicsItem::ItemIsSelectable, false);
connect(UBApplication::boardController, SIGNAL(penColorChanged()), this, SLOT(penColorChanged()));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(lineWidthChanged()));
}
示例9: UBPageBasedImportAdaptor
UBImportPDF::UBImportPDF(QObject *parent)
: UBPageBasedImportAdaptor(parent)
{
QDesktopWidget* desktop = UBApplication::desktop();
this->dpi = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
}