本文整理汇总了C++中QSizeF::setHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizeF::setHeight方法的具体用法?C++ QSizeF::setHeight怎么用?C++ QSizeF::setHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizeF
的用法示例。
在下文中一共展示了QSizeF::setHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: size
QSizeF CanvasSize::size(SizeUnits unit) const
{
QSizeF result;
result.setWidth( toPixels(m_size.width(), m_resolution.width(), m_size_unit, m_resolution_unit) );
result.setHeight( toPixels(m_size.height(), m_resolution.height(), m_size_unit, m_resolution_unit) );
if (unit != Pixels)
{
result.setWidth( fromPixels(result.width(), m_resolution.width(), unit, m_resolution_unit) );
result.setHeight( fromPixels(result.height(), m_resolution.height(), unit, m_resolution_unit) );
}
return result;
}
示例2: physicalScreenSizeFromFb
QSizeF EglUtils::physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize)
{
#ifndef Q_OS_LINUX
Q_UNUSED(framebufferDevice)
#endif
const int defaultPhysicalDpi = 100;
static QSizeF size;
if (size.isEmpty()) {
// Note: in millimeters
int width = qEnvironmentVariableIntValue("GREENISLAND_QPA_PHYSICAL_WIDTH");
int height = qEnvironmentVariableIntValue("GREENISLAND_QPA_PHYSICAL_HEIGHT");
if (width && height) {
size.setWidth(width);
size.setHeight(height);
return size;
}
int w = -1;
int h = -1;
QSize screenResolution;
#ifdef Q_OS_LINUX
struct fb_var_screeninfo vinfo;
if (framebufferDevice != -1) {
if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) {
qCWarning(lcEglConvenience, "Could not query screen info");
} else {
w = vinfo.width;
h = vinfo.height;
screenResolution = QSize(vinfo.xres, vinfo.yres);
}
} else
#endif
{
// Use the provided screen size, when available, since some platforms may have their own
// specific way to query it. Otherwise try querying it from the framebuffer.
screenResolution = screenSize.isEmpty() ? screenSizeFromFb(framebufferDevice) : screenSize;
}
size.setWidth(w <= 0 ? screenResolution.width() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w));
size.setHeight(h <= 0 ? screenResolution.height() * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h));
if (w <= 0 || h <= 0)
qCWarning(lcEglConvenience,
"Unable to query physical screen size, defaulting to %d dpi.\n"
"To override, set GREENISLAND_QPA_PHYSICAL_WIDTH "
"and GREENISLAND_QPA_PHYSICAL_HEIGHT (in millimeters).", defaultPhysicalDpi);
}
return size;
}
示例3: targetSize
QSizeF targetSize() const {
QSizeF size = imageData->imageSize();
if (targetImageSizePercent.width() > 0.0)
size.setWidth(0.01 * targetImageSizePercent.width() * size.width());
else if (targetImageSize.width() > 0.0)
size.setWidth(targetImageSize.width());
if (targetImageSizePercent.height() > 0.0)
size.setHeight(0.01 * targetImageSizePercent.height() * size.height());
else if (targetImageSize.height() > 0.0)
size.setHeight(targetImageSize.height());
return size;
}
示例4: doPostLayout
void KWRootAreaProviderBase::doPostLayout(KoTextLayoutRootArea *rootArea, bool /*isNewRootArea*/)
{
KoShape *shape = rootArea->associatedShape();
if (!shape) {
return;
}
KoTextShapeData *data = qobject_cast<KoTextShapeData*>(shape->userData());
Q_ASSERT(data);
QRectF updateRect = shape->outlineRect();
QSizeF newSize = shape->size()
- QSizeF(data->leftPadding() + data->rightPadding(),
data->topPadding() + data->bottomPadding());
KoBorder *border = shape->border();
if (border) {
newSize -= QSizeF(border->borderWidth(KoBorder::LeftBorder) + border->borderWidth(KoBorder::RightBorder), border->borderWidth(KoBorder::TopBorder) + border->borderWidth(KoBorder::BottomBorder));
}
if (data->resizeMethod() == KoTextShapeData::AutoGrowWidthAndHeight
||data->resizeMethod() == KoTextShapeData::AutoGrowHeight) {
newSize.setHeight(rootArea->bottom() - rootArea->top());
// adjust size to have at least the defined minimum height
Q_ASSERT(frameSet()->shapeCount() > 0);
KoShape *firstShape = frameSet()->shapes().first();
if (firstShape->minimumHeight() > newSize.height())
newSize.setHeight(firstShape->minimumHeight());
}
if (data->resizeMethod() == KoTextShapeData::AutoGrowWidthAndHeight
||data->resizeMethod() == KoTextShapeData::AutoGrowWidth) {
newSize.setWidth(rootArea->right() - rootArea->left());
}
newSize += QSizeF(data->leftPadding() + data->rightPadding(),
data->topPadding() + data->bottomPadding());
if (border) {
newSize += QSizeF(border->borderWidth(KoBorder::LeftBorder) + border->borderWidth(KoBorder::RightBorder), border->borderWidth(KoBorder::TopBorder) + border->borderWidth(KoBorder::BottomBorder));
}
if (newSize != rootArea->associatedShape()->size()) {
rootArea->associatedShape()->setSize(newSize);
// transfer the new size to the copy-shapes
foreach(KWCopyShape *cs, frameSet()->copyShapes()) {
cs->setSize(newSize);
}
示例5: physicalScreenSize
QSizeF QEglFSHooks::physicalScreenSize() const
{
static QSizeF size;
if (size.isEmpty()) {
// Note: in millimeters
int width = qgetenv("QT_QPA_EGLFS_PHYSICAL_WIDTH").toInt();
int height = qgetenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT").toInt();
if (width && height) {
// no need to read fb0
size.setWidth(width);
size.setHeight(height);
return size;
}
struct fb_var_screeninfo vinfo;
int w = -1;
int h = -1;
if (framebuffer != -1) {
if (ioctl(framebuffer, FBIOGET_VSCREENINFO, &vinfo) == -1) {
qWarning("EGLFS: Could not query variable screen info.");
} else {
w = vinfo.width;
h = vinfo.height;
}
}
const int defaultPhysicalDpi = 100;
size.setWidth(w <= 0 ? vinfo.xres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(w));
size.setHeight(h <= 0 ? vinfo.yres * Q_MM_PER_INCH / defaultPhysicalDpi : qreal(h));
if (w <= 0 || h <= 0) {
qWarning("EGLFS: Unable to query physical screen size, defaulting to %d dpi.\n"
"EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH "
"and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).",
defaultPhysicalDpi);
}
// override fb0 from environment var setting
if (width)
size.setWidth(width);
if (height)
size.setWidth(height);
}
return size;
}
示例6: applyViewboxTransformation
void KPathShapePrivate::applyViewboxTransformation(const KXmlElement &element)
{
Q_Q(KPathShape);
// apply viewbox transformation
QRectF viewBox = q->loadOdfViewbox(element);
if (! viewBox.isEmpty()) {
// load the desired size
QSizeF size;
size.setWidth(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "width", QString())));
size.setHeight(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "height", QString())));
// load the desired position
QPointF pos;
pos.setX(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "x", QString())));
pos.setY(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "y", QString())));
// create matrix to transform original path data into desired size and position
QTransform viewMatrix;
viewMatrix.translate(-viewBox.left(), -viewBox.top());
viewMatrix.scale(size.width() / viewBox.width(), size.height() / viewBox.height());
viewMatrix.translate(pos.x(), pos.y());
// transform the path data
map(viewMatrix);
}
}
示例7: loadSizeF
/**
* @brief cwRegionLoadTask::loadSizeF
* @param protoSize
* @return
*/
QSizeF cwRegionLoadTask::loadSizeF(const QtProto::QSizeF &protoSize)
{
QSizeF size;
size.setWidth(protoSize.width());
size.setHeight(protoSize.height());
return size;
}
示例8: minimumSizeHint
QSizeF UIGraphicsScrollArea::minimumSizeHint() const
{
/* Minimum size-hint of scroll-bar by default: */
QSizeF msh = m_pScrollBar->minimumSizeHint();
if (m_pViewport)
{
switch (m_enmOrientation)
{
case Qt::Horizontal:
{
/* Expand it with viewport height: */
const int iWidgetHeight = m_pViewport->size().height();
if (msh.height() < iWidgetHeight)
msh.setHeight(iWidgetHeight);
break;
}
case Qt::Vertical:
{
/* Expand it with viewport width: */
const int iWidgetWidth = m_pViewport->size().width();
if (msh.width() < iWidgetWidth)
msh.setWidth(iWidgetWidth);
break;
}
}
}
return msh;
}
示例9: expandSize
static void expandSize(QSizeF &result, const QSizeF &size)
{
if (size.width() >= 0 && size.width() > result.width())
result.setWidth(size.width());
if (size.height() >= 0 && size.height() > result.height())
result.setHeight(size.height());
}
示例10: event
bool AbstractScrollArea::event(QEvent *e)
{
if (e->type() == QEvent::ApplicationLayoutDirectionChange
|| e->type() == QEvent::LayoutDirectionChange) {
} else if (e->type() == QEvent::GraphicsSceneResize) {
QGraphicsSceneResizeEvent *event =
static_cast<QGraphicsSceneResizeEvent*>(e);
QSizeF newSize = event->newSize();
QRectF hrect = m_horizontalScrollBar->boundingRect();
QRectF vrect = m_verticalScrollBar->boundingRect();
QSizeF vpSize = newSize;
if (m_horizontalScrollBarPolicy != Qt::ScrollBarAlwaysOff)
vpSize.setHeight(newSize.height() - hrect.height());
if (m_verticalScrollBarPolicy != Qt::ScrollBarAlwaysOff)
vpSize.setWidth(newSize.width() - vrect.width());
m_viewport->resize(vpSize);
adjustScrollBars();
}
return QGraphicsWidget::event(e);
}
示例11: on_printButton_clicked
void BSplineVisDialog::on_printButton_clicked() {
QString fileName = QFileDialog::getSaveFileName(this, tr("Save PDF File"), "/tmpfs", tr("PDF File (*.pdf)"));
if (fileName.isNull()) {
return;
}
QGraphicsScene printerScene;
renderScene(printerScene, true);
QPrinter printer(QPrinter::HighResolution);
QSizeF paperSize;
paperSize.setWidth(printerScene.sceneRect().width());
paperSize.setHeight(printerScene.sceneRect().height());
printer.setPaperSize(paperSize, QPrinter::Millimeter);
printer.setPageMargins(5, 5, 5, 5, QPrinter::Millimeter);
printer.setOrientation(QPrinter::Portrait);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
QPainter painter(&printer);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform | QPainter::NonCosmeticDefaultPen);
printerScene.render(&painter);
painter.end();
}
示例12: itemChange
// --------------------------------------------------------------------------------------------------------------------------------------
QVariant CSizeGrip::itemChange(GraphicsItemChange change, const QVariant &value)
{
switch(change)
{
case QGraphicsItem::ItemPositionChange:
{
QPointF nextPos = value.toPointF();
QPointF targetPos = pos() - nextPos;
QSizeF resultSize = gWindow()->size() - QSizeF(targetPos.x(), targetPos.y());
if(resultSize.width() < gWindow()->minSize().width())
{
resultSize.setWidth(gWindow()->minSize().width());
nextPos.setX(pos().x());
}
if(resultSize.height() < gWindow()->minSize().height())
{
resultSize.setHeight(gWindow()->minSize().height());
nextPos.setY(pos().y());
}
gWindow()->setSize(resultSize);
return nextPos;
}
break;
default: return QGraphicsItem::itemChange(change, value);
}
return QGraphicsItem::itemChange(change, value);
}
示例13: readSize
QSizeF readSize(QDomElement e)
{
QSizeF p;
p.setWidth(e.attribute("w", "0.0").toDouble());
p.setHeight(e.attribute("h", "0.0").toDouble());
return p;
}
示例14: combineSize
static void combineSize(QSizeF &result, const QSizeF &size)
{
if (result.width() < 0)
result.setWidth(size.width());
if (result.height() < 0)
result.setHeight(size.height());
}
示例15: _q_updateSize
void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged)
{
Q_Q(QDeclarativeLoader);
if (!item || updatingSize)
return;
updatingSize = true;
if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(item)) {
if (!itemWidthValid)
q->setImplicitWidth(qmlItem->implicitWidth());
else
q->setImplicitWidth(qmlItem->width());
if (loaderGeometryChanged && q->widthValid())
qmlItem->setWidth(q->width());
if (!itemHeightValid)
q->setImplicitHeight(qmlItem->implicitHeight());
else
q->setImplicitHeight(qmlItem->height());
if (loaderGeometryChanged && q->heightValid())
qmlItem->setHeight(q->height());
} else if (item && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget*>(item);
QSizeF widgetSize = widget->size();
q->setImplicitWidth(widgetSize.width());
if (loaderGeometryChanged && q->widthValid())
widgetSize.setWidth(q->width());
q->setImplicitHeight(widgetSize.height());
if (loaderGeometryChanged && q->heightValid())
widgetSize.setHeight(q->height());
if (widget->size() != widgetSize)
widget->resize(widgetSize);
}
updatingSize = false;
}