本文整理汇总了C++中scaleRect函数的典型用法代码示例。如果您正苦于以下问题:C++ scaleRect函数的具体用法?C++ scaleRect怎么用?C++ scaleRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scaleRect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintStuff
static void paintStuff(QPainter *p)
{
QPaintDevice *screenDevice = QApplication::desktop();
p->drawRect(scaleRect(QRectF(100, 100, 100, 100), screenDevice, p->device()));
p->save();
p->translate(scalePoint(QPointF(10, 10), screenDevice, p->device()));
p->restore();
p->drawRect(scaleRect(QRectF(100, 100, 100, 100), screenDevice, p->device()));
}
示例2: mouseDblClicked
void ScalePicker::mouseDblClicked(const QwtScaleWidget *scale, const QPoint &pos)
{
if (scaleRect(scale).contains(pos) )
emit axisDblClicked(scale->alignment());
else
{// Click on the title
switch(scale->alignment())
{
case QwtScaleDraw::LeftScale:
{
emit yAxisTitleDblClicked();
break;
}
case QwtScaleDraw::RightScale:
{
emit rightAxisTitleDblClicked();
break;
}
case QwtScaleDraw::BottomScale:
{
emit xAxisTitleDblClicked();
break;
}
case QwtScaleDraw::TopScale:
{
emit topAxisTitleDblClicked();
break;
}
}
}
}
示例3: axisTitleDblClicked
void ScalePicker::mouseDblClicked(const QwtScaleWidget *scale, const QPoint &pos)
{
if (titleRect(scale).contains(pos))
emit axisTitleDblClicked();
else if (scaleRect(scale).contains(pos))
emit axisDblClicked(scale->alignment());
}
示例4: plot
void QwtPlotZoomer::rescale()
{
QwtPlot *plt = plot();
if ( !plt )
return;
const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
if ( rect != scaleRect() )
{
const bool doReplot = plt->autoReplot();
plt->setAutoReplot( false );
double x1 = rect.left();
double x2 = rect.right();
if ( !plt->axisScaleDiv( xAxis() ).isIncreasing() )
qSwap( x1, x2 );
plt->setAxisScale( xAxis(), x1, x2 );
double y1 = rect.top();
double y2 = rect.bottom();
if ( !plt->axisScaleDiv( yAxis() ).isIncreasing() )
qSwap( y1, y2 );
plt->setAxisScale( yAxis(), y1, y2 );
plt->setAutoReplot( doReplot );
plt->replot();
}
}
示例5: scaleRect
void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint8 color, const bool doScaling) {
Common::Rect targetRect = doScaling ? scaleRect(rect) : rect;
SciBitmap &bitmap = *_segMan->lookupBitmap(_bitmap);
byte *pixels = bitmap.getPixels() + rect.top * _width + rect.left;
// NOTE: Not fully disassembled, but this should be right
int16 rectWidth = targetRect.width();
int16 heightRemaining = targetRect.height();
int16 sidesHeight = heightRemaining - size * 2;
int16 centerWidth = rectWidth - size * 2;
int16 stride = _width - rectWidth;
for (int16 y = 0; y < size && y < heightRemaining; ++y) {
memset(pixels, color, rectWidth);
pixels += _width;
--heightRemaining;
}
for (int16 y = 0; y < sidesHeight; ++y) {
for (int16 x = 0; x < size; ++x) {
*pixels++ = color;
}
pixels += centerWidth;
for (int16 x = 0; x < size; ++x) {
*pixels++ = color;
}
pixels += stride;
}
for (int16 y = 0; y < size && y < heightRemaining; ++y) {
memset(pixels, color, rectWidth);
pixels += _width;
--heightRemaining;
}
}
示例6: zoomRectIndex
void PlotZoomer::zoom(int up)
{
// FIXME: Save the current zoom window in case it's been panned.
int zoomIndex = zoomRectIndex();
if (zoomIndex > 0)
{
QStack<QRectF> stack = zoomStack();
if (zoomIndex < stack.size())
{
QRectF r = scaleRect();
stack[zoomIndex] = r;
setZoomStack(stack, zoomIndex);
}
}
Super::zoom(up);
if (zoomRectIndex() == 0)
{
if (QwtPlot *plotter = plot())
{
plotter->setAxisAutoScale(AxisX);
plotter->setAxisAutoScale(AxisY);
plotter->updateAxes();
}
}
}
示例7: urnFromUrl
void LookAlikeMainPrivate::confirmFace(QUrl picture, QString& contact)
{
//Confirm in Face Recognizer database
QString urnImage = urnFromUrl(picture);
XQFaceRegion region = findRegion(contact, urnImage);
region.setFaceId(contact);
//Update XMP metadata image
QString fileName = picture.toLocalFile();
QImage image(fileName);
//Scale face to image dimensions
QSize originalSize = image.size();
QSize thumbnailSize = region.sourceImageSize();
QRect rect = region.faceRect();
QRect scaledRect = scaleRect(rect, thumbnailSize, originalSize);
QuillMetadataRegion metadataRegion;
metadataRegion.setArea(scaledRect);
metadataRegion.setType(QuillMetadataRegion::RegionType_Face);
QString contactName = m_faceDatabaseProvider->getContactName(contact);
metadataRegion.setName(contactName);
metadataRegion.setExtension("nco:PersonContact", contact);
QuillMetadataRegionList regionList;
regionList.append(metadataRegion);
saveMetadataRegionList(fileName, regionList);
}
示例8: scaleRect
void ScalePicker::mouseRightClicked(const QwtScale *scale, const QPoint &pos)
{
QRect rect = scaleRect(scale);
int margin = 2; // pixels tolerance
rect.setRect(rect.x() - margin, rect.y() - margin, rect.width() + 2 * margin, rect.height() + 2 * margin);
if (rect.contains(pos))
{
if (scale->position() == QwtScale::Left || scale->position() == QwtScale::Right)
emit axisRightClicked(scale->position());
else if (scale->position() == QwtScale::Top)
emit axisRightClicked(QwtScale::Bottom);
else if (scale->position() == QwtScale::Bottom)
emit axisRightClicked(QwtScale::Top);
}
else
{
if (scale->position() == QwtScale::Left || scale->position() == QwtScale::Right)
emit axisTitleRightClicked(scale->position());
else if (scale->position() == QwtScale::Top)
emit axisTitleRightClicked(QwtScale::Bottom);
else if (scale->position() == QwtScale::Bottom)
emit axisTitleRightClicked(QwtScale::Top);
}
}
示例9: setZoomBase
void QwtPlotZoomer::setAxis( int xAxis, int yAxis )
{
if ( xAxis != QwtPlotPicker::xAxis() || yAxis != QwtPlotPicker::yAxis() )
{
QwtPlotPicker::setAxis( xAxis, yAxis );
setZoomBase( scaleRect() );
}
}
示例10: plot
void ScalePicker::mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos)
{
plot()->activateGraph();
if (scaleRect(scale).contains(pos))
emit axisRightClicked(scale->alignment());
else
emit axisTitleRightClicked();
}
示例11: setSelectionFlags
//! Init the zoomer, used by the constructors
void QwtPlotZoomer::init(int selectionFlags, DisplayMode trackerMode)
{
d_data = new PrivateData;
d_data->maxStackDepth = -1;
setSelectionFlags(selectionFlags);
setTrackerMode(trackerMode);
setRubberBand(RectRubberBand);
setZoomBase(scaleRect());
}
示例12: scaleRect
void GfxText32::erase(const Common::Rect &rect, const bool doScaling) {
Common::Rect targetRect = doScaling ? rect : scaleRect(rect);
byte *bitmap = _segMan->getHunkPointer(_bitmap);
byte *pixels = bitmap + READ_SCI11ENDIAN_UINT32(bitmap + 28);
// NOTE: There is an extra optimisation within the SCI code to
// do a single memset if the scaledRect is the same size as
// the bitmap, not implemented here.
Buffer buffer(_width, _height, pixels);
buffer.fillRect(targetRect, _backColor);
}
示例13: scaleRect
/*!
Reinitialized the zoom stack with scaleRect() as base.
\sa zoomBase(), scaleRect()
\warning Calling QwtPlot::setAxisScale() while QwtPlot::autoReplot() is false
leaves the axis in an 'intermediate' state.
In this case, to prevent buggy behaviour, you must call
QwtPlot::replot() before calling QwtPlotZoomer::setZoomBase().
This quirk will be removed in a future release.
\sa QwtPlot::autoReplot(), QwtPlot::replot().
*/
void QwtPlotZoomer::setZoomBase()
{
const QwtPlot *plt = plot();
if ( !plt )
return;
d_data->zoomStack.clear();
d_data->zoomStack.push(scaleRect());
d_data->zoomRectIndex = 0;
rescale();
}
示例14: setTrackerMode
//! Init the zoomer, used by the constructors
void QwtPlotZoomer::init( bool doReplot )
{
d_data = new PrivateData;
d_data->maxStackDepth = -1;
setTrackerMode( ActiveOnly );
setRubberBand( RectRubberBand );
setStateMachine( new QwtPickerDragRectMachine() );
if ( doReplot && plot() )
plot()->replot();
setZoomBase( scaleRect() );
}
示例15: scaleRect
/*!
Reinitialized the zoom stack with scaleRect() as base.
\param doReplot Call QwtPlot::replot() for the attached plot before initializing
the zoomer with its scales. This might be necessary,
when the plot is in a state with pending scale changes.
\sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
*/
void QwtPlotZoomer::setZoomBase( bool doReplot )
{
QwtPlot *plt = plot();
if ( plt == NULL )
return;
if ( doReplot )
plt->replot();
d_data->zoomStack.clear();
d_data->zoomStack.push( scaleRect() );
d_data->zoomRectIndex = 0;
rescale();
}