From cd34da54269e6cd7fa5c18242d982736f022a14a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 22 Oct 2012 12:47:34 +0200 Subject: Rename all QWindow properties that have "window" in them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit windowTitle, windowModality, windowIcon and so on are named that way to be similar to the ones in QWidget. However QQuickWindow inherits all of the declared properties, and we would like to have shorter property names in QML. If you are working with a Window then it's obvious the title property is the window title. Unfortunately, there must be patches in many other modules which depend on this one. In order to avoid the need to merge them all at the same time, there is also patch https://codereview.qt-project.org/#change,39001 which temporarily adds backwards-compatible accessors, which can be removed after the other modules are able to build without them. We should not rename windowState to state, because in QML, state usually drives the state machine for animation transitions etc. (although QWindow is not an Item, a user might get confused about it). Related patches are https://codereview.qt-project.org/#change,39001 https://codereview.qt-project.org/#change,37764 https://codereview.qt-project.org/#change,37765 https://codereview.qt-project.org/#change,37766 https://codereview.qt-project.org/#change,37762 Change-Id: Ie4424ec15fbdef6b29b137f90a2ae33f173edd21 Reviewed-by: Samuel Rødal --- examples/gui/analogclock/main.cpp | 2 +- examples/opengl/hellowindow/hellowindow.cpp | 2 +- examples/opengl/hellowindow/main.cpp | 8 ++++---- examples/opengl/paintedwindow/paintedwindow.cpp | 18 +++++++++--------- examples/qpa/windows/main.cpp | 12 ++++++------ examples/qpa/windows/window.cpp | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) (limited to 'examples') diff --git a/examples/gui/analogclock/main.cpp b/examples/gui/analogclock/main.cpp index 87b5602946..acaf7c280b 100644 --- a/examples/gui/analogclock/main.cpp +++ b/examples/gui/analogclock/main.cpp @@ -61,7 +61,7 @@ private: //! [6] AnalogClockWindow::AnalogClockWindow() { - setWindowTitle("Analog Clock"); + setTitle("Analog Clock"); resize(200, 200); m_timerId = startTimer(1000); diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 7770949d45..b5166abe50 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -63,7 +63,7 @@ HelloWindow::HelloWindow(const QSharedPointer &renderer) : m_colorIndex(0), m_renderer(renderer), m_timer(0) { setSurfaceType(QWindow::OpenGLSurface); - setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); setGeometry(QRect(10, 10, 640, 480)); diff --git a/examples/opengl/hellowindow/main.cpp b/examples/opengl/hellowindow/main.cpp index 618a499286..343160f755 100644 --- a/examples/opengl/hellowindow/main.cpp +++ b/examples/opengl/hellowindow/main.cpp @@ -71,7 +71,7 @@ int main(int argc, char **argv) HelloWindow *windowA = new HelloWindow(rendererA); windowA->setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0)); - windowA->setWindowTitle(QLatin1String("Thread A - Context A")); + windowA->setTitle(QLatin1String("Thread A - Context A")); windowA->setVisible(true); windows.prepend(windowA); @@ -85,13 +85,13 @@ int main(int argc, char **argv) HelloWindow *windowB = new HelloWindow(rendererA); windowB->setGeometry(QRect(center, windowSize).translated(delta / 2, 0)); - windowB->setWindowTitle(QLatin1String("Thread A - Context A")); + windowB->setTitle(QLatin1String("Thread A - Context A")); windowB->setVisible(true); windows.prepend(windowB); HelloWindow *windowC = new HelloWindow(rendererB); windowC->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta)); - windowC->setWindowTitle(QLatin1String("Thread B - Context B")); + windowC->setTitle(QLatin1String("Thread B - Context B")); windowC->setVisible(true); windows.prepend(windowC); @@ -113,7 +113,7 @@ int main(int argc, char **argv) window->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, -windowSize.height() / 2)); QChar id = QChar('B' + i); - window->setWindowTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id); + window->setTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id); window->setVisible(true); windows.prepend(window); } diff --git a/examples/opengl/paintedwindow/paintedwindow.cpp b/examples/opengl/paintedwindow/paintedwindow.cpp index 911011a303..0920e6e89d 100644 --- a/examples/opengl/paintedwindow/paintedwindow.cpp +++ b/examples/opengl/paintedwindow/paintedwindow.cpp @@ -56,7 +56,7 @@ PaintedWindow::PaintedWindow() format.setSamples(4); setSurfaceType(QWindow::OpenGLSurface); - setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); setFormat(format); create(); @@ -70,12 +70,12 @@ PaintedWindow::PaintedWindow() m_animation->setEndValue(qreal(1)); m_animation->setDuration(500); - requestWindowOrientation(Qt::PortraitOrientation); + requestOrientation(Qt::PortraitOrientation); QRect screenGeometry = screen()->availableGeometry(); QPoint center = screenGeometry.center(); - QRect windowRect = screen()->isLandscape(windowOrientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640); + QRect windowRect = screen()->isLandscape(orientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640); setGeometry(QRect(center - windowRect.center(), windowRect.size())); m_rotation = 0; @@ -142,13 +142,13 @@ void PaintedWindow::orientationChanged(Qt::ScreenOrientation newOrientation) QPainter p; p.begin(&m_prevImage); - p.setTransform(screen()->transformBetween(contentOrientation(), windowOrientation(), rect)); - paint(&p, screen()->mapBetween(contentOrientation(), windowOrientation(), rect)); + p.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect)); + paint(&p, screen()->mapBetween(contentOrientation(), orientation(), rect)); p.end(); p.begin(&m_nextImage); - p.setTransform(screen()->transformBetween(newOrientation, windowOrientation(), rect)); - paint(&p, screen()->mapBetween(newOrientation, windowOrientation(), rect)); + p.setTransform(screen()->transformBetween(newOrientation, orientation(), rect)); + paint(&p, screen()->mapBetween(newOrientation, orientation(), rect)); p.end(); m_deltaRotation = screen()->angleBetween(newOrientation, contentOrientation()); @@ -207,9 +207,9 @@ void PaintedWindow::paint() painter.setOpacity(m_rotation); painter.drawImage(0, 0, m_nextImage); } else { - QRect mapped = screen()->mapBetween(contentOrientation(), windowOrientation(), rect); + QRect mapped = screen()->mapBetween(contentOrientation(), orientation(), rect); - painter.setTransform(screen()->transformBetween(contentOrientation(), windowOrientation(), rect)); + painter.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect)); paint(&painter, mapped); painter.end(); } diff --git a/examples/qpa/windows/main.cpp b/examples/qpa/windows/main.cpp index da189ab447..4313dadc83 100644 --- a/examples/qpa/windows/main.cpp +++ b/examples/qpa/windows/main.cpp @@ -53,14 +53,14 @@ int main(int argc, char **argv) Window a; a.setFramePos(QPoint(10, 10)); - a.setWindowTitle(QStringLiteral("Window A")); - a.setObjectName(a.windowTitle()); + a.setTitle(QStringLiteral("Window A")); + a.setObjectName(a.title()); a.setVisible(true); Window b; b.setFramePos(QPoint(100, 100)); - b.setWindowTitle(QStringLiteral("Window B")); - b.setObjectName(b.windowTitle()); + b.setTitle(QStringLiteral("Window B")); + b.setObjectName(b.title()); b.setVisible(true); Window child(&b); @@ -79,8 +79,8 @@ int main(int argc, char **argv) geometry.moveCenter(screen->availableGeometry().center()); window->setGeometry(geometry); window->setVisible(true); - window->setWindowTitle(screen->name()); - window->setObjectName(window->windowTitle()); + window->setTitle(screen->name()); + window->setObjectName(window->title()); windows.push_back(window); } return app.exec(); diff --git a/examples/qpa/windows/window.cpp b/examples/qpa/windows/window.cpp index a9f29274ac..c64ec650e5 100644 --- a/examples/qpa/windows/window.cpp +++ b/examples/qpa/windows/window.cpp @@ -73,7 +73,7 @@ void Window::initialize() if (parent()) setGeometry(QRect(160, 120, 320, 240)); else { - setWindowFlags(windowFlags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint + setFlags(flags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); const QSize baseSize = QSize(640, 480); setGeometry(QRect(geometry().topLeft(), baseSize)); -- cgit v1.2.3