From 5e63a05ea53ea35e895d1b7e3c9bc5bba4f18540 2015-10-30 07:44:29 From: Miikka Heikkinen Date: 2015-10-30 07:44:29 Subject: [PATCH] Use Item instead of Rectangle as a background item where possible Using Rectangle as background is not recommended if it is only for color. It is more efficient to simply set the window color. Change-Id: I3447ca394d74fa415bde4e9d2f210c81f354555e Reviewed-by: Titta Heikkala --- diff --git a/examples/charts/qmlaxes/qml/qmlaxes/View1.qml b/examples/charts/qmlaxes/qml/qmlaxes/View1.qml index f5b2554..daa381d 100644 --- a/examples/charts/qmlaxes/qml/qmlaxes/View1.qml +++ b/examples/charts/qmlaxes/qml/qmlaxes/View1.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlaxes/qml/qmlaxes/View2.qml b/examples/charts/qmlaxes/qml/qmlaxes/View2.qml index 8e46060..8ce450c 100644 --- a/examples/charts/qmlaxes/qml/qmlaxes/View2.qml +++ b/examples/charts/qmlaxes/qml/qmlaxes/View2.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlaxes/qml/qmlaxes/View3.qml b/examples/charts/qmlaxes/qml/qmlaxes/View3.qml index 4e408e2..1fe1900 100644 --- a/examples/charts/qmlaxes/qml/qmlaxes/View3.qml +++ b/examples/charts/qmlaxes/qml/qmlaxes/View3.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlaxes/qml/qmlaxes/main.qml b/examples/charts/qmlaxes/qml/qmlaxes/main.qml index 39bea70..3b54e58 100644 --- a/examples/charts/qmlaxes/qml/qmlaxes/main.qml +++ b/examples/charts/qmlaxes/qml/qmlaxes/main.qml @@ -21,7 +21,7 @@ import QtQuick 2.0 -Rectangle { +Item { width: 440 height: 330 property bool sourceLoaded: false diff --git a/examples/charts/qmlchart/qml/qmlchart/View1.qml b/examples/charts/qmlchart/qml/qmlchart/View1.qml index 84f6c96..8edf0b7 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View1.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View1.qml @@ -24,7 +24,7 @@ import QtQuick 2.0 //![2] import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent property variant othersSlice: 0 diff --git a/examples/charts/qmlchart/qml/qmlchart/View10.qml b/examples/charts/qmlchart/qml/qmlchart/View10.qml index 20f8ba3..b324f70 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View10.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View10.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View11.qml b/examples/charts/qmlchart/qml/qmlchart/View11.qml index 0e25094..9310fbd 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View11.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View11.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View12.qml b/examples/charts/qmlchart/qml/qmlchart/View12.qml index bc9b473..5b99710 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View12.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View12.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View2.qml b/examples/charts/qmlchart/qml/qmlchart/View2.qml index 65298f6..c94587c 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View2.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View2.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View3.qml b/examples/charts/qmlchart/qml/qmlchart/View3.qml index e53a1c1..9abf873 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View3.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View3.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View4.qml b/examples/charts/qmlchart/qml/qmlchart/View4.qml index 0973d48..ae6702d 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View4.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View4.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View5.qml b/examples/charts/qmlchart/qml/qmlchart/View5.qml index 7b35aee..44e8b98 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View5.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View5.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View6.qml b/examples/charts/qmlchart/qml/qmlchart/View6.qml index c277f32..56f4d08 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View6.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View6.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View7.qml b/examples/charts/qmlchart/qml/qmlchart/View7.qml index aaadafb..0e0c1a4 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View7.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View7.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View8.qml b/examples/charts/qmlchart/qml/qmlchart/View8.qml index 8cd4ca9..f3caa6b 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View8.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View8.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/View9.qml b/examples/charts/qmlchart/qml/qmlchart/View9.qml index 5481622..4f2e075 100644 --- a/examples/charts/qmlchart/qml/qmlchart/View9.qml +++ b/examples/charts/qmlchart/qml/qmlchart/View9.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlchart/qml/qmlchart/main.qml b/examples/charts/qmlchart/qml/qmlchart/main.qml index a4cbf3f..f940d8e 100644 --- a/examples/charts/qmlchart/qml/qmlchart/main.qml +++ b/examples/charts/qmlchart/qml/qmlchart/main.qml @@ -23,7 +23,7 @@ import QtQuick 2.0 //![1] -Rectangle { +Item { width: 600 height: 400 property bool sourceLoaded: false diff --git a/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml b/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml index 5392e92..313f41d 100644 --- a/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml +++ b/examples/charts/qmlcustomizations/qml/qmlcustomizations/main.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { width: 400 height: 300 property int __activeIndex: 1 diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml index e2ce45d..901efaf 100644 --- a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml +++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/ChartViewSelector.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { id: chartViewSelector width: parent.width height: parent.height diff --git a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml index ae45667..a21a878 100644 --- a/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml +++ b/examples/charts/qmlcustomlegend/qml/qmlcustomlegend/main.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { id: main width: 400 height: 320 diff --git a/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml b/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml index 3d3b954..0376975 100644 --- a/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml +++ b/examples/charts/qmlf1legends/qml/qmlf1legends/main.qml @@ -23,7 +23,7 @@ import QtQuick 2.0 import QtCharts 2.0 import QtQuick.XmlListModel 2.0 -Rectangle { +Item { width: 400 height: 300 property int currentIndex: -1 diff --git a/examples/charts/qmloscilloscope/main.cpp b/examples/charts/qmloscilloscope/main.cpp index 29d8da7..f4c2f65 100644 --- a/examples/charts/qmloscilloscope/main.cpp +++ b/examples/charts/qmloscilloscope/main.cpp @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) viewer.setSource(QUrl("qrc:/qml/qmloscilloscope/main.qml")); viewer.setResizeMode(QQuickView::SizeRootObjectToView); + viewer.setColor(QColor("#404040")); viewer.show(); return app.exec(); diff --git a/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml b/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml index 10cf0cf..808fed0 100644 --- a/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml +++ b/examples/charts/qmloscilloscope/qml/qmloscilloscope/main.qml @@ -22,11 +22,10 @@ import QtQuick 2.0 //![1] -Rectangle { +Item { id: main width: 600 height: 400 - color: "#404040" ControlPanel { id: controlPanel diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml index 32ae052..5bb6971 100644 --- a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml +++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View1.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] PolarChartView { diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml index 12530e9..0241f63 100644 --- a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml +++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View2.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml index 289f3c8..3ec3b3d 100644 --- a/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml +++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/View3.qml @@ -22,7 +22,7 @@ import QtQuick 2.0 import QtCharts 2.0 -Rectangle { +Item { anchors.fill: parent //![1] diff --git a/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml b/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml index e4cafb1..5aacec4 100644 --- a/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml +++ b/examples/charts/qmlpolarchart/qml/qmlpolarchart/main.qml @@ -21,7 +21,7 @@ import QtQuick 2.0 -Rectangle { +Item { width: 800 height: 600 property bool sourceLoaded: false