Sets the geometry of the window, excluding its window frame, to a
rectangle constructed from \a posx, \a posy, \a w and \a h.
- \sa geometry
+ \sa geometry()
*/
+/*!
+ \brief Sets the geometry of the window, excluding its window frame, to \a rect.
+
+ \sa geometry()
+*/
void QWindow::setGeometry(const QRect &rect)
{
Q_D(QWindow);
}
/*!
- \property QWindow::pos
- \brief the position of the window on the desktop
+ \fn void QWindow::setPosition(const QPoint &pt)
+ \brief set the position of the window on the desktop to \a pt
+
+ \sa position()
+*/
+
+/*!
+ \fn void QWindow::setPosition(int posx, int posy)
+ \brief set the position of the window on the desktop to \a posx, \a posy
- \sa geometry
+ \sa position()
*/
/*!
- \property QWindow::size
- \brief the size of the window excluding any window frame
+ \fn QPoint QWindow::position() const
+ \brief get the position of the window on the desktop excluding any window frame
- \sa geometry
+ \sa setPosition()
*/
/*!
- \property QWindow::geometry
- \brief the geometry of the window excluding any window frame
+ \fn QSize QWindow::size() const
+ \brief get the size of the window excluding any window frame
- To make sure the window is visible, make sure the geometry is within
- the virtual geometry of its screen.
+ \sa resize()
+*/
- See the \l{Window Geometry} documentation for an overview of geometry
- issues with windows.
+/*!
+ \fn void QWindow::resize(int w, int h)
- By default, this property contains a value that depends on the user's
- platform and screen geometry.
+ set the size of the window, excluding any window frame, to a QSize
+ constructed from width \a w and height \a h
- \sa size, pos
+ \sa size(), geometry()
*/
+/*!
+ \brief set the size of the window, excluding any window frame, to \a newSize
+
+ \sa size(), geometry()
+*/
void QWindow::resize(const QSize &newSize)
{
Q_D(QWindow);
if (d->platformWindow) {
- d->platformWindow->setGeometry(QRect(pos(), newSize));
+ d->platformWindow->setGeometry(QRect(position(), newSize));
} else {
d->geometry.setSize(newSize);
}
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
- Q_PROPERTY(QPoint pos READ pos WRITE setPos)
- Q_PROPERTY(QSize size READ size WRITE resize)
- Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged)
Q_PROPERTY(int minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged)
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
inline int y() const { return geometry().y(); }
inline QSize size() const { return geometry().size(); }
- inline QPoint pos() const { return geometry().topLeft(); }
+ inline QPoint position() const { return geometry().topLeft(); }
- inline void setPos(const QPoint &pt) { setGeometry(QRect(pt, size())); }
- inline void setPos(int posx, int posy) { setPos(QPoint(posx, posy)); }
+ inline void setPosition(const QPoint &pt) { setGeometry(QRect(pt, size())); }
+ inline void setPosition(int posx, int posy) { setPosition(QPoint(posx, posy)); }
void resize(const QSize &newSize);
inline void resize(int w, int h) { resize(QSize(w, h)); }
QPoint globalPosition() const {
Q_Q(const QWindow);
- QPoint offset = q->pos();
+ QPoint offset = q->position();
for (const QWindow *p = q->parent(); p; p = p->parent())
- offset += p->pos();
+ offset += p->position();
return offset;
}
// qWaitForWindowShown() will generate bogus results.
if (window->isActive()) {
int waitNo = 0; // 0, 0 might be a valid position after all, so do not wait for ever
- while (window->pos().isNull()) {
+ while (window->position().isNull()) {
if (waitNo++ > timeout / 10)
break;
qWait(10);
QMargins originalMargins = window.frameMargins();
- QCOMPARE(window.pos(), window.framePos() + QPoint(originalMargins.left(), originalMargins.top()));
+ QCOMPARE(window.position(), window.framePos() + QPoint(originalMargins.left(), originalMargins.top()));
QVERIFY(window.frameGeometry().contains(window.geometry()));
- QPoint originalPos = window.pos();
+ QPoint originalPos = window.position();
QPoint originalFramePos = window.framePos();
window.setWindowState(Qt::WindowFullScreen);
QCoreApplication::processEvents();
QTRY_COMPARE(window.received(QEvent::Resize), 3);
- QTRY_COMPARE(originalPos, window.pos());
+ QTRY_COMPARE(originalPos, window.position());
QTRY_COMPARE(originalFramePos, window.framePos());
QTRY_COMPARE(originalMargins, window.frameMargins());
QTRY_VERIFY(window.received(QEvent::Move));
QTRY_COMPARE(framePos, window.framePos());
QTRY_COMPARE(originalMargins, window.frameMargins());
- QCOMPARE(window.pos(), window.framePos() + QPoint(originalMargins.left(), originalMargins.top()));
+ QCOMPARE(window.position(), window.framePos() + QPoint(originalMargins.left(), originalMargins.top()));
// and back to regular positioning
window.reset();
- window.setPos(originalPos);
+ window.setPosition(originalPos);
QTRY_VERIFY(window.received(QEvent::Move));
- QTRY_COMPARE(originalPos, window.pos());
+ QTRY_COMPARE(originalPos, window.position());
}
}