#include <qmdiarea_p.h>
|
QPoint | place (const QSize &size, const QList< QRect > &rects, const QRect &domain) const |
| Places the rectangle defined by 'size' relative to 'rects' and 'domain' so that it overlaps 'rects' as little as possible and 'domain' as much as possible. More...
|
|
|
static int | accumulatedOverlap (const QRect &source, const QList< QRect > &rects) |
| Calculates the accumulated overlap (intersection area) between 'source' and 'rects'. More...
|
|
static QPoint | findBestPlacement (const QRect &domain, const QList< QRect > &rects, QList< QRect > &source) |
| Finds among the rectangles in 'source' the best placement. More...
|
|
static void | findMaxOverlappers (const QRect &domain, const QList< QRect > &source, QList< QRect > &result) |
| Finds all rectangles in 'source' that overlaps 'domain' by the maximum overlap area between 'domain' and any rectangle in 'source'. More...
|
|
static QRect | findMinOverlapRect (const QList< QRect > &source, const QList< QRect > &rects) |
| Finds among 'source' the rectangle with the minimum accumulated overlap with the rectangles in 'rects'. More...
|
|
static void | findNonInsiders (const QRect &domain, QList< QRect > &source, QList< QRect > &result) |
| Finds all rectangles in 'source' not completely inside 'domain'. More...
|
|
static void | getCandidatePlacements (const QSize &size, const QList< QRect > &rects, const QRect &domain, QList< QRect > &candidates) |
| Gets candidates for the final placement. More...
|
|
Definition at line 123 of file qmdiarea_p.h.
◆ accumulatedOverlap()
int MinOverlapPlacer::accumulatedOverlap |
( |
const QRect & |
source, |
|
|
const QList< QRect > & |
rects |
|
) |
| |
|
staticprivate |
Calculates the accumulated overlap (intersection area) between 'source' and 'rects'.
- Warning
- This function is not part of the public interface.
Definition at line 434 of file qmdiarea.cpp.
437 foreach (
const QRect &rect, rects) {
439 accOverlap += intersection.
width() * intersection.
height();
int width() const
Returns the width of the rectangle.
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
int height() const
Returns the height of the rectangle.
The QRect class defines a rectangle in the plane using integer precision.
◆ findBestPlacement()
Finds among the rectangles in 'source' the best placement.
- Warning
- This function is not part of the public interface. Here, 'best' means the placement that overlaps the rectangles in 'rects' as little as possible while at the same time being as much as possible inside 'domain'.
Definition at line 553 of file qmdiarea.cpp.
bool empty() const
This function is provided for STL compatibility.
static void findNonInsiders(const QRect &domain, QList< QRect > &source, QList< QRect > &result)
Finds all rectangles in 'source' not completely inside 'domain'.
static QRect findMinOverlapRect(const QList< QRect > &source, const QList< QRect > &rects)
Finds among 'source' the rectangle with the minimum accumulated overlap with the rectangles in 'rects...
static void findMaxOverlappers(const QRect &domain, const QList< QRect > &source, QList< QRect > &result)
Finds all rectangles in 'source' that overlaps 'domain' by the maximum overlap area between 'domain' ...
The QList class is a template class that provides lists.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
◆ findMaxOverlappers()
Finds all rectangles in 'source' that overlaps 'domain' by the maximum overlap area between 'domain' and any rectangle in 'source'.
- Warning
- This function is not part of the public interface. The result is stored in 'result'.
Definition at line 527 of file qmdiarea.cpp.
531 foreach (
const QRect &srcRect, source) {
533 const int overlap = intersection.
width() * intersection.
height();
534 if (overlap >= maxOverlap || maxOverlap == -1) {
535 if (overlap > maxOverlap) {
536 maxOverlap = overlap;
int width() const
Returns the width of the rectangle.
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
int height() const
Returns the height of the rectangle.
void clear()
Removes all items from the list.
The QRect class defines a rectangle in the plane using integer precision.
◆ findMinOverlapRect()
Finds among 'source' the rectangle with the minimum accumulated overlap with the rectangles in 'rects'.
- Warning
- This function is not part of the public interface.
Definition at line 453 of file qmdiarea.cpp.
455 int minAccOverlap = -1;
456 QRect minAccOverlapRect;
457 foreach (
const QRect &srcRect, source) {
459 if (accOverlap < minAccOverlap || minAccOverlap == -1) {
460 minAccOverlap = accOverlap;
461 minAccOverlapRect = srcRect;
464 return minAccOverlapRect;
static int accumulatedOverlap(const QRect &source, const QList< QRect > &rects)
Calculates the accumulated overlap (intersection area) between 'source' and 'rects'.
The QRect class defines a rectangle in the plane using integer precision.
◆ findNonInsiders()
Finds all rectangles in 'source' not completely inside 'domain'.
- Warning
- This function is not part of the public interface. The result is stored in 'result' and also removed from 'source'.
Definition at line 506 of file qmdiarea.cpp.
509 QMutableListIterator<QRect>
it(source);
510 while (
it.hasNext()) {
511 const QRect srcRect =
it.next();
#define it(className, varName)
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
The QRect class defines a rectangle in the plane using integer precision.
◆ getCandidatePlacements()
Gets candidates for the final placement.
- Warning
- This function is not part of the public interface.
Definition at line 474 of file qmdiarea.cpp.
480 yset << domain.
top();
483 foreach (
const QRect &rect, rects) {
484 xset << rect.
right() + 1;
485 yset << rect.
bottom() + 1;
491 qSort(ylist.begin(), ylist.end());
493 foreach (
int y, ylist)
494 foreach (
int x, xlist)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
int width() const
Returns the width.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
void qSort(RandomAccessIterator start, RandomAccessIterator end)
int top() const
Returns the y-coordinate of the rectangle's top edge.
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
QList< T > values() const
◆ place()
Places the rectangle defined by 'size' relative to 'rects' and 'domain' so that it overlaps 'rects' as little as possible and 'domain' as much as possible.
- Warning
- This function is not part of the public interface.
Returns the position of the resulting rectangle.
Implements QMdi::Placer.
Definition at line 577 of file qmdiarea.cpp.
582 foreach (
const QRect &rect, rects) {
static void getCandidatePlacements(const QSize &size, const QList< QRect > &rects, const QRect &domain, QList< QRect > &candidates)
Gets candidates for the final placement.
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
static QPoint findBestPlacement(const QRect &domain, const QList< QRect > &rects, QList< QRect > &source)
Finds among the rectangles in 'source' the best placement.
The QList class is a template class that provides lists.
The documentation for this class was generated from the following files: