6#include <QtCore/qdebug.h>
7#include <QtCore/qnumeric.h>
12#include <QtWidgets/qapplication.h>
13#include <QtWidgets/qgraphicsscene.h>
14#include <QtWidgets/qstyleoption.h>
15#include <QtWidgets/QStyleOptionTitleBar>
16#include <QtWidgets/QGraphicsSceneMouseEvent>
32 q->setParentItem(parentItem);
34 q->setGraphicsItem(
q);
37 q->unsetWindowFrameMargins();
57 inheritedPaletteResolveMask(0),
58 inheritedFontResolveMask(0),
62 autoFillBackground(
false),
63 focusPolicy(
Qt::NoFocus),
68 setWindowFrameMargins(
false),
86 margins = std::make_unique<QMarginsF>();
145 w->d_func()->resolvePalette(
mask);
243 w->d_func()->resolveFont(
mask);
261 naturalFont =
parent->font();
324 bar.
rect =
q->windowFrameRect().toRect();
374 bool heightForWidth =
true)
378 if (hasHFW == heightForWidth) {
385 while (maxh - minh > 0.1) {
386 qreal middle = minh + (maxh - minh)/2;
393 if (hfw > constraint) {
395 }
else if (hfw <= constraint) {
420 qreal middlew = maxw;
421 qreal middleh = maxh;
426 if (maxw - minw < 0.1) {
431 middlew = minw + (maxw - minw)/2.0;
432 middleh = minh + (maxh - minh)/2.0;
436 if (min_hfw > middleh) {
439 }
else if (min_hfw <= middleh) {
443 }
while (maxw != minw);
448 if (min_hfw < maxh) {
472 if (hasHFW || hasWFH) {
473 if (widthChanged || heightChanged) {
479 minExtent = min.height();
482 proposed = proposedRect.
height();
485 minExtent = min.width();
486 maxExtent = max.
width();
488 proposed = proposedRect.
width();
542 QLineF parentDelta(
q->mapToParent(delta.
p1()),
q->mapToParent(delta.
p2()));
600 q->setGeometry(newGeometry);
612 if (
q->rect().contains(
event->pos())) {
618 bool wasMouseOver =
windowData->buttonMouseOver;
630 bar.
rect =
q->windowFrameRect().toRect();
635 bool needsSetCursorCall =
true;
636 switch (
q->windowFrameSectionAt(
event->pos())) {
654 windowData->buttonRect =
q->style()->subControlRect(
661 needsSetCursorCall =
false;
665 if (needsSetCursorCall)
666 q->setCursor(cursorShape);
676 if (
windowData->buttonMouseOver != wasMouseOver) {
677 if (!oldButtonRect.
isNull())
678 q->update(
QRectF(oldButtonRect).translated(
q->windowFrameRect().topLeft()));
696 bool needsUpdate =
false;
739 if (!
q->isAncestorOf(focusAfter))
741 focusLast = focusAfter;
742 }
while ((focusAfter = focusAfter->d_func()->focusNext));
744 if (!
parent && oldScene && oldScene != newScene && oldScene->d_func()->tabFocusFirst ==
q) {
746 oldScene->d_func()->tabFocusFirst = (focusAfter !=
q) ? focusAfter :
nullptr;
750 focusBefore->d_func()->focusNext = focusAfter;
752 focusAfter->d_func()->focusPrev = focusBefore;
763 newFocusLast = newFocusAfter;
764 }
while ((newFocusAfter = newFocusAfter->d_func()->focusNext));
766 newFocusLast->d_func()->focusNext =
q;
767 focusLast->d_func()->focusNext = newFocusAfter;
769 newFocusAfter->d_func()->focusPrev = focusLast;
774 focusLast->d_func()->focusNext =
q;
791 return q->geometry().width();
799 if (
q->geometry().width() ==
w)
814 return q->geometry().height();
822 if (
q->geometry().height() ==
h)
static QFont font()
Returns the default application font.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
\reentrant \inmodule QtGui
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
QFont resolve(const QFont &) const
Returns a new QFont that has attributes copied from other that have not been previously set on this f...
void setResolveMask(uint mask)
QList< QGraphicsItem * > children
virtual void resolvePalette(uint inheritedMask)
virtual void resolveFont(uint inheritedMask)
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsWidget * parentWidget() const
@ ItemUsesExtendedStyleOption
@ ItemSendsGeometryChanges
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child's parent,...
bool hasWidthForHeight() const
static QGraphicsLayoutItemPrivate * get(QGraphicsLayoutItem *q)
bool hasHeightForWidth() const
The QGraphicsLayout class provides the base class for all layouts in Graphics View.
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
QPalette palette
the scene's default palette
QFont font
the scene's default font
Qt::LayoutDirection layoutDirection
the default layout direction for this application
constexpr QPointF p1() const
Returns the line's start point.
constexpr qreal dx() const
Returns the horizontal component of the line's vector.
constexpr qreal dy() const
Returns the vertical component of the line's vector.
constexpr QPointF p2() const
Returns the line's end point.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
The QPalette class contains color groups for each widget state.
void setResolveMask(ResolveMask mask)
ResolveMask resolveMask() const
QPalette resolve(const QPalette &other) const
Returns a new QPalette that is a union of this instance and other.
\inmodule QtCore\reentrant
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr QRectF translated(qreal dx, qreal dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\inmodule QtCore\reentrant
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
constexpr void moveTo(int x, int t) noexcept
Moves the rectangle, leaving the top-left corner at the given position (x, y).
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
QStyle::SubControls subControls
\variable QStyleOptionToolBox::selectedPosition
Combined button and popup list for selecting options.
@ WindowContextHelpButtonHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
bool qIsNaN(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr const T & qBound(const T &min, const T &val, const T &max)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q