本文整理汇总了C++中QRegion::boundingRect方法的典型用法代码示例。如果您正苦于以下问题:C++ QRegion::boundingRect方法的具体用法?C++ QRegion::boundingRect怎么用?C++ QRegion::boundingRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRegion
的用法示例。
在下文中一共展示了QRegion::boundingRect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solidFill
/*!
\reimp
*/
void QTransformedScreen::solidFill(const QColor &color, const QRegion ®ion)
{
const QRegion tr = mapToDevice(region, QSize(w,h));
Q_ASSERT(tr.boundingRect() == mapToDevice(region.boundingRect(), QSize(w,h)));
#ifdef QT_REGION_DEBUG
qDebug() << "QTransformedScreen::solidFill region" << region << "transformed" << tr;
#endif
QProxyScreen::solidFill(color, tr);
}
示例2: maximize
/*!
Called when the user clicks in the \c Maximize region.
\a widget is the widget to be maximized.
The default behaviour is to resize the widget to be full-screen.
This method can be overridden e.g. to allow room for launch
panels.
*/
void QWSDecoration::maximize( QWidget *widget )
{
QRect nr;
// find out how much space the decoration needs
extern QRect qt_maxWindowRect;
QRect desk = qt_maxWindowRect;
/*
#ifdef QPE_WM_LOOK_AND_FEEL
if (wmStyle == QtEmbedded_WMStyle) {
QRect dummy( 0, 0, desk.width(), 1 );
QRegion r = region(widget, dummy, Title);
QRect rect = r.boundingRect();
nr = QRect(desk.x(), desk.y()-rect.y(),
desk.width(), desk.height() - rect.height());
} else
#endif
*/
{
QRect dummy( 0, 0, 1, 1);
QRegion r = region(widget, dummy);
if (r.isEmpty()) {
nr = desk;
} else {
QRect rect = r.boundingRect();
nr = QRect(desk.x()-rect.x(), desk.y()-rect.y(),
desk.width() - (rect.width()==1 ? 0 : rect.width()), // ==1 -> dummy
desk.height() - (rect.height()==1 ? 0 : rect.height()));
}
}
widget->setGeometry(nr);
}
示例3: OptimiseDisplayedArea
void SubtitleScreen::OptimiseDisplayedArea(void)
{
if (!m_refreshArea)
return;
QRegion visible;
QListIterator<MythUIType *> i(m_ChildrenList);
while (i.hasNext())
{
MythUIType *img = i.next();
visible = visible.united(img->GetArea());
}
if (visible.isEmpty())
return;
QRect bounding = visible.boundingRect();
bounding = bounding.translated(m_safeArea.topLeft());
bounding = m_safeArea.intersected(bounding);
int left = m_safeArea.left() - bounding.left();
int top = m_safeArea.top() - bounding.top();
SetArea(MythRect(bounding));
i.toFront();;
while (i.hasNext())
{
MythUIType *img = i.next();
img->SetArea(img->GetArea().translated(left, top));
}
}
示例4: scroll
bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy)
{
#ifdef Q_WS_WIN
Q_D(QRasterWindowSurface);
if (!d->image || !d->image->hdc)
return false;
QRect rect = area.boundingRect();
BitBlt(d->image->hdc, rect.x()+dx, rect.y()+dy, rect.width(), rect.height(),
d->image->hdc, rect.x(), rect.y(), SRCCOPY);
return true;
#else
Q_D(QRasterWindowSurface);
if (!d->image || d->image->image.isNull())
return false;
#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
syncX();
#endif
const QVector<QRect> rects = area.rects();
for (int i = 0; i < rects.size(); ++i)
qt_scrollRectInImage(d->image->image, rects.at(i), QPoint(dx, dy));
return true;
#endif
}
示例5: wrgn
void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset)
{
if (d_ptr->device.isNull())
return;
QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
QRegion wrgn(rgn);
QRect br = rgn.boundingRect();
if (!wOffset.isNull())
wrgn.translate(-wOffset);
QRect wbr = wrgn.boundingRect();
int num;
XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
if (num <= 0)
return;
// qDebug() << "XSetClipRectangles";
// for (int i = 0; i < num; ++i)
// qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height;
if (num != 1)
XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded);
XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc,
br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y());
if (num != 1)
XSetClipMask(X11->display, gc, XNone);
}
示例6: flush
void QXcbBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset)
{
if (!m_image || m_image->size().isEmpty())
return;
QSize imageSize = m_image->size();
QRegion clipped = region;
clipped &= QRect(0, 0, window->width(), window->height());
clipped &= QRect(0, 0, imageSize.width(), imageSize.height()).translated(-offset);
QRect bounds = clipped.boundingRect();
if (bounds.isNull())
return;
Q_XCB_NOOP(connection());
QXcbWindow *platformWindow = static_cast<QXcbWindow *>(window->handle());
QVector<QRect> rects = clipped.rects();
for (int i = 0; i < rects.size(); ++i)
m_image->put(platformWindow->xcb_window(), rects.at(i).topLeft(), rects.at(i).translated(offset));
Q_XCB_NOOP(connection());
if (m_syncingResize) {
xcb_flush(xcb_connection());
connection()->sync();
m_syncingResize = false;
platformWindow->updateSyncRequestCounter();
}
}
示例7: drawStamp
void TilePainter::drawStamp(const TileLayer *stamp,
const QRegion &drawRegion)
{
Q_ASSERT(stamp);
if (stamp->bounds().isEmpty())
return;
const QRegion region = paintableRegion(drawRegion);
if (region.isEmpty())
return;
const int w = stamp->width();
const int h = stamp->height();
const QRect regionBounds = region.boundingRect();
foreach (const QRect &rect, region.rects()) {
for (int _x = rect.left(); _x <= rect.right(); ++_x) {
for (int _y = rect.top(); _y <= rect.bottom(); ++_y) {
const int stampX = (_x - regionBounds.left()) % w;
const int stampY = (_y - regionBounds.top()) % h;
const Cell &cell = stamp->cellAt(stampX, stampY);
if (cell.isEmpty())
continue;
mTileLayer->setCell(_x - mTileLayer->x(),
_y - mTileLayer->y(),
cell);
}
}
}
mMapDocument->emitRegionChanged(region);
}
示例8: updateFrameStrut
void QWidgetPrivate::updateFrameStrut()
{
Q_Q(QWidget);
if(!q->isVisible() || (q->windowType() == Qt::Desktop)) {
data.fstrut_dirty = q->isVisible();
return;
}
#ifndef QT_NO_QWS_MANAGER
if (extra && extra->topextra && extra->topextra->qwsManager) {
QTLWExtra *topextra = extra->topextra;
const QRect oldFrameStrut = topextra->frameStrut;
const QRect contents = data.crect;
QRegion r = localRequestedRegion().translated(contents.topLeft());
r += extra->topextra->qwsManager->region();
const QRect frame = r.boundingRect();
topextra->frameStrut.setCoords(contents.left() - frame.left(),
contents.top() - frame.top(),
frame.right() - contents.right(),
frame.bottom() - contents.bottom());
topextra->qwsManager->repaintRegion(QDecoration::All, QDecoration::Normal);
}
#endif
data.fstrut_dirty = false;
}
示例9: mergeWith
bool EraseTiles::mergeWith(const QUndoCommand *other) {
const EraseTiles *o = static_cast<const EraseTiles*>(other);
if (!(mMapEditor == o->mMapEditor &&
mTileLayer == o->mTileLayer &&
o->mMergeable))
return false;
const QRegion combinedRegion = mRegion.united(o->mRegion);
if (mRegion != combinedRegion) {
const QRect bounds = mRegion.boundingRect();
const QRect combinedBounds = combinedRegion.boundingRect();
//resize the erased tiles layer when necessary
if (bounds != combinedBounds) {
const QPoint shift = bounds.topLeft() - combinedBounds.topLeft();
mErasedCells->resize(combinedBounds.size(), shift);
}
//copy the newly erased tiles over
const QRect otherBounds = o->mRegion.boundingRect();
const QPoint pos = otherBounds.topLeft() - combinedBounds.topLeft();
mErasedCells->merge(pos, o->mErasedCells);
mRegion = combinedRegion;
}
return true;
}
示例10: flush
void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
{
QRect bounds = region.boundingRect();
if (size().isEmpty() || !geometry().contains(bounds))
return;
Q_XCB_NOOP(connection());
QXcbWindow *window = static_cast<QXcbWindow *>(widget->window()->platformWindow());
extern QWidgetData* qt_widget_data(QWidget *);
QPoint widgetOffset = qt_qwidget_data(widget)->wrect.topLeft();
QVector<QRect> rects = region.rects();
for (int i = 0; i < rects.size(); ++i)
m_image->put(window->window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset));
Q_XCB_NOOP(connection());
if (m_syncingResize) {
xcb_flush(xcb_connection());
connection()->sync();
m_syncingResize = false;
window->updateSyncRequestCounter();
}
}
示例11: onVolumeButtonsPressed
void StatusBar::onVolumeButtonsPressed()
{
QRegion region = visibleRegion();
if (region.isEmpty())
{
return;
}
QRect visible_rect = region.boundingRect();
if (visible_rect.width() < height() && visible_rect.height() < height())
{
return;
}
VolumeControlDialog * dialog = volumeDialog(true);
if (!dialog->isVisible())
{
dialog->ensureVisible();
onyx::screen::instance().updateWidget(0, onyx::screen::ScreenProxy::GU, false, onyx::screen::ScreenCommand::WAIT_COMMAND_FINISH);
}
else
{
dialog->resetTimer();
}
}
示例12: clear
//! Clears the complex on the specified region. Please observe that the actually cleared region
//! consists of all lattice cells intersecting the passed region, therefore resulting in a cleared region
//! typically larger than passed one, up to the lattice granularity.
void TCacheResource::clear(QRegion region)
{
if (!m_region.intersects(region))
return;
//Get the region bbox
TRect bbox(toTRect(region.boundingRect()));
//For all cells intersecting the bbox
TPoint initialPos(getCellPos(bbox.getP00()));
TPoint pos;
for (pos.x = initialPos.x; pos.x <= bbox.x1; pos.x += latticeStep)
for (pos.y = initialPos.y; pos.y <= bbox.y1; pos.y += latticeStep) {
QRect cellQRect(toQRect(TRect(pos, TDimension(latticeStep, latticeStep))));
if (region.intersects(cellQRect) && m_region.intersects(cellQRect)) {
//Release the associated cell from cache and clear the cell from the content region.
TImageCache::instance()->remove(getCellCacheId(pos));
m_region -= cellQRect;
--m_cellsCount;
//DIAGNOSTICS_GLOADD("crCellsCnt", -1);
//Release the cell from m_cellDatas
m_cellDatas[getCellIndex(pos)].m_modified = true;
}
}
if (m_region.isEmpty()) {
m_tileType = NONE;
m_locksCount = 0;
}
}
示例13: flush
void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion,
const QPoint &offset)
{
Q_ASSERT(window);
const QRect br = region.boundingRect();
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window << offset << br;
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
#ifndef Q_OS_WINCE
const bool hasAlpha = rw->format().hasAlpha();
const Qt::WindowFlags flags = window->flags();
if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) {
// Windows with alpha: Use blend function to update.
QRect r = window->frameGeometry();
QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top());
QRect dirtyRect = br.translated(offset + frameOffset);
SIZE size = {r.width(), r.height()};
POINT ptDst = {r.x(), r.y()};
POINT ptSrc = {0, 0};
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA};
if (QWindowsContext::user32dll.updateLayeredWindowIndirect) {
RECT dirty = {dirtyRect.x(), dirtyRect.y(),
dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info);
} else {
QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA);
}
} else {
#endif
const HDC dc = rw->getDC();
if (!dc) {
qErrnoWarning("%s: GetDC failed", __FUNCTION__);
return;
}
if (!BitBlt(dc, br.x(), br.y(), br.width(), br.height(),
m_image->hdc(), br.x() + offset.x(), br.y() + offset.y(), SRCCOPY)) {
const DWORD lastError = GetLastError(); // QTBUG-35926, QTBUG-29716: may fail after lock screen.
if (lastError != ERROR_SUCCESS && lastError != ERROR_INVALID_HANDLE)
qErrnoWarning(lastError, "%s: BitBlt failed", __FUNCTION__);
}
rw->releaseDC();
#ifndef Q_OS_WINCE
}
#endif
// Write image for debug purposes.
if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) {
static int n = 0;
const QString fileName = QString::fromLatin1("win%1_%2.png").
arg(rw->winId()).arg(n++);
m_image->image().save(fileName);
qCDebug(lcQpaBackingStore) << "Wrote " << m_image->image().size() << fileName;
}
}
示例14: paintTrack
void TrackView::paintTrack(QStylePainter &painter, const QRegion ®ion, int track)
{
const QRect &rect = region.boundingRect();
int firstRow = qBound(0, getRowFromPhysicalY(qMax(rect.top(), topMarginHeight)), getRows() - 1);
int lastRow = qBound(0, getRowFromPhysicalY(qMax(rect.bottom(), topMarginHeight)), getRows() - 1);
QRect selection = getSelection();
const SyncTrack *t = getTrack(track);
for (int row = firstRow; row <= lastRow; ++row) {
QRect patternDataRect(getPhysicalX(track), getPhysicalY(row), trackWidth, rowHeight);
if (!region.intersects(patternDataRect))
continue;
const SyncTrack::TrackKey *key = t->getPrevKeyFrame(row);
SyncTrack::TrackKey::KeyType interpolationType = key ? key->type : SyncTrack::TrackKey::STEP;
bool selected = selection.contains(track, row);
QBrush baseBrush = bgBaseBrush;
QBrush darkBrush = bgDarkBrush;
if (selected) {
baseBrush = selectBaseBrush;
darkBrush = selectDarkBrush;
}
QBrush bgBrush = (row % 8 == 0) ? darkBrush : baseBrush;
QRect fillRect = patternDataRect;
painter.fillRect(fillRect, bgBrush);
if (row % 8 == 0) {
painter.setPen(selected ? rowSelectPen : rowPen);
painter.drawLine(QPointF(patternDataRect.left() + 0.5, patternDataRect.top() + 0.5),
QPointF(patternDataRect.right() + 0.5, patternDataRect.top() + 0.5));
}
if (interpolationType != SyncTrack::TrackKey::STEP) {
painter.setPen(getInterpolationPen(interpolationType));
painter.drawLine(QPoint(patternDataRect.right(), patternDataRect.top() + 1),
QPoint(patternDataRect.right(), patternDataRect.bottom()));
}
if (row == editRow && track == editTrack) {
QRectF selectRect = QRectF(patternDataRect).adjusted(0.5, 0.5, -0.5, -0.5);
painter.setPen(QColor(0, 0, 0));
painter.drawRect(selectRect);
}
painter.setPen(selected ?
palette().color(QPalette::HighlightedText) :
palette().color(QPalette::WindowText));
painter.drawText(patternDataRect, t->isKeyFrame(row) ?
QString::number(t->getKeyFrame(row).value, 'f', 2) :
" ---");
}
}
示例15: onRemoveHorizontalLinesClicked
void EditorTools::onRemoveHorizontalLinesClicked(){
if(editor->editorView()->selectedImage()){
QRegion selected = editor->editorView()->selectedRegion();
/* Do vertical averaging */
/* simplify selection */
QRect rect = selected.boundingRect();
editor->editorView()->selectedImage()->removeHorizontalLines(rect);
}
}