summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <[email protected]>2012-10-22 12:47:34 +0200
committerThe Qt Project <[email protected]>2012-11-07 21:26:08 +0100
commitcd34da54269e6cd7fa5c18242d982736f022a14a (patch)
tree841d021b924f04dfcb7068fdbd9a428b9ce78c2f /examples
parenta454ccb89ec2296234ee7328095f27ad7cb2361f (diff)
Rename all QWindow properties that have "window" in them
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 <[email protected]>
Diffstat (limited to 'examples')
-rw-r--r--examples/gui/analogclock/main.cpp2
-rw-r--r--examples/opengl/hellowindow/hellowindow.cpp2
-rw-r--r--examples/opengl/hellowindow/main.cpp8
-rw-r--r--examples/opengl/paintedwindow/paintedwindow.cpp18
-rw-r--r--examples/qpa/windows/main.cpp12
-rw-r--r--examples/qpa/windows/window.cpp2
6 files changed, 22 insertions, 22 deletions
diff --git a/examples/gui/analogclock/main.cpp b/examples/gui/analogclock/main.cpp
index 87b56029467..acaf7c280b6 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 7770949d453..b5166abe507 100644
--- a/examples/opengl/hellowindow/hellowindow.cpp
+++ b/examples/opengl/hellowindow/hellowindow.cpp
@@ -63,7 +63,7 @@ HelloWindow::HelloWindow(const QSharedPointer<Renderer> &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 618a499286a..343160f7556 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 911011a3036..0920e6e89d1 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 da189ab4475..4313dadc838 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 a9f29274ace..c64ec650e53 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));