From 38be0d13830efd2d98281c645c3a60afe05ffece Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 12:05:43 +0200 Subject: Initial import from the monolithic Qt. This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12 --- tests/benchmarks/gui/animation/animation.pro | 2 + .../gui/animation/qanimation/dummyanimation.cpp | 61 + .../gui/animation/qanimation/dummyanimation.h | 60 + .../gui/animation/qanimation/dummyobject.cpp | 66 + .../gui/animation/qanimation/dummyobject.h | 64 + tests/benchmarks/gui/animation/qanimation/main.cpp | 191 + .../gui/animation/qanimation/qanimation.pro | 18 + .../gui/animation/qanimation/rectanimation.cpp | 94 + .../gui/animation/qanimation/rectanimation.h | 70 + .../GraphicsViewBenchmark.pro | 71 + .../GraphicsViewBenchmark.qrc | 85 + .../functional/GraphicsViewBenchmark/main.cpp | 805 ++++ .../resources/avatars/avatar_man_001_58x58.png | Bin 0 -> 6598 bytes .../resources/avatars/avatar_man_002_58x58.png | Bin 0 -> 6687 bytes .../resources/avatars/avatar_man_003_58x58.png | Bin 0 -> 6261 bytes .../resources/avatars/avatar_man_004_58x58.png | Bin 0 -> 6783 bytes .../resources/avatars/avatar_man_005_58x58.png | Bin 0 -> 6317 bytes .../resources/avatars/avatar_man_006_58x58.png | Bin 0 -> 7020 bytes .../resources/avatars/avatar_man_007_58x58.png | Bin 0 -> 3706 bytes .../resources/avatars/avatar_man_008_58x58.png | Bin 0 -> 6749 bytes .../resources/avatars/avatar_man_009_58x58.png | Bin 0 -> 5436 bytes .../resources/avatars/avatar_man_010_58x58.png | Bin 0 -> 1454 bytes .../resources/avatars/avatar_picture_001_58x58.png | Bin 0 -> 2983 bytes .../resources/avatars/avatar_picture_002_58x58.png | Bin 0 -> 3463 bytes .../resources/avatars/avatar_picture_003_58x58.png | Bin 0 -> 763 bytes .../resources/avatars/avatar_picture_004_58x58.png | Bin 0 -> 2252 bytes .../resources/avatars/avatar_picture_005_58x58.png | Bin 0 -> 2451 bytes .../resources/avatars/avatar_woman_001_58x58.png | Bin 0 -> 6330 bytes .../resources/avatars/avatar_woman_002_58x58.png | Bin 0 -> 6237 bytes .../resources/avatars/avatar_woman_003_58x58.png | Bin 0 -> 6192 bytes .../resources/avatars/avatar_woman_004_58x58.png | Bin 0 -> 7489 bytes .../resources/avatars/avatar_woman_005_58x58.png | Bin 0 -> 6764 bytes .../resources/avatars/avatar_woman_006_58x58.png | Bin 0 -> 6218 bytes .../resources/avatars/avatar_woman_007_58x58.png | Bin 0 -> 6122 bytes .../resources/avatars/avatar_woman_008_58x58.png | Bin 0 -> 6658 bytes .../resources/avatars/avatar_woman_009_58x58.png | Bin 0 -> 8293 bytes .../resources/avatars/avatar_woman_010_58x58.png | Bin 0 -> 4783 bytes .../blue_SVG/blue_background_360x640px.svg | 14 + .../blue_background_horisontal_640x360px.svg | 16 + .../blue_SVG/blue_contact_default_icon_52x52px.svg | 22 + .../blue_contact_list_divider_360x76px.svg | 7 + .../blue_contact_list_highlighter_360x76px.svg | 10 + .../blue_SVG/blue_contact_status_idle_33x33px.svg | 55 + .../blue_contact_status_offline_33x33px.svg | 55 + .../blue_contact_status_online_33x33px.svg | 56 + .../resources/blue_SVG/blue_scroll_16x80px.svg | 39 + .../resources/blue_SVG/blue_scrollbar_7x14px.svg | 7 + .../blue_SVG/blue_status_field_left_14x24px.svg | 24 + .../blue_SVG/blue_status_field_middle_14x24px.svg | 11 + .../blue_SVG/blue_status_field_right_14x24px.svg | 13 + .../resources/blue_SVG/blue_topbar_356x96px.svg | 2007 ++++++++++ .../blue_SVG/blue_topbar_horisontal_636x96px.svg | 4060 ++++++++++++++++++++ .../blue_SVG/blue_user_default_icon_68x68px.svg | 22 + .../blue_SVG/blue_user_status_idle_38x38px.svg | 55 + .../blue_SVG/blue_user_status_offline_38x38px.svg | 55 + .../blue_SVG/blue_user_status_online_38x38px.svg | 55 + .../resources/contacts/areacodes.txt | 62 + .../resources/contacts/firstnamesF.txt | 100 + .../resources/contacts/firstnamesM.txt | 100 + .../resources/contacts/lastnames.txt | 150 + .../lime_SVG/lime_background_360x640px.svg | 40 + .../lime_background_horisontal_640x360px.svg | 39 + .../lime_SVG/lime_contact_default_icon_53x53px.svg | 30 + ...lime_contact_default_icon_highlight_53x53px.svg | 31 + .../lime_contact_list_divider_360x76px.svg | 7 + .../lime_contact_list_highlighter_357x80px.svg | 11 + .../lime_SVG/lime_contact_status_idle_27x47.svg | 63 + .../lime_SVG/lime_contact_status_offline_27x47.svg | 58 + .../lime_SVG/lime_contact_status_online_27x47.svg | 63 + .../resources/lime_SVG/lime_scroll_5x80px.svg | 12 + .../resources/lime_SVG/lime_scrollbar_5x14px.svg | 7 + .../lime_SVG/lime_status_field_left_14x24px.svg | 30 + .../lime_SVG/lime_status_field_middle_10x24px.svg | 18 + .../lime_SVG/lime_status_field_right_14x24px.svg | 19 + .../resources/lime_SVG/lime_topbar_356x96px.svg | 26 + .../lime_SVG/lime_topbar_horisontal_636x96px.svg | 26 + .../lime_SVG/lime_user_default_icon_84x68px.svg | 32 + .../lime_SVG/lime_user_status_idle_24x24px.svg | 53 + .../lime_SVG/lime_user_status_offline_24x24px.svg | 53 + .../lime_SVG/lime_user_status_online_24x24px.svg | 53 + .../widgets/abstractitemcontainer.cpp | 401 ++ .../widgets/abstractitemcontainer.h | 111 + .../widgets/abstractitemview.cpp | 443 +++ .../widgets/abstractitemview.h | 118 + .../widgets/abstractscrollarea.cpp | 249 ++ .../widgets/abstractscrollarea.h | 101 + .../widgets/abstractviewitem.cpp | 117 + .../widgets/abstractviewitem.h | 96 + .../widgets/backgrounditem.cpp | 85 + .../GraphicsViewBenchmark/widgets/backgrounditem.h | 72 + .../GraphicsViewBenchmark/widgets/button.cpp | 209 + .../GraphicsViewBenchmark/widgets/button.h | 102 + .../GraphicsViewBenchmark/widgets/commandline.cpp | 196 + .../GraphicsViewBenchmark/widgets/commandline.h | 52 + .../GraphicsViewBenchmark/widgets/dummydatagen.cpp | 141 + .../GraphicsViewBenchmark/widgets/dummydatagen.h | 72 + .../GraphicsViewBenchmark/widgets/gvbwidget.cpp | 59 + .../GraphicsViewBenchmark/widgets/gvbwidget.h | 58 + .../GraphicsViewBenchmark/widgets/iconitem.cpp | 169 + .../GraphicsViewBenchmark/widgets/iconitem.h | 96 + .../widgets/itemrecyclinglist.cpp | 275 ++ .../widgets/itemrecyclinglist.h | 85 + .../widgets/itemrecyclinglist.pri | 19 + .../widgets/itemrecyclinglistview.cpp | 79 + .../widgets/itemrecyclinglistview.h | 67 + .../GraphicsViewBenchmark/widgets/label.cpp | 98 + .../GraphicsViewBenchmark/widgets/label.h | 76 + .../GraphicsViewBenchmark/widgets/listitem.cpp | 314 ++ .../GraphicsViewBenchmark/widgets/listitem.h | 109 + .../widgets/listitemcache.cpp | 92 + .../GraphicsViewBenchmark/widgets/listitemcache.h | 69 + .../widgets/listitemcontainer.cpp | 211 + .../widgets/listitemcontainer.h | 92 + .../GraphicsViewBenchmark/widgets/listmodel.cpp | 146 + .../GraphicsViewBenchmark/widgets/listmodel.h | 82 + .../GraphicsViewBenchmark/widgets/listwidget.cpp | 132 + .../GraphicsViewBenchmark/widgets/listwidget.h | 87 + .../GraphicsViewBenchmark/widgets/mainview.cpp | 344 ++ .../GraphicsViewBenchmark/widgets/mainview.h | 123 + .../GraphicsViewBenchmark/widgets/menu.cpp | 202 + .../GraphicsViewBenchmark/widgets/menu.h | 84 + .../widgets/recycledlistitem.cpp | 147 + .../widgets/recycledlistitem.h | 83 + .../widgets/resourcemoninterface.h | 97 + .../GraphicsViewBenchmark/widgets/scrollbar.cpp | 299 ++ .../GraphicsViewBenchmark/widgets/scrollbar.h | 97 + .../GraphicsViewBenchmark/widgets/scroller.cpp | 305 ++ .../GraphicsViewBenchmark/widgets/scroller.h | 79 + .../GraphicsViewBenchmark/widgets/scroller_p.h | 103 + .../GraphicsViewBenchmark/widgets/settings.cpp | 59 + .../GraphicsViewBenchmark/widgets/settings.h | 116 + .../GraphicsViewBenchmark/widgets/simplelist.cpp | 164 + .../GraphicsViewBenchmark/widgets/simplelist.h | 80 + .../widgets/simplelistview.cpp | 500 +++ .../GraphicsViewBenchmark/widgets/simplelistview.h | 92 + .../GraphicsViewBenchmark/widgets/theme.cpp | 240 ++ .../GraphicsViewBenchmark/widgets/theme.h | 134 + .../GraphicsViewBenchmark/widgets/themeevent.cpp | 53 + .../GraphicsViewBenchmark/widgets/themeevent.h | 64 + .../GraphicsViewBenchmark/widgets/topbar.cpp | 359 ++ .../GraphicsViewBenchmark/widgets/topbar.h | 126 + .../GraphicsViewBenchmark/widgets/webview.cpp | 304 ++ .../GraphicsViewBenchmark/widgets/webview.h | 81 + .../GraphicsViewBenchmark/widgets/webview_p.h | 99 + .../gui/graphicsview/functional/functional.pro | 3 + tests/benchmarks/gui/graphicsview/graphicsview.pro | 8 + .../qgraphicsanchorlayout.pro | 6 + .../tst_qgraphicsanchorlayout.cpp | 433 +++ .../graphicsview/qgraphicsitem/qgraphicsitem.pro | 5 + .../qgraphicsitem/tst_qgraphicsitem.cpp | 246 ++ .../qgraphicslinearlayout.pro | 6 + .../tst_qgraphicslinearlayout.cpp | 133 + .../graphicsview/qgraphicsscene/qgraphicsscene.pro | 6 + .../qgraphicsscene/tst_qgraphicsscene.cpp | 259 ++ .../qgraphicsview/benchapps/chipTest/chip.cpp | 176 + .../qgraphicsview/benchapps/chipTest/chip.debug | Bin 0 -> 863805 bytes .../qgraphicsview/benchapps/chipTest/chip.h | 68 + .../qgraphicsview/benchapps/chipTest/chip.pro | 19 + .../qgraphicsview/benchapps/chipTest/fileprint.png | Bin 0 -> 1456 bytes .../qgraphicsview/benchapps/chipTest/images.qrc | 10 + .../qgraphicsview/benchapps/chipTest/main.cpp | 57 + .../benchapps/chipTest/mainwindow.cpp | 87 + .../qgraphicsview/benchapps/chipTest/mainwindow.h | 66 + .../qgraphicsview/benchapps/chipTest/qt4logo.png | Bin 0 -> 48333 bytes .../benchapps/chipTest/rotateleft.png | Bin 0 -> 1754 bytes .../benchapps/chipTest/rotateright.png | Bin 0 -> 1732 bytes .../qgraphicsview/benchapps/chipTest/view.cpp | 264 ++ .../qgraphicsview/benchapps/chipTest/view.h | 86 + .../qgraphicsview/benchapps/chipTest/zoomin.png | Bin 0 -> 1622 bytes .../qgraphicsview/benchapps/chipTest/zoomout.png | Bin 0 -> 1601 bytes .../qgraphicsview/benchapps/moveItems/main.cpp | 112 + .../benchapps/moveItems/moveItems.pro | 1 + .../qgraphicsview/benchapps/scrolltest/main.cpp | 152 + .../benchapps/scrolltest/scrolltest.pro | 1 + .../graphicsview/qgraphicsview/chiptester/chip.cpp | 182 + .../graphicsview/qgraphicsview/chiptester/chip.h | 68 + .../qgraphicsview/chiptester/chiptester.cpp | 144 + .../qgraphicsview/chiptester/chiptester.h | 85 + .../qgraphicsview/chiptester/chiptester.pri | 12 + .../qgraphicsview/chiptester/images.qrc | 5 + .../qgraphicsview/chiptester/qt4logo.png | Bin 0 -> 48333 bytes .../graphicsview/qgraphicsview/images/designer.png | Bin 0 -> 4205 bytes .../qgraphicsview/images/wine-big.jpeg | Bin 0 -> 12249 bytes .../graphicsview/qgraphicsview/images/wine.jpeg | Bin 0 -> 2265 bytes .../graphicsview/qgraphicsview/qgraphicsview.pro | 16 + .../graphicsview/qgraphicsview/qgraphicsview.qrc | 9 + .../gui/graphicsview/qgraphicsview/random.data | Bin 0 -> 800 bytes .../qgraphicsview/tst_qgraphicsview.cpp | 917 +++++ .../qgraphicswidget/qgraphicswidget.pro | 6 + .../qgraphicswidget/tst_qgraphicswidget.cpp | 94 + tests/benchmarks/gui/gui.pro | 18 + .../benchmarks/gui/image/blendbench/blendbench.pro | 8 + tests/benchmarks/gui/image/blendbench/main.cpp | 227 ++ tests/benchmarks/gui/image/image.pro | 7 + .../image/qimageconversion/qimageconversion.pro | 10 + .../qimageconversion/tst_qimageconversion.cpp | 108 + .../gui/image/qimagereader/images/16bpp.bmp | Bin 0 -> 153654 bytes .../gui/image/qimagereader/images/4bpp-rle.bmp | Bin 0 -> 23662 bytes .../gui/image/qimagereader/images/YCbCr_cmyk.jpg | Bin 0 -> 3699 bytes .../gui/image/qimagereader/images/YCbCr_cmyk.png | Bin 0 -> 230 bytes .../gui/image/qimagereader/images/YCbCr_rgb.jpg | Bin 0 -> 2045 bytes .../gui/image/qimagereader/images/away.png | Bin 0 -> 753 bytes .../gui/image/qimagereader/images/ball.mng | Bin 0 -> 34394 bytes .../gui/image/qimagereader/images/bat1.gif | Bin 0 -> 953 bytes .../gui/image/qimagereader/images/bat2.gif | Bin 0 -> 980 bytes .../gui/image/qimagereader/images/beavis.jpg | Bin 0 -> 20688 bytes .../gui/image/qimagereader/images/black.png | Bin 0 -> 697 bytes .../gui/image/qimagereader/images/black.xpm | 65 + .../gui/image/qimagereader/images/colorful.bmp | Bin 0 -> 65002 bytes .../image/qimagereader/images/corrupt-colors.xpm | 26 + .../gui/image/qimagereader/images/corrupt-data.tif | Bin 0 -> 8590 bytes .../image/qimagereader/images/corrupt-pixels.xpm | 7 + .../gui/image/qimagereader/images/corrupt.bmp | Bin 0 -> 116 bytes .../gui/image/qimagereader/images/corrupt.gif | Bin 0 -> 2608 bytes .../gui/image/qimagereader/images/corrupt.jpg | Bin 0 -> 18 bytes .../gui/image/qimagereader/images/corrupt.mng | Bin 0 -> 183 bytes .../gui/image/qimagereader/images/corrupt.png | Bin 0 -> 95 bytes .../gui/image/qimagereader/images/corrupt.xbm | 5 + .../qimagereader/images/crash-signed-char.bmp | Bin 0 -> 45748 bytes .../gui/image/qimagereader/images/earth.gif | Bin 0 -> 51712 bytes .../gui/image/qimagereader/images/fire.mng | Bin 0 -> 44430 bytes .../gui/image/qimagereader/images/font.bmp | Bin 0 -> 1026 bytes .../gui/image/qimagereader/images/gnus.xbm | 622 +++ .../gui/image/qimagereader/images/image.pbm | 8 + .../gui/image/qimagereader/images/image.pgm | 10 + .../gui/image/qimagereader/images/image.png | Bin 0 -> 549 bytes .../gui/image/qimagereader/images/image.ppm | 7 + .../gui/image/qimagereader/images/kollada-noext | Bin 0 -> 13907 bytes .../gui/image/qimagereader/images/kollada.png | Bin 0 -> 13907 bytes .../gui/image/qimagereader/images/marble.xpm | 470 +++ .../gui/image/qimagereader/images/namedcolors.xpm | 18 + .../image/qimagereader/images/negativeheight.bmp | Bin 0 -> 24630 bytes .../gui/image/qimagereader/images/noclearcode.bmp | Bin 0 -> 326 bytes .../gui/image/qimagereader/images/noclearcode.gif | Bin 0 -> 130 bytes .../image/qimagereader/images/nontransparent.xpm | 788 ++++ .../images/rgba_adobedeflate_littleendian.tif | Bin 0 -> 4784 bytes .../qimagereader/images/rgba_lzw_littleendian.tif | Bin 0 -> 26690 bytes .../images/rgba_nocompression_bigendian.tif | Bin 0 -> 160384 bytes .../images/rgba_nocompression_littleendian.tif | Bin 0 -> 160388 bytes .../images/rgba_packbits_littleendian.tif | Bin 0 -> 161370 bytes .../images/rgba_zipdeflate_littleendian.tif | Bin 0 -> 14728 bytes .../gui/image/qimagereader/images/runners.ppm | Bin 0 -> 960016 bytes .../gui/image/qimagereader/images/task210380.jpg | Bin 0 -> 975535 bytes .../gui/image/qimagereader/images/teapot.ppm | 31 + .../gui/image/qimagereader/images/test.ppm | 2 + .../gui/image/qimagereader/images/test.xpm | 260 ++ .../gui/image/qimagereader/images/transparent.xpm | 788 ++++ .../gui/image/qimagereader/images/trolltech.gif | Bin 0 -> 42629 bytes .../gui/image/qimagereader/images/tst7.bmp | Bin 0 -> 582 bytes .../gui/image/qimagereader/images/tst7.png | Bin 0 -> 167 bytes .../gui/image/qimagereader/qimagereader.pro | 27 + .../gui/image/qimagereader/tst_qimagereader.cpp | 244 ++ tests/benchmarks/gui/image/qpixmap/qpixmap.pro | 5 + tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp | 315 ++ .../gui/image/qpixmapcache/qpixmapcache.pro | 6 + .../gui/image/qpixmapcache/tst_qpixmapcache.cpp | 226 ++ tests/benchmarks/gui/itemviews/itemviews.pro | 3 + .../gui/itemviews/qtableview/qtableview.pro | 6 + .../gui/itemviews/qtableview/tst_qtableview.cpp | 367 ++ tests/benchmarks/gui/kernel/kernel.pro | 4 + tests/benchmarks/gui/kernel/qapplication/main.cpp | 71 + .../gui/kernel/qapplication/qapplication.pro | 10 + .../gui/kernel/qguimetatype/qguimetatype.pro | 6 + .../gui/kernel/qguimetatype/tst_qguimetatype.cpp | 113 + .../gui/kernel/qguivariant/qguivariant.pro | 6 + .../gui/kernel/qguivariant/tst_qguivariant.cpp | 111 + tests/benchmarks/gui/kernel/qwidget/qwidget.pro | 4 + .../benchmarks/gui/kernel/qwidget/tst_qwidget.cpp | 260 ++ tests/benchmarks/gui/math3d/math3d.pro | 4 + .../gui/math3d/qmatrix4x4/qmatrix4x4.pro | 6 + .../gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp | 672 ++++ .../gui/math3d/qquaternion/qquaternion.pro | 6 + .../gui/math3d/qquaternion/tst_qquaternion.cpp | 124 + tests/benchmarks/gui/painting/painting.pro | 7 + .../benchmarks/gui/painting/qpainter/qpainter.pro | 5 + .../gui/painting/qpainter/tst_qpainter.cpp | 1666 ++++++++ tests/benchmarks/gui/painting/qregion/main.cpp | 139 + tests/benchmarks/gui/painting/qregion/qregion.pro | 10 + .../gui/painting/qtbench/benchmarktests.h | 841 ++++ tests/benchmarks/gui/painting/qtbench/qtbench.pro | 6 + .../gui/painting/qtbench/tst_qtbench.cpp | 254 ++ .../gui/painting/qtracebench/qtracebench.pro | 10 + .../gui/painting/qtracebench/qtracebench.qrc | 10 + .../painting/qtracebench/traces/basicdrawing.trace | Bin 0 -> 366739 bytes .../gui/painting/qtracebench/traces/creator.trace | Bin 0 -> 541031 bytes .../qtracebench/traces/qmlphoneconcept.trace | Bin 0 -> 337439 bytes .../painting/qtracebench/traces/qmlsamegame.trace | Bin 0 -> 246423 bytes .../gui/painting/qtracebench/traces/textedit.trace | Bin 0 -> 60042 bytes .../gui/painting/qtracebench/traces/webkit.trace | Bin 0 -> 451391 bytes .../gui/painting/qtracebench/tst_qtracebench.cpp | 262 ++ .../gui/painting/qtransform/qtransform.pro | 6 + .../gui/painting/qtransform/tst_qtransform.cpp | 592 +++ .../gui/styles/qstylesheetstyle/main.cpp | 201 + .../styles/qstylesheetstyle/qstylesheetstyle.pro | 11 + tests/benchmarks/gui/styles/styles.pro | 3 + tests/benchmarks/gui/text/qfontmetrics/main.cpp | 112 + .../gui/text/qfontmetrics/qfontmetrics.pro | 5 + tests/benchmarks/gui/text/qtext/bidi.txt | 4 + tests/benchmarks/gui/text/qtext/main.cpp | 500 +++ tests/benchmarks/gui/text/qtext/qtext.pro | 14 + tests/benchmarks/gui/text/text.pro | 4 + 301 files changed, 33152 insertions(+) create mode 100644 tests/benchmarks/gui/animation/animation.pro create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyanimation.h create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyobject.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/dummyobject.h create mode 100644 tests/benchmarks/gui/animation/qanimation/main.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/qanimation.pro create mode 100644 tests/benchmarks/gui/animation/qanimation/rectanimation.cpp create mode 100644 tests/benchmarks/gui/animation/qanimation/rectanimation.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.pro create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_001_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_002_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_003_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_004_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_005_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_006_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_007_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_008_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_009_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_010_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_001_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_002_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_003_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_004_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_005_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_001_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_002_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_003_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_004_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_005_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_006_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_007_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_008_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_009_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_010_58x58.png create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_360x640px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_horisontal_640x360px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_default_icon_52x52px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_divider_360x76px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_highlighter_360x76px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_idle_33x33px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_offline_33x33px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_online_33x33px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scroll_16x80px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scrollbar_7x14px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_left_14x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_middle_14x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_right_14x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_356x96px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_horisontal_636x96px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_default_icon_68x68px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_idle_38x38px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_offline_38x38px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_online_38x38px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/areacodes.txt create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesF.txt create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesM.txt create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/lastnames.txt create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_360x640px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_horisontal_640x360px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_53x53px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_highlight_53x53px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_divider_360x76px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_highlighter_357x80px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_idle_27x47.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_offline_27x47.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_online_27x47.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scroll_5x80px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scrollbar_5x14px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_left_14x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_middle_10x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_right_14x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_356x96px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_horisontal_636x96px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_default_icon_84x68px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_idle_24x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_offline_24x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_online_24x24px.svg create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.pri create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcache.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitemcontainer.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listmodel.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listwidget.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/mainview.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/menu.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/recycledlistitem.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/resourcemoninterface.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scrollbar.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/scroller_p.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/settings.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelist.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/simplelistview.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/theme.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/topbar.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/webview_p.h create mode 100644 tests/benchmarks/gui/graphicsview/functional/functional.pro create mode 100644 tests/benchmarks/gui/graphicsview/graphicsview.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.debug create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/chip.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/fileprint.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/images.qrc create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/qt4logo.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateleft.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/rotateright.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomin.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/zoomout.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/moveItems.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/scrolltest.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chip.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.pri create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/images.qrc create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/qt4logo.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/images/designer.png create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine-big.jpeg create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/images/wine.jpeg create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.qrc create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/random.data create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp create mode 100644 tests/benchmarks/gui/gui.pro create mode 100644 tests/benchmarks/gui/image/blendbench/blendbench.pro create mode 100644 tests/benchmarks/gui/image/blendbench/main.cpp create mode 100644 tests/benchmarks/gui/image/image.pro create mode 100644 tests/benchmarks/gui/image/qimageconversion/qimageconversion.pro create mode 100644 tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/16bpp.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/4bpp-rle.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/YCbCr_cmyk.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/YCbCr_rgb.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/away.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/ball.mng create mode 100644 tests/benchmarks/gui/image/qimagereader/images/bat1.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/bat2.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/beavis.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/black.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/black.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/colorful.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt-colors.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt-data.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt-pixels.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.mng create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/corrupt.xbm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/crash-signed-char.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/earth.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/fire.mng create mode 100644 tests/benchmarks/gui/image/qimagereader/images/font.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/gnus.xbm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.pbm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.pgm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/image.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/kollada-noext create mode 100644 tests/benchmarks/gui/image/qimagereader/images/kollada.png create mode 100644 tests/benchmarks/gui/image/qimagereader/images/marble.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/namedcolors.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/negativeheight.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/noclearcode.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/noclearcode.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/nontransparent.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_adobedeflate_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_lzw_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_bigendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_nocompression_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_packbits_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/rgba_zipdeflate_littleendian.tif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/runners.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/task210380.jpg create mode 100644 tests/benchmarks/gui/image/qimagereader/images/teapot.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/test.ppm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/test.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/transparent.xpm create mode 100644 tests/benchmarks/gui/image/qimagereader/images/trolltech.gif create mode 100644 tests/benchmarks/gui/image/qimagereader/images/tst7.bmp create mode 100644 tests/benchmarks/gui/image/qimagereader/images/tst7.png create mode 100644 tests/benchmarks/gui/image/qimagereader/qimagereader.pro create mode 100644 tests/benchmarks/gui/image/qimagereader/tst_qimagereader.cpp create mode 100644 tests/benchmarks/gui/image/qpixmap/qpixmap.pro create mode 100644 tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp create mode 100644 tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro create mode 100644 tests/benchmarks/gui/image/qpixmapcache/tst_qpixmapcache.cpp create mode 100644 tests/benchmarks/gui/itemviews/itemviews.pro create mode 100644 tests/benchmarks/gui/itemviews/qtableview/qtableview.pro create mode 100644 tests/benchmarks/gui/itemviews/qtableview/tst_qtableview.cpp create mode 100644 tests/benchmarks/gui/kernel/kernel.pro create mode 100644 tests/benchmarks/gui/kernel/qapplication/main.cpp create mode 100644 tests/benchmarks/gui/kernel/qapplication/qapplication.pro create mode 100644 tests/benchmarks/gui/kernel/qguimetatype/qguimetatype.pro create mode 100644 tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp create mode 100644 tests/benchmarks/gui/kernel/qguivariant/qguivariant.pro create mode 100644 tests/benchmarks/gui/kernel/qguivariant/tst_qguivariant.cpp create mode 100644 tests/benchmarks/gui/kernel/qwidget/qwidget.pro create mode 100644 tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp create mode 100644 tests/benchmarks/gui/math3d/math3d.pro create mode 100644 tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro create mode 100644 tests/benchmarks/gui/math3d/qmatrix4x4/tst_qmatrix4x4.cpp create mode 100644 tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro create mode 100644 tests/benchmarks/gui/math3d/qquaternion/tst_qquaternion.cpp create mode 100644 tests/benchmarks/gui/painting/painting.pro create mode 100644 tests/benchmarks/gui/painting/qpainter/qpainter.pro create mode 100644 tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp create mode 100644 tests/benchmarks/gui/painting/qregion/main.cpp create mode 100644 tests/benchmarks/gui/painting/qregion/qregion.pro create mode 100644 tests/benchmarks/gui/painting/qtbench/benchmarktests.h create mode 100644 tests/benchmarks/gui/painting/qtbench/qtbench.pro create mode 100644 tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp create mode 100644 tests/benchmarks/gui/painting/qtracebench/qtracebench.pro create mode 100644 tests/benchmarks/gui/painting/qtracebench/qtracebench.qrc create mode 100644 tests/benchmarks/gui/painting/qtracebench/traces/basicdrawing.trace create mode 100644 tests/benchmarks/gui/painting/qtracebench/traces/creator.trace create mode 100644 tests/benchmarks/gui/painting/qtracebench/traces/qmlphoneconcept.trace create mode 100644 tests/benchmarks/gui/painting/qtracebench/traces/qmlsamegame.trace create mode 100644 tests/benchmarks/gui/painting/qtracebench/traces/textedit.trace create mode 100644 tests/benchmarks/gui/painting/qtracebench/traces/webkit.trace create mode 100644 tests/benchmarks/gui/painting/qtracebench/tst_qtracebench.cpp create mode 100644 tests/benchmarks/gui/painting/qtransform/qtransform.pro create mode 100644 tests/benchmarks/gui/painting/qtransform/tst_qtransform.cpp create mode 100644 tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp create mode 100644 tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro create mode 100644 tests/benchmarks/gui/styles/styles.pro create mode 100644 tests/benchmarks/gui/text/qfontmetrics/main.cpp create mode 100644 tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro create mode 100644 tests/benchmarks/gui/text/qtext/bidi.txt create mode 100644 tests/benchmarks/gui/text/qtext/main.cpp create mode 100644 tests/benchmarks/gui/text/qtext/qtext.pro create mode 100644 tests/benchmarks/gui/text/text.pro (limited to 'tests/benchmarks/gui') diff --git a/tests/benchmarks/gui/animation/animation.pro b/tests/benchmarks/gui/animation/animation.pro new file mode 100644 index 0000000000..a4ba273fec --- /dev/null +++ b/tests/benchmarks/gui/animation/animation.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = qanimation diff --git a/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp b/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp new file mode 100644 index 0000000000..138ec45df9 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyanimation.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dummyanimation.h" +#include "dummyobject.h" + + +DummyAnimation::DummyAnimation(DummyObject *d) : m_dummy(d) +{ +} + +void DummyAnimation::updateCurrentValue(const QVariant &value) +{ + if (state() == Stopped) + return; + if (m_dummy) + m_dummy->setRect(value.toRect()); +} + +void DummyAnimation::updateState(State state) +{ + Q_UNUSED(state); +} diff --git a/tests/benchmarks/gui/animation/qanimation/dummyanimation.h b/tests/benchmarks/gui/animation/qanimation/dummyanimation.h new file mode 100644 index 0000000000..73f491bcb7 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyanimation.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef _DUMMYANIMATION_H__ + +class DummyObject; + +class DummyAnimation : public QVariantAnimation +{ +public: + DummyAnimation(DummyObject *d); + + void updateCurrentValue(const QVariant &value); + void updateState(State state); + +private: + DummyObject *m_dummy; +}; + +#endif diff --git a/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp b/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp new file mode 100644 index 0000000000..9178ceff6c --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyobject.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "dummyobject.h" + +DummyObject::DummyObject() +{ +} + +QRect DummyObject::rect() const +{ + return m_rect; +} + +void DummyObject::setRect(const QRect &r) +{ + m_rect = r; +} + +float DummyObject::opacity() const +{ + return m_opacity; +} + +void DummyObject::setOpacity(float o) +{ + m_opacity = o; +} diff --git a/tests/benchmarks/gui/animation/qanimation/dummyobject.h b/tests/benchmarks/gui/animation/qanimation/dummyobject.h new file mode 100644 index 0000000000..81f6b8ef82 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/dummyobject.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef _DUMMYOBJECT_H__ + +class DummyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(QRect rect READ rect WRITE setRect) + Q_PROPERTY(float opacity READ opacity WRITE setOpacity) +public: + DummyObject(); + QRect rect() const; + void setRect(const QRect &r); + float opacity() const; + void setOpacity(float); + +private: + QRect m_rect; + float m_opacity; +}; + + +#endif diff --git a/tests/benchmarks/gui/animation/qanimation/main.cpp b/tests/benchmarks/gui/animation/qanimation/main.cpp new file mode 100644 index 0000000000..b203949ed5 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/main.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "dummyobject.h" +#include "dummyanimation.h" +#include "rectanimation.h" + +#define ITERATION_COUNT 10e3 + +class tst_qanimation : public QObject +{ + Q_OBJECT +private slots: + void itemPropertyAnimation(); + void itemPropertyAnimation_data() { data();} + void dummyAnimation(); + void dummyAnimation_data() { data();} + void dummyPropertyAnimation(); + void dummyPropertyAnimation_data() { data();} + void rectAnimation(); + void rectAnimation_data() { data();} + + void floatAnimation_data() { data(); } + void floatAnimation(); + +private: + void data(); +}; + + +void tst_qanimation::data() +{ + QTest::addColumn("started"); + QTest::newRow("NotRunning") << false; + QTest::newRow("Running") << true; +} + +void tst_qanimation::itemPropertyAnimation() +{ + QFETCH(bool, started); + QGraphicsWidget item; + + //then the property animation + { + QPropertyAnimation anim(&item, "pos"); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QPointF(0,0)); + anim.setEndValue(QPointF(ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } + +} + +void tst_qanimation::dummyAnimation() +{ + QFETCH(bool, started); + DummyObject dummy; + + //first the dummy animation + { + DummyAnimation anim(&dummy); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QRect(0, 0, 0, 0)); + anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < anim.duration(); ++i) { + anim.setCurrentTime(i); + } + } + } +} + +void tst_qanimation::dummyPropertyAnimation() +{ + QFETCH(bool, started); + DummyObject dummy; + + //then the property animation + { + QPropertyAnimation anim(&dummy, "rect"); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QRect(0, 0, 0, 0)); + anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } +} + +void tst_qanimation::rectAnimation() +{ + //this is the simplest animation you can do + QFETCH(bool, started); + DummyObject dummy; + + //then the property animation + { + RectAnimation anim(&dummy); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(QRect(0, 0, 0, 0)); + anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } +} + +void tst_qanimation::floatAnimation() +{ + //this is the simplest animation you can do + QFETCH(bool, started); + DummyObject dummy; + + //then the property animation + { + QPropertyAnimation anim(&dummy, "opacity"); + anim.setDuration(ITERATION_COUNT); + anim.setStartValue(0.f); + anim.setEndValue(1.f); + if (started) + anim.start(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + anim.setCurrentTime(i); + } + } + } +} + + + +QTEST_MAIN(tst_qanimation) + +#include "main.moc" diff --git a/tests/benchmarks/gui/animation/qanimation/qanimation.pro b/tests/benchmarks/gui/animation/qanimation/qanimation.pro new file mode 100644 index 0000000000..53a139a660 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/qanimation.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_bench_qanimation +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release +#CONFIG += debug + + +SOURCES += main.cpp \ + dummyobject.cpp \ + dummyanimation.cpp \ + rectanimation.cpp + +HEADERS += dummyobject.h \ + dummyanimation.h \ + rectanimation.h diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp b/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp new file mode 100644 index 0000000000..b8082cda33 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "rectanimation.h" +#include "dummyobject.h" + +static inline int interpolateInteger(int from, int to, qreal progress) +{ + return from + (to - from) * progress; +} + + +RectAnimation::RectAnimation(DummyObject *obj) : m_object(obj), m_dura(250) +{ +} + +void RectAnimation::setEndValue(const QRect &rect) +{ + m_end = rect; +} + +void RectAnimation::setStartValue(const QRect &rect) +{ + m_start = rect; +} + +void RectAnimation::setDuration(int d) +{ + m_dura = d; +} + +int RectAnimation::duration() const +{ + return m_dura; +} + + +void RectAnimation::updateCurrentTime(int currentTime) +{ + qreal progress = m_easing.valueForProgress( currentTime / qreal(m_dura) ); + QRect now; + now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress), + interpolateInteger(m_start.top(), m_end.top(), progress), + interpolateInteger(m_start.right(), m_end.right(), progress), + interpolateInteger(m_start.bottom(), m_end.bottom(), progress)); + + bool changed = (now != m_current); + if (changed) + m_current = now; + + if (state() == Stopped) + return; + + if (m_object) + m_object->setRect(m_current); +} diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.h b/tests/benchmarks/gui/animation/qanimation/rectanimation.h new file mode 100644 index 0000000000..9efb91b274 --- /dev/null +++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#ifndef _RECTANIMATION_H__ + +class DummyObject; + +//this class is even simpler than the dummy +//and uses no QVariant at all +class RectAnimation : public QAbstractAnimation +{ +public: + RectAnimation(DummyObject *obj); + + void setEndValue(const QRect &rect); + void setStartValue(const QRect &rect); + + void setDuration(int d); + int duration() const; + + virtual void updateCurrentTime(int currentTime); + +private: + DummyObject *m_object; + QEasingCurve m_easing; + QRect m_start, m_end, m_current; + int m_dura; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.pro b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.pro new file mode 100644 index 0000000000..131ec128be --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.pro @@ -0,0 +1,71 @@ +load(qttest_p4) +TEMPLATE = app + +QT += svg +contains(QT_CONFIG, opengl):QT += opengl + +HEADERS += widgets/gvbwidget.h \ + widgets/abstractscrollarea.h \ + widgets/mainview.h \ + widgets/iconitem.h \ + widgets/label.h \ + widgets/listitem.h \ + widgets/scrollbar.h \ + widgets/simplelistview.h \ + widgets/scroller.h \ + widgets/scroller_p.h \ + widgets/button.h \ + widgets/menu.h \ + widgets/themeevent.h \ + widgets/theme.h \ + widgets/backgrounditem.h \ + widgets/topbar.h \ + widgets/commandline.h \ + widgets/dummydatagen.h \ + widgets/settings.h \ + widgets/listitemcache.h \ + widgets/listwidget.h \ + widgets/simplelist.h \ + widgets/itemrecyclinglist.h \ + widgets/itemrecyclinglistview.h \ + widgets/abstractitemview.h \ + widgets/abstractviewitem.h \ + widgets/recycledlistitem.h \ + widgets/listitemcontainer.h \ + widgets/abstractitemcontainer.h \ + widgets/listmodel.h + +SOURCES += main.cpp \ + widgets/gvbwidget.cpp \ + widgets/abstractscrollarea.cpp \ + widgets/mainview.cpp \ + widgets/iconitem.cpp \ + widgets/label.cpp \ + widgets/listitem.cpp \ + widgets/scrollbar.cpp \ + widgets/simplelistview.cpp \ + widgets/scroller.cpp \ + widgets/button.cpp \ + widgets/menu.cpp \ + widgets/themeevent.cpp \ + widgets/theme.cpp \ + widgets/backgrounditem.cpp \ + widgets/topbar.cpp \ + widgets/commandline.cpp \ + widgets/dummydatagen.cpp \ + widgets/settings.cpp \ + widgets/listitemcache.cpp \ + widgets/listwidget.cpp \ + widgets/simplelist.cpp \ + widgets/itemrecyclinglist.cpp \ + widgets/itemrecyclinglistview.cpp \ + widgets/abstractitemview.cpp \ + widgets/abstractviewitem.cpp \ + widgets/recycledlistitem.cpp \ + widgets/listitemcontainer.cpp \ + widgets/abstractitemcontainer.cpp \ + widgets/listmodel.cpp + +TARGET = tst_GraphicsViewBenchmark +RESOURCES += GraphicsViewBenchmark.qrc +INCLUDEPATH += widgets diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc new file mode 100644 index 0000000000..18ae04dd69 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/GraphicsViewBenchmark.qrc @@ -0,0 +1,85 @@ + + + resources/blue_SVG/blue_background_360x640px.svg + resources/blue_SVG/blue_background_horisontal_640x360px.svg + resources/blue_SVG/blue_contact_default_icon_52x52px.svg + resources/blue_SVG/blue_contact_list_divider_360x76px.svg + resources/blue_SVG/blue_contact_list_highlighter_360x76px.svg + resources/blue_SVG/blue_contact_status_idle_33x33px.svg + resources/blue_SVG/blue_contact_status_offline_33x33px.svg + resources/blue_SVG/blue_contact_status_online_33x33px.svg + resources/blue_SVG/blue_scrollbar_7x14px.svg + resources/blue_SVG/blue_scroll_16x80px.svg + resources/blue_SVG/blue_status_field_left_14x24px.svg + resources/blue_SVG/blue_status_field_middle_14x24px.svg + resources/blue_SVG/blue_status_field_right_14x24px.svg + resources/blue_SVG/blue_topbar_356x96px.svg + resources/blue_SVG/blue_topbar_horisontal_636x96px.svg + resources/blue_SVG/blue_user_default_icon_68x68px.svg + resources/blue_SVG/blue_user_status_idle_38x38px.svg + resources/blue_SVG/blue_user_status_offline_38x38px.svg + resources/blue_SVG/blue_user_status_online_38x38px.svg + + + + resources/lime_SVG/lime_background_360x640px.svg + resources/lime_SVG/lime_background_horisontal_640x360px.svg + resources/lime_SVG/lime_contact_default_icon_53x53px.svg + resources/lime_SVG/lime_contact_default_icon_highlight_53x53px.svg + resources/lime_SVG/lime_contact_list_divider_360x76px.svg + resources/lime_SVG/lime_contact_list_highlighter_357x80px.svg + resources/blue_SVG/blue_contact_status_idle_33x33px.svg + resources/blue_SVG/blue_contact_status_offline_33x33px.svg + resources/blue_SVG/blue_contact_status_online_33x33px.svg + resources/lime_SVG/lime_scrollbar_5x14px.svg + resources/lime_SVG/lime_scroll_5x80px.svg + resources/lime_SVG/lime_status_field_left_14x24px.svg + resources/lime_SVG/lime_status_field_middle_10x24px.svg + resources/lime_SVG/lime_status_field_right_14x24px.svg + resources/lime_SVG/lime_topbar_356x96px.svg + resources/lime_SVG/lime_topbar_horisontal_636x96px.svg + resources/lime_SVG/lime_user_default_icon_84x68px.svg + resources/lime_SVG/lime_user_status_idle_24x24px.svg + resources/lime_SVG/lime_user_status_offline_24x24px.svg + resources/lime_SVG/lime_user_status_online_24x24px.svg + + + + resources/avatars/avatar_man_001_58x58.png + resources/avatars/avatar_man_002_58x58.png + resources/avatars/avatar_man_003_58x58.png + resources/avatars/avatar_man_004_58x58.png + resources/avatars/avatar_man_005_58x58.png + resources/avatars/avatar_man_006_58x58.png + resources/avatars/avatar_man_007_58x58.png + resources/avatars/avatar_man_008_58x58.png + resources/avatars/avatar_man_009_58x58.png + resources/avatars/avatar_man_010_58x58.png + + resources/avatars/avatar_picture_001_58x58.png + resources/avatars/avatar_picture_002_58x58.png + resources/avatars/avatar_picture_003_58x58.png + resources/avatars/avatar_picture_004_58x58.png + resources/avatars/avatar_picture_005_58x58.png + + resources/avatars/avatar_woman_001_58x58.png + resources/avatars/avatar_woman_002_58x58.png + resources/avatars/avatar_woman_003_58x58.png + resources/avatars/avatar_woman_004_58x58.png + resources/avatars/avatar_woman_005_58x58.png + resources/avatars/avatar_woman_006_58x58.png + resources/avatars/avatar_woman_007_58x58.png + resources/avatars/avatar_woman_008_58x58.png + resources/avatars/avatar_woman_009_58x58.png + resources/avatars/avatar_woman_010_58x58.png + + + + resources/contacts/areacodes.txt + resources/contacts/firstnamesF.txt + resources/contacts/firstnamesM.txt + resources/contacts/lastnames.txt + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp new file mode 100644 index 0000000000..fa4b2802de --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp @@ -0,0 +1,805 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include +#include +#include +#include + +#include "mainview.h" +#include "dummydatagen.h" +#include "simplelist.h" +#include "itemrecyclinglist.h" +#include "simplelist.h" +#include "theme.h" +#include "commandline.h" + +class tst_GraphicsViewBenchmark : public QObject +{ + Q_OBJECT +public: + enum ListType { + Simple, + Recycling, + None + }; + + enum ScrollStep { + Slow = 2, + Normal = 8, + Fast = 64 + }; + + tst_GraphicsViewBenchmark(Settings *settings) + : mSettings(settings), mMainView(0), currentListSize(-1), currentListType(None) {} + ~tst_GraphicsViewBenchmark() {} + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + +private slots: + // Benchmarks: + void createAndFillList_data(); + void createAndFillList(); + void add100ItemsToBeginningOfList_data(); + void add100ItemsToBeginningOfList(); + void remove100ItemsFromBeginningOfList_data(); + void remove100ItemsFromBeginningOfList(); + void deleteList_data(); + void deleteList(); + void themeChange_data(); + void themeChange(); + void update_data(); + void update(); + void scroll_data(); + void scroll(); + +private: + Settings *mSettings; + MainView *mMainView; + DummyDataGenerator mDataGenerator; + int currentListSize; + ListType currentListType; + + void resetView(); + void ensureListSizeAndType(int listSize, ListType listType); + void ensureTheme(Theme::Themes theme); + void ensureRotationAngle(int rotation); + void ensureSubtreeCache(bool enable); + void ensureImageBasedRendering(bool enable); + void insertListData(); + inline void setTestWidget(QGraphicsWidget *widget, int listSize, ListType listType) + { + currentListSize = listSize; + currentListType = listType; + mMainView->setTestWidget(widget); + } +}; + +Q_DECLARE_METATYPE(tst_GraphicsViewBenchmark::ListType) +Q_DECLARE_METATYPE(Theme::Themes) +Q_DECLARE_METATYPE(tst_GraphicsViewBenchmark::ScrollStep) + +const int AddRemoveCount = 100; + +static ListItem *newSimpleListItem(DummyDataGenerator &dataGenerator, const int id) +{ + ListItem *item = new ListItem(); + item->setText(dataGenerator.randomName(), ListItem::FirstPos ); + item->setText(dataGenerator.randomPhoneNumber(QString("%1").arg(id)), ListItem::SecondPos ); + item->setIcon(new IconItem(dataGenerator.randomIconItem(), item), ListItem::LeftIcon ); + item->setIcon(new IconItem(dataGenerator.randomStatusItem(), item), ListItem::RightIcon); + item->setFont(Theme::p()->font(Theme::ContactName), ListItem::FirstPos); + item->setFont(Theme::p()->font(Theme::ContactNumber), ListItem::SecondPos); + item->setBorderPen(Theme::p()->listItemBorderPen()); + item->setRounding(Theme::p()->listItemRounding()); + item->icon(ListItem::LeftIcon)->setRotation(Theme::p()->iconRotation(ListItem::LeftIcon)); + item->icon(ListItem::RightIcon)->setRotation(Theme::p()->iconRotation(ListItem::RightIcon)); + item->icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::LeftIcon)); + item->icon(ListItem::RightIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::RightIcon)); + item->icon(ListItem::LeftIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::LeftIcon)); + item->icon(ListItem::RightIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::RightIcon)); + return item; +} + +static RecycledListItem *newRecyclingListItem(DummyDataGenerator &dataGenerator, const int id) +{ + RecycledListItem *item = new RecycledListItem(); + item->item()->setText(dataGenerator.randomName(), ListItem::FirstPos ); + item->item()->setText(dataGenerator.randomPhoneNumber(QString("%1").arg(id)), ListItem::SecondPos ); + item->item()->setIcon(new IconItem(dataGenerator.randomIconItem()), ListItem::LeftIcon ); + item->item()->setIcon(new IconItem(dataGenerator.randomStatusItem()), ListItem::RightIcon); + item->item()->setFont(Theme::p()->font(Theme::ContactName), ListItem::FirstPos); + item->item()->setFont(Theme::p()->font(Theme::ContactNumber), ListItem::SecondPos); + item->item()->setBorderPen(Theme::p()->listItemBorderPen()); + item->item()->setRounding(Theme::p()->listItemRounding()); + item->item()->icon(ListItem::LeftIcon)->setRotation(Theme::p()->iconRotation(ListItem::LeftIcon)); + item->item()->icon(ListItem::RightIcon)->setRotation(Theme::p()->iconRotation(ListItem::RightIcon)); + item->item()->icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::LeftIcon)); + item->item()->icon(ListItem::RightIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::RightIcon)); + item->item()->icon(ListItem::LeftIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::LeftIcon)); + item->item()->icon(ListItem::RightIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::RightIcon)); + return item; +} + +static void fillList(DummyDataGenerator &dataGenerator, int itemCount, QGraphicsWidget *list) +{ + if (SimpleList *simpleList = qobject_cast(list)) { + for (int i = 0; i < itemCount; ++i) + simpleList->addItem(newSimpleListItem(dataGenerator, i)); + } else if (ItemRecyclingList *recyclingList = qobject_cast(list)) { + for (int i = 0; i < itemCount; ++i) + recyclingList->addItem(newRecyclingListItem(dataGenerator, i)); + } else { + qFatal("fillList: internal error"); + } +} + +void tst_GraphicsViewBenchmark::resetView() +{ + if (QGraphicsWidget *widget = mMainView->takeTestWidget()) { + delete widget; + currentListSize = -1; + currentListType = None; + QTest::qWait(50); + } else { + if (currentListSize != -1) + qFatal("tst_GraphicsViewBenchmark::resetView: internal error: wrong list size"); + if (currentListType != None) + qFatal("tst_GraphicsViewBenchmark::resetView: internal error: wrong list type"); + } + ensureTheme(Theme::Blue); + ensureRotationAngle(0); + ensureSubtreeCache(false); + ensureImageBasedRendering(false); +} + +void tst_GraphicsViewBenchmark::ensureListSizeAndType(int listSize, ListType listType) +{ + if (currentListSize != listSize || currentListType != listType) { + resetView(); + if (listType == Simple) { + SimpleList *list = new SimpleList; + fillList(mDataGenerator, listSize, list); + setTestWidget(list, listSize, listType); + } else if (listType == Recycling) { + ItemRecyclingList *list = new ItemRecyclingList; + fillList(mDataGenerator, listSize, list); + setTestWidget(list, listSize, listType); + } + QTest::qWait(50); + return; + } + + // Okay, we're supposed to have the right list type and size. Make sure we actually have it. + QGraphicsWidget *widget = mMainView->testWidget(); + if (!widget) { + if (currentListType != None || currentListSize != -1) + qFatal("tst_GraphicsViewBenchmark::ensureListSizeAndType: internal error: no test widget"); + return; + } + + if (listType == Simple) { + SimpleList *list = qobject_cast(widget); + if (!list) + qFatal("tst_GraphicsViewBenchmark::ensureListSizeAndType: internal error: wrong list type"); + if (list->itemCount() != listSize) + qFatal("tst_GraphicsViewBenchmark::ensureListSizeAndType: internal error: wrong list size"); + } else if (listType == Recycling){ + ItemRecyclingList *list = qobject_cast(widget); + if (!list) + qFatal("tst_GraphicsViewBenchmark::ensureListSizeAndType: internal error: wrong list type"); + if (list->rows() != listSize) + qFatal("tst_GraphicsViewBenchmark::ensureListSizeAndType: internal error: wrong list size"); + } +} + +void tst_GraphicsViewBenchmark::ensureTheme(Theme::Themes theme) +{ + if (Theme::p()->theme() != theme) { + Theme::p()->setTheme(theme); + // The theme change itself can take a lot of time, so make + // sure we give it a little bit time to stabilize *after* + // the changes, hence sendPostedEvents(); qWait(); + QApplication::sendPostedEvents(); + QTest::qWait(50); + } +} + +void tst_GraphicsViewBenchmark::ensureRotationAngle(int angle) +{ + const bool useTwoColumns = angle != 0; + bool wait = false; + if (mMainView->rotationAngle() != angle) { + mMainView->rotateContent(-mMainView->rotationAngle() + angle); + wait = true; + } + if (QGraphicsWidget *widget = mMainView->testWidget()) { + if (SimpleList *list = qobject_cast(widget)) { + if (list->twoColumns() != useTwoColumns) { + list->setTwoColumns(useTwoColumns); + wait = true; + } + } else if (ItemRecyclingList *list = qobject_cast(widget)) { + if (list->twoColumns() != useTwoColumns) { + list->setTwoColumns(useTwoColumns); + wait = true; + } + } + } + if (wait) + QTest::qWait(50); +} + +void tst_GraphicsViewBenchmark::ensureSubtreeCache(bool enable) +{ + QGraphicsWidget *widget = mMainView->testWidget(); + if (!widget) + return; + + if (SimpleList *list = qobject_cast(widget)) { + if (list->listItemCaching() != enable) { + list->setListItemCaching(enable); + QTest::qWait(50); + } + } else if (ItemRecyclingList *list = qobject_cast(widget)) { + if (list->listItemCaching() != enable) { + list->setListItemCaching(enable); + QTest::qWait(50); + } + } + QPixmapCache::clear(); +} + +void tst_GraphicsViewBenchmark::ensureImageBasedRendering(bool enable) +{ + if (mMainView->imageBasedRendering() != enable) { + mMainView->setImageBasedRendering(enable); + QTest::qWait(50); + } +} + +void tst_GraphicsViewBenchmark::insertListData() +{ + QTest::addColumn("listSize"); + QTest::addColumn("listType"); + + QTest::newRow("Simple list containing 10 items") << 10 << Simple; + QTest::newRow("Recycling list containing 10 items") << 10 << Recycling; + QTest::newRow("Simple list containing 50 items") << 50 << Simple; + QTest::newRow("Recycling list containing 50 items") << 50 << Recycling; + QTest::newRow("Simple list containing 500 items") << 500 << Simple; + QTest::newRow("Recycling list containing 500 items") << 500 << Recycling; +} + +void tst_GraphicsViewBenchmark::initTestCase() +{ + mMainView = new MainView(mSettings->options() & Settings::UseOpenGL, + mSettings->options() & Settings::OutputFps); + + if (mSettings->size().width() > 0 && mSettings->size().height() > 0) { + mMainView->resize(mSettings->size().width(), mSettings->size().height()); + mMainView->show(); + } else { +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + mMainView->showFullScreen(); +#else + if (QApplication::desktop()->width() < 360 || QApplication::desktop()->height() < 640) { + mMainView->showFullScreen(); + } else { + mMainView->resize(360, 640); + mMainView->show(); + } +#endif + } + + mDataGenerator.Reset(); + SimpleList *list = new SimpleList; + list->setListItemCaching(false); + mMainView->setTestWidget(list); + fillList(mDataGenerator, 5, list); + mMainView->takeTestWidget(); + delete list; + + currentListSize = -1; + currentListType = None; + + QTest::qWaitForWindowShown(mMainView); +} + +void tst_GraphicsViewBenchmark::cleanupTestCase() +{ + delete mMainView; + mMainView = 0; +} + +void tst_GraphicsViewBenchmark::init() +{ + // Make sure we don't have pending events in the queue. + // Yes, each test run takes a little bit longer, but the results are more stable. + QTest::qWait(150); +} + +void tst_GraphicsViewBenchmark::createAndFillList_data() +{ + insertListData(); +} + +void tst_GraphicsViewBenchmark::createAndFillList() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + + resetView(); + + if (listType == Simple) { + QBENCHMARK { + SimpleList *list = new SimpleList; + setTestWidget(list, listSize, listType); + fillList(mDataGenerator, listSize, list); + } + } else { + QBENCHMARK { + ItemRecyclingList *list = new ItemRecyclingList; + setTestWidget(list, listSize, listType); + fillList(mDataGenerator, listSize, list); + } + } + + resetView(); +} + +void tst_GraphicsViewBenchmark::add100ItemsToBeginningOfList_data() +{ + insertListData(); +} + +void tst_GraphicsViewBenchmark::add100ItemsToBeginningOfList() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + + resetView(); + + if (listType == Simple) { + SimpleList *list = new SimpleList; + fillList(mDataGenerator, listSize, list); + setTestWidget(list, listSize, listType); + QTest::qWait(50); + QBENCHMARK { + for (int i = 0; i < AddRemoveCount; ++i) + list->insertItem(0, newSimpleListItem(mDataGenerator, i)); + } + } else { + ItemRecyclingList *list = new ItemRecyclingList; + fillList(mDataGenerator, listSize, list); + setTestWidget(list, listSize, listType); + QTest::qWait(50); + QBENCHMARK { + for (int i = 0; i < AddRemoveCount; ++i) + list->insertItem(0, newRecyclingListItem(mDataGenerator, i)); + } + } + + resetView(); +} + +void tst_GraphicsViewBenchmark::remove100ItemsFromBeginningOfList_data() +{ + insertListData(); +} + +void tst_GraphicsViewBenchmark::remove100ItemsFromBeginningOfList() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + + resetView(); + + if (listType == Simple) { + SimpleList *list = new SimpleList; + fillList(mDataGenerator, listSize, list); + setTestWidget(list, listSize, listType); + QTest::qWait(50); + QBENCHMARK { + for (int i = 0; i < AddRemoveCount; ++i) + delete list->takeItem(0); + } + } else { + ItemRecyclingList *list = new ItemRecyclingList; + fillList(mDataGenerator, listSize, list); + setTestWidget(list, listSize, listType); + QTest::qWait(50); + QBENCHMARK { + for (int i = 0; i < AddRemoveCount; ++i) + delete list->takeItem(0); + } + } + + resetView(); +} + +void tst_GraphicsViewBenchmark::deleteList_data() +{ + insertListData(); + QTest::newRow("Simple list containing 1000 items") << 1000 << Simple; + QTest::newRow("Recycling list containing 1000 items") << 1000 << Recycling; +} + +void tst_GraphicsViewBenchmark::deleteList() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + + if (listSize < 500) + return; // Too small to measure. + + QGraphicsWidget *list = 0; + if (listType == Simple) + list = new SimpleList; + else + list = new ItemRecyclingList; + fillList(mDataGenerator, listSize, list); + QTest::qWait(20); + + QBENCHMARK_ONCE { + delete list; + } +} + +void tst_GraphicsViewBenchmark::themeChange_data() +{ + QTest::addColumn("listSize"); + QTest::addColumn("listType"); + QTest::addColumn("fromTheme"); + QTest::addColumn("toTheme"); + + QTest::newRow("From Blue to Lime, simple list containing 10 items") << 10 << Simple << Theme::Blue << Theme::Lime; + QTest::newRow("From Lime to Blue, simple list containing 10 items") << 10 << Simple << Theme::Lime << Theme::Blue; + + QTest::newRow("From Blue to Lime, recycling list containing 10 items") << 10 << Recycling << Theme::Blue << Theme::Lime; + QTest::newRow("From Lime to Blue, recycling list containing 10 items") << 10 << Recycling << Theme::Lime << Theme::Blue; + + QTest::newRow("From Blue to Lime, simple list containing 50 items") << 50 << Simple << Theme::Blue << Theme::Lime; + QTest::newRow("From Lime to Blue, simple list containing 50 items") << 50 << Simple << Theme::Lime << Theme::Blue; + + QTest::newRow("From Blue to Lime, recycling list containing 50 items") << 50 << Recycling << Theme::Blue << Theme::Lime; + QTest::newRow("From Lime to Blue, recycling list containing 50 items") << 50 << Recycling << Theme::Lime << Theme::Blue; + + QTest::newRow("From Blue to Lime, simple list containing 500 items") << 500 << Simple << Theme::Blue << Theme::Lime; + QTest::newRow("From Lime to Blue, simple list containing 500 items") << 500 << Simple << Theme::Lime << Theme::Blue; + + QTest::newRow("From Blue to Lime, recycling list containing 500 items") << 500 << Recycling << Theme::Blue << Theme::Lime; + QTest::newRow("From Lime to Blue, recycling list containing 500 items") << 500 << Recycling << Theme::Lime << Theme::Blue; +} + +void tst_GraphicsViewBenchmark::themeChange() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + QFETCH(Theme::Themes, fromTheme); + QFETCH(Theme::Themes, toTheme); + + if (fromTheme == toTheme) + qFatal("tst_GraphicsViewBenchmark::themeChange: to and from theme is the same"); + + ensureListSizeAndType(listSize, listType); + ensureTheme(fromTheme); + + QBENCHMARK { + Theme::p()->setTheme(toTheme); + } +} + +static inline QLatin1String stringForTheme(Theme::Themes theme) +{ + if (theme == Theme::Blue) + return QLatin1String("Blue"); + return QLatin1String("Lime"); +} + +static inline QLatin1String stringForListType(tst_GraphicsViewBenchmark::ListType type) +{ + if (type == tst_GraphicsViewBenchmark::Simple) + return QLatin1String("Simple"); + if (type == tst_GraphicsViewBenchmark::Recycling) + return QLatin1String("Recycling"); + return QLatin1String("None"); +} + +static inline QLatin1String stringForScrollStep(tst_GraphicsViewBenchmark::ScrollStep step) +{ + if (step == tst_GraphicsViewBenchmark::Slow) + return QLatin1String("Slow"); + if (step == tst_GraphicsViewBenchmark::Normal) + return QLatin1String("Normal"); + return QLatin1String("Fast"); +} + +static inline QString rowString(int listSize, tst_GraphicsViewBenchmark::ListType listType, + Theme::Themes theme, int toImage, int cache, int angle) +{ + return QString("Items=%1, List=%2, Theme=%3, RenderToImage=%4, Cache=%5, RotAngle=%6") + .arg(QString::number(listSize)).arg(stringForListType(listType)) + .arg(stringForTheme(theme)).arg(QString::number(toImage)) + .arg(QString::number(cache)).arg(QString::number(angle)); +} + +static inline QString rowString(int listSize, tst_GraphicsViewBenchmark::ListType listType, + Theme::Themes theme, int cache, int angle, + tst_GraphicsViewBenchmark::ScrollStep step) +{ + return QString("Items=%1, List=%2, Theme=%3, Cache=%4, RotAngle=%5, Speed=%6") + .arg(QString::number(listSize)).arg(stringForListType(listType)) + .arg(stringForTheme(theme)).arg(QString::number(cache)) + .arg(QString::number(angle)).arg(stringForScrollStep(step)); +} + +void tst_GraphicsViewBenchmark::update_data() +{ + QTest::addColumn("listSize"); + QTest::addColumn("listType"); + QTest::addColumn("theme"); + QTest::addColumn("renderToImage"); + QTest::addColumn("subtreeCache"); + QTest::addColumn("rotationAngle"); + + QList listTypes; + listTypes << Simple << Recycling; + + QList listSizes; + listSizes << 10 << 50 << 500; + + QList themes; + themes << Theme::Blue << Theme::Lime; + + QList rotationAngles; + rotationAngles << 0 << 90; + + // Generate rows: + foreach (ListType listType, listTypes) { + foreach (int listSize, listSizes) { + foreach (int angle, rotationAngles) { + foreach (Theme::Themes theme, themes) { + for (int toImage = 0; toImage < 2; ++toImage) { + for (int cache = 0; cache < 2; ++cache) { + QString string = rowString(listSize, listType, theme, toImage, cache, angle); + QTest::newRow(string.toLatin1()) << listSize << listType << theme << bool(toImage) + << bool(cache) << angle; + } + } + } + } + } + } +} + +void tst_GraphicsViewBenchmark::update() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + QFETCH(Theme::Themes, theme); + QFETCH(bool, renderToImage); + QFETCH(bool, subtreeCache); + QFETCH(int, rotationAngle); + + mMainView->viewport()->setUpdatesEnabled(false); + + ensureListSizeAndType(listSize, listType); + ensureTheme(theme); + ensureRotationAngle(rotationAngle); + ensureSubtreeCache(subtreeCache); + ensureImageBasedRendering(renderToImage); + + QEventLoop loop; + QObject::connect(mMainView, SIGNAL(repainted()), &loop, SLOT(quit())); + QTimer::singleShot(4000, &loop, SLOT(quit())); + // Dry run (especially important when cache is enabled). + // NB! setUpdatesEnabled triggers an update(). + mMainView->viewport()->setUpdatesEnabled(true); + loop.exec(QEventLoop::AllEvents | QEventLoop::ExcludeUserInputEvents| QEventLoop::ExcludeSocketNotifiers); + QTest::qWait(50); + + QTimer::singleShot(4000, &loop, SLOT(quit())); + QBENCHMARK { + mMainView->viewport()->update(); + loop.exec(QEventLoop::AllEvents | QEventLoop::ExcludeUserInputEvents| QEventLoop::ExcludeSocketNotifiers); + } +} + +void tst_GraphicsViewBenchmark::scroll_data() +{ + QTest::addColumn("listSize"); + QTest::addColumn("listType"); + QTest::addColumn("theme"); + QTest::addColumn("subtreeCache"); + QTest::addColumn("rotationAngle"); + QTest::addColumn("scrollStep"); + + QList listTypes; + listTypes << Simple << Recycling; + + QList listSizes; + listSizes << 10 << 50 << 500; + + QList themes; + themes << Theme::Blue << Theme::Lime; + + QList rotationAngles; + rotationAngles << 0 << 90; + + QList scrollSteps; + scrollSteps << Slow << Normal << Fast; + + // Generate rows: + foreach (ListType listType, listTypes) { + foreach (int listSize, listSizes) { + foreach (int angle, rotationAngles) { + foreach (ScrollStep step, scrollSteps) { + foreach (Theme::Themes theme, themes) { + for (int cache = 0; cache < 2; ++cache) { + QString string = rowString(listSize, listType, theme, cache, angle, step); + QTest::newRow(string.toLatin1()) << listSize << listType << theme + << bool(cache) << angle << step; + } + } + } + } + } + } +} + +void tst_GraphicsViewBenchmark::scroll() +{ + QFETCH(int, listSize); + QFETCH(ListType, listType); + QFETCH(Theme::Themes, theme); + QFETCH(bool, subtreeCache); + QFETCH(int, rotationAngle); + QFETCH(ScrollStep, scrollStep); + + mMainView->viewport()->setUpdatesEnabled(false); + + ensureListSizeAndType(listSize, listType); + ensureTheme(theme); + ensureRotationAngle(rotationAngle); + ensureSubtreeCache(subtreeCache); + ensureImageBasedRendering(false); + + ScrollBar *sb = 0; + if (listType == Simple) + sb = static_cast(mMainView->testWidget())->verticalScrollBar(); + else + sb = static_cast(mMainView->testWidget())->verticalScrollBar(); + const qreal sliderStart = sb->sliderSize() / qreal(2.0); + const qreal sliderTarget = sliderStart + qreal(scrollStep); + sb->setSliderPosition(sliderStart); + + QEventLoop loop; + QObject::connect(mMainView, SIGNAL(repainted()), &loop, SLOT(quit())); + QTimer::singleShot(4000, &loop, SLOT(quit())); + // Dry run (especially important when cache is enabled). + // NB! setUpdatesEnabled triggers an update(). + mMainView->viewport()->setUpdatesEnabled(true); + loop.exec(QEventLoop::AllEvents | QEventLoop::ExcludeUserInputEvents| QEventLoop::ExcludeSocketNotifiers); + QTest::qWait(50); + + QTimer::singleShot(4000, &loop, SLOT(quit())); + QBENCHMARK { + sb->setSliderPosition(sliderTarget); + loop.exec(QEventLoop::AllEvents | QEventLoop::ExcludeUserInputEvents| QEventLoop::ExcludeSocketNotifiers); + } +} + +int main(int argc, char *argv[]) +{ + Settings settings; + if (!readSettingsFromCommandLine(argc, argv, settings)) + return 1; + + // Eat command line arguments. + int aargc = 0; + for (int i = 0; i < argc; ++i) { + if (argv[i]) + ++aargc; + } + char **aargv = new char*[aargc]; + aargc = 0; + for (int i = 0; i < argc; ++i) { + if (argv[i]) + aargv[aargc++] = argv[i]; + } + + QApplication app(aargc, aargv); + + int returnValue = 0; + if (settings.options() & Settings::ManualTest) { + MainView view(settings.options() & Settings::UseOpenGL, settings.options() & Settings::OutputFps); + + DummyDataGenerator dataGenerator; + dataGenerator.Reset(); + + SimpleList *list = new SimpleList; + if (settings.options() & Settings::UseListItemCache) + list->setListItemCaching(true); + else + list->setListItemCaching(false); + + if (settings.listItemCount()) + fillList(dataGenerator, settings.listItemCount(), list); + else + fillList(dataGenerator, 500, list); + + view.setTestWidget(list); + + if ((settings.angle() % 360) != 0) + view.rotateContent(settings.angle()); + + if (settings.size().width() > 0 && settings.size().height() > 0) { + view.resize(settings.size().width(), settings.size().height()); + view.show(); + } else { +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) + view.showFullScreen(); +#else + if (QApplication::desktop()->width() < 360 || QApplication::desktop()->height() < 640) { + view.showFullScreen(); + } else { + view.resize(360, 640); + view.show(); + } +#endif + } + returnValue = app.exec(); + } else { + QTEST_DISABLE_KEYPAD_NAVIGATION + tst_GraphicsViewBenchmark tc(&settings); + returnValue = QTest::qExec(&tc, aargc, aargv); + } + + delete [] aargv; + return returnValue; +} + +#include "main.moc" diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_001_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_001_58x58.png new file mode 100644 index 0000000000..525b5559a0 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_001_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_002_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_002_58x58.png new file mode 100644 index 0000000000..3d932985a6 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_002_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_003_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_003_58x58.png new file mode 100644 index 0000000000..556cfcba6a Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_003_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_004_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_004_58x58.png new file mode 100644 index 0000000000..94acf9e669 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_004_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_005_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_005_58x58.png new file mode 100644 index 0000000000..ed0c7c42f0 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_005_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_006_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_006_58x58.png new file mode 100644 index 0000000000..d4b4dc3a8e Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_006_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_007_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_007_58x58.png new file mode 100644 index 0000000000..0e45d18e4d Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_007_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_008_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_008_58x58.png new file mode 100644 index 0000000000..0c25540ac9 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_008_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_009_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_009_58x58.png new file mode 100644 index 0000000000..ce435ea537 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_009_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_010_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_010_58x58.png new file mode 100644 index 0000000000..021db25882 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_man_010_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_001_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_001_58x58.png new file mode 100644 index 0000000000..0051da326f Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_001_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_002_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_002_58x58.png new file mode 100644 index 0000000000..e8a946a8ba Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_002_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_003_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_003_58x58.png new file mode 100644 index 0000000000..b2bb851f69 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_003_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_004_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_004_58x58.png new file mode 100644 index 0000000000..871c075d05 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_004_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_005_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_005_58x58.png new file mode 100644 index 0000000000..d4c18b8bb0 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_picture_005_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_001_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_001_58x58.png new file mode 100644 index 0000000000..10a5947234 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_001_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_002_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_002_58x58.png new file mode 100644 index 0000000000..65b4e03c5b Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_002_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_003_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_003_58x58.png new file mode 100644 index 0000000000..935ec07171 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_003_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_004_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_004_58x58.png new file mode 100644 index 0000000000..fbc1a937fd Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_004_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_005_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_005_58x58.png new file mode 100644 index 0000000000..af96d3e149 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_005_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_006_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_006_58x58.png new file mode 100644 index 0000000000..fb4192d35f Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_006_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_007_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_007_58x58.png new file mode 100644 index 0000000000..f5d6dea0b0 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_007_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_008_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_008_58x58.png new file mode 100644 index 0000000000..d08b8dc364 Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_008_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_009_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_009_58x58.png new file mode 100644 index 0000000000..768b97de6e Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_009_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_010_58x58.png b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_010_58x58.png new file mode 100644 index 0000000000..d1fe28e61e Binary files /dev/null and b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/avatars/avatar_woman_010_58x58.png differ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_360x640px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_360x640px.svg new file mode 100644 index 0000000000..1552bafa17 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_360x640px.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_horisontal_640x360px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_horisontal_640x360px.svg new file mode 100644 index 0000000000..5589110950 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_background_horisontal_640x360px.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_default_icon_52x52px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_default_icon_52x52px.svg new file mode 100644 index 0000000000..665675b1e8 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_default_icon_52x52px.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_divider_360x76px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_divider_360x76px.svg new file mode 100644 index 0000000000..db9fc7af33 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_divider_360x76px.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_highlighter_360x76px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_highlighter_360x76px.svg new file mode 100644 index 0000000000..dae2bd4842 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_list_highlighter_360x76px.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_idle_33x33px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_idle_33x33px.svg new file mode 100644 index 0000000000..fe12e782a6 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_idle_33x33px.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_offline_33x33px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_offline_33x33px.svg new file mode 100644 index 0000000000..0c973f1bc9 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_offline_33x33px.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_online_33x33px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_online_33x33px.svg new file mode 100644 index 0000000000..fcb434afda --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_contact_status_online_33x33px.svg @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scroll_16x80px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scroll_16x80px.svg new file mode 100644 index 0000000000..897be81dc5 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scroll_16x80px.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scrollbar_7x14px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scrollbar_7x14px.svg new file mode 100644 index 0000000000..3baec2f4b6 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_scrollbar_7x14px.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_left_14x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_left_14x24px.svg new file mode 100644 index 0000000000..dd6fb70a8d --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_left_14x24px.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_middle_14x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_middle_14x24px.svg new file mode 100644 index 0000000000..cabf9285a7 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_middle_14x24px.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_right_14x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_right_14x24px.svg new file mode 100644 index 0000000000..f3a795b88d --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_status_field_right_14x24px.svg @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_356x96px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_356x96px.svg new file mode 100644 index 0000000000..a0efd347fb --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_356x96px.svg @@ -0,0 +1,2007 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_horisontal_636x96px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_horisontal_636x96px.svg new file mode 100644 index 0000000000..0a3efd8111 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_topbar_horisontal_636x96px.svg @@ -0,0 +1,4060 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_default_icon_68x68px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_default_icon_68x68px.svg new file mode 100644 index 0000000000..1ffeedde1b --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_default_icon_68x68px.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_idle_38x38px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_idle_38x38px.svg new file mode 100644 index 0000000000..71f49aa719 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_idle_38x38px.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_offline_38x38px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_offline_38x38px.svg new file mode 100644 index 0000000000..84c2514adc --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_offline_38x38px.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_online_38x38px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_online_38x38px.svg new file mode 100644 index 0000000000..76daf31809 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/blue_SVG/blue_user_status_online_38x38px.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/areacodes.txt b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/areacodes.txt new file mode 100644 index 0000000000..dc7e7d81b6 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/areacodes.txt @@ -0,0 +1,62 @@ ++30 ++31 ++32 ++33 ++34 ++350 ++351 ++352 ++353 ++354 ++355 ++356 ++357 ++358 ++359 ++36 ++3 ++370 ++371 ++372 ++373 ++374 ++375 ++376 ++377 ++377 44 ++378 ++379 ++38 ++380 ++381 ++382 ++383 ++384 ++385 ++386 ++386 49 ++387 ++388 ++388 3 ++389 ++39 ++40 ++41 ++42 ++420 ++421 ++422 ++423 ++424 ++425 ++426 ++427 ++428 ++429 ++43 ++44 ++45 ++46 ++47 ++48 ++49 \ No newline at end of file diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesF.txt b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesF.txt new file mode 100644 index 0000000000..4bf14924a7 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesF.txt @@ -0,0 +1,100 @@ +Aida +Aija +Aila +Aili +Ailikki +Aimi +Aina +Alexia +Alice +Amanda +Amber +Amy +Angela +Angelica +Ann +Beth +Brenda +Brooke +Caitlin +Camilla +Camille +Carmen +Cassandra +Catherine +Edna +Eeva +Eeve +Eevi +Eija +Eila +Eimi +Eleanor +Eleonora +Elizabeth +Ellen +Enna +Enni +Erica +Erika +Erja +Essi +Essie +Heini +Heleena +Helen +Helena +Helene +Helga +Hilja +Hilkka +Hille +Hillervo +Hillevi +Hilma +Irene +Irina +Irja +Irma +Irmeli +Iro +Jacqueline +Jane +Jennifer +Jenny +Jessica +Jill +Kaire +Kaisa +Kaisla +Kaisu +Katarine +Kate +Kate +Kateriina +Katharina +Katharine +Katherine +Kathleen +Marge +Mary +May +Megan +Melinda +Morgan +Nellie +Nelly +Pauline +Peggy +Pepi +Scarlett +Sheila +Shirley +Sissy +Stephanie +Sylvia +Taylor +Terrie +Terry +Victoria +Violet \ No newline at end of file diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesM.txt b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesM.txt new file mode 100644 index 0000000000..189d8d015f --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/firstnamesM.txt @@ -0,0 +1,100 @@ +Aabraham +Aadam +Aadolf +Aake +Aaku +Aatu +Ahti +Ahvo +Aimo +Aki +Akseli +Aku +Bartholomew +Ben +Benjamin +Bill +Billie +Billy +Bob +Brendan +Brian +Bryan +Calvin +Carl +Charles +Chester +Chris +Christian +Christopher +Chuck +Dale +Dave +David +Dennis +Dick +Dominick +Donald +Dustin +Dusty +Harri +Heikki +Heimo +Heino +Helmer +Helmeri +Hemmi +Hemmo +Henri +Jeff +Jeffrey +Jermu +Jero +Jerri +Jerry +Jesper +Jesperi +Jesse +Jetro +Jim +Jimi +Jimmy +Joakim +Joe +John +Johnny +Jonah +Jonathan +Joseph +Leevi +Leimo +Leimu +Leino +Leivo +Lenne +Lennu +Mark +Martin +Matt +Matthew +Michael +Mike +Niko +Nooa +Nuutti +Nyyrikki +Okke +Okko +Olavi +Oliver +Olli +Onni +Pertti +Perttu +Walter +Warren +Wesley +William +Willie +Winston +Woodrow \ No newline at end of file diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/lastnames.txt b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/lastnames.txt new file mode 100644 index 0000000000..35b3f9f9c2 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/contacts/lastnames.txt @@ -0,0 +1,150 @@ +Adams +Allen +Anderson +Bailey +Baker +Barnes +Bell +Bennett +Brooks +Brown +Butler +Campbell +Carter +Clark +Collins +Cook +Cooper +Cox +Cruz +Davis +Daz +Edwards +Evans +Fisher +Flores +Foster +Garca +Gmez +Gonzlez +Gray +Green +Gutirrez +Hall +Harris +Heikkinen +Helenius +Helve +Hernndez +Hill +Hiltunen +Hirvonen +Holm +Honkanen +Howard +Hughes +Huhtala +Huttunen +Hyppnen +Jackson +James +Jenkins +Johnson +Jones +Kauppinen +Kelly +Kemppainen +King +Klemetti +Kokkonen +Kolehmainen +Korhonen +Kurikka +Kuura +Kyr +Krkkinen +Lee +Lewis +Long +Lpez +Martikainen +Martin +Martnez +Mattila +Mikkola +Mikkonen +Miller +Mitchell +Moore +Morales +Morgan +Morris +Muje +Murphy +Mustonen +Myers +Myllrinen +Menp +Mkel +Mkinen +Nelson +Nguyen +Ortiz +Parker +Prez +Perry +Peterson +Phillips +Powell +Price +Ramrez +Reed +Reyes +Richardson +Rivera +Roberts +Robinson +Rodrguez +Rogers +Ross +Russell +Saarinen +Saaristo +Salminen +Salo +Salonen +Snchez +Sanders +Scott +Seppnen +Silvennoinen +Silvo +Smith +Sokura +Stewart +Sullivan +Suomalainen +Taylor +Thomas +Thompson +Torres +Turner +Valkeap +Walker +Valo +Valtonen +Vanhanen +Ward +Watson +Venlinen +Vesa +White +Vihavainen +Williams +Wilson +Virtanen +Wood +Voutilainen +Wright +Vuorela +Young \ No newline at end of file diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_360x640px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_360x640px.svg new file mode 100644 index 0000000000..8daf275b19 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_360x640px.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_horisontal_640x360px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_horisontal_640x360px.svg new file mode 100644 index 0000000000..c2b070a3b1 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_background_horisontal_640x360px.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_53x53px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_53x53px.svg new file mode 100644 index 0000000000..6e34f255b2 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_53x53px.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_highlight_53x53px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_highlight_53x53px.svg new file mode 100644 index 0000000000..29c284de08 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_default_icon_highlight_53x53px.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_divider_360x76px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_divider_360x76px.svg new file mode 100644 index 0000000000..db9fc7af33 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_divider_360x76px.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_highlighter_357x80px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_highlighter_357x80px.svg new file mode 100644 index 0000000000..0ee3ea23e6 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_list_highlighter_357x80px.svg @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_idle_27x47.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_idle_27x47.svg new file mode 100644 index 0000000000..925d3eb36e --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_idle_27x47.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_offline_27x47.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_offline_27x47.svg new file mode 100644 index 0000000000..6f74723f09 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_offline_27x47.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_online_27x47.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_online_27x47.svg new file mode 100644 index 0000000000..56951605de --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_contact_status_online_27x47.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scroll_5x80px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scroll_5x80px.svg new file mode 100644 index 0000000000..4f6482afa5 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scroll_5x80px.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scrollbar_5x14px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scrollbar_5x14px.svg new file mode 100644 index 0000000000..54a40c3cc8 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_scrollbar_5x14px.svg @@ -0,0 +1,7 @@ + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_left_14x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_left_14x24px.svg new file mode 100644 index 0000000000..a21c91df48 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_left_14x24px.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_middle_10x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_middle_10x24px.svg new file mode 100644 index 0000000000..b84200d9b1 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_middle_10x24px.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_right_14x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_right_14x24px.svg new file mode 100644 index 0000000000..231560dd9e --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_status_field_right_14x24px.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_356x96px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_356x96px.svg new file mode 100644 index 0000000000..679d9a5305 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_356x96px.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_horisontal_636x96px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_horisontal_636x96px.svg new file mode 100644 index 0000000000..1ef4fb9224 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_topbar_horisontal_636x96px.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_default_icon_84x68px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_default_icon_84x68px.svg new file mode 100644 index 0000000000..4df0214e56 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_default_icon_84x68px.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_idle_24x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_idle_24x24px.svg new file mode 100644 index 0000000000..2d6da38ad0 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_idle_24x24px.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_offline_24x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_offline_24x24px.svg new file mode 100644 index 0000000000..d5920268b1 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_offline_24x24px.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_online_24x24px.svg b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_online_24x24px.svg new file mode 100644 index 0000000000..46ad07dbbd --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/resources/lime_SVG/lime_user_status_online_24x24px.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp new file mode 100644 index 0000000000..2b1e87ccac --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.cpp @@ -0,0 +1,401 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include + +#include "abstractitemcontainer.h" +#include "abstractitemview.h" +#include "abstractviewitem.h" +#include "scrollbar.h" + +AbstractItemContainer::AbstractItemContainer(int bufferSize, QGraphicsWidget *parent) + : GvbWidget(parent), + m_items(), + m_itemView(0), + m_prototype(0), + m_bufferSize(bufferSize), + m_twoColumns(false) +{ +} + +AbstractItemContainer::~AbstractItemContainer() +{ + delete m_prototype; + m_prototype = 0; +} + +AbstractViewItem *AbstractItemContainer::prototype() +{ + return m_prototype; +} + +int AbstractItemContainer::bufferSize() const +{ + return m_bufferSize; +} + +bool AbstractItemContainer::event(QEvent *e) +{ + if (e->type() == QEvent::LayoutRequest) + updateItemBuffer(); + + return QGraphicsWidget::event(e); +} + + +bool AbstractItemContainer::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type()==QEvent::GraphicsSceneResize && m_itemView) { +#if (QT_VERSION >= 0x040600) + const bool caching = m_itemView->listItemCaching(); + m_itemView->setListItemCaching(false); +#endif + + QSizeF s = m_itemView->size(); + s.setWidth(s.width()-m_itemView->verticalScrollBar()->size().width()); + adjustVisibleContainerSize(s); + + m_itemView->updateViewContent(); + updateItemBuffer(); + +#if (QT_VERSION >= 0x040600) + m_itemView->setListItemCaching(caching); +#endif + } + + return QGraphicsWidget::eventFilter(obj, event); +} + +QVariant AbstractItemContainer::itemChange(GraphicsItemChange change, const QVariant &value) +{ + QVariant ichange = QGraphicsWidget::itemChange(change,value); + + if (change == ItemPositionChange) { + if (m_itemView && layout() && !layout()->isActivated()) + m_itemView->refreshContainerGeometry(); + } + return ichange; + } + +/*virtual*/ +void AbstractItemContainer::setItemView(AbstractItemView *view) +{ + m_itemView = view; + + if (m_itemView) { + setParentItem(m_itemView); + m_itemView->installEventFilter(this); + } +} +/*virtual*/ +void AbstractItemContainer::setItemPrototype(AbstractViewItem *ptype) +{ + m_prototype = ptype; + m_prototype->setParentItem(0); + m_prototype->hide(); +} + +/*virtual*/ +void AbstractItemContainer::reset() +{ + qDeleteAll(m_items); + m_items.clear(); + updateItemBuffer(); +} + + +/*virtual*/ +void AbstractItemContainer::addItem(const QModelIndex &index) +{ + if (m_items.count() < maxItemCountInItemBuffer() || + (m_items.count() > 0 && + m_items.first()->modelIndex().row()-1 <= index.row() && + m_items.last()->modelIndex().row() >= index.row())) { + int itemPos = 0; + if (m_items.count() != 0) + itemPos = qMax(0, index.row() - m_items.first()->modelIndex().row()); + + if (itemPos >= m_items.count() || m_items.at(itemPos)->modelIndex() != index) { + AbstractViewItem *item = 0; + if (m_prototype) + item = m_prototype->newItemInstance(); + + if (item) { + item->setModel(m_itemView->model()); + item->setTwoColumns(m_twoColumns); + m_items.insert(itemPos, item); + addItemToVisibleLayout(itemPos, item); + + if (item->modelIndex() != index) { + item->setModelIndex(index); + } + } + } + updateItemBuffer(); + } +} +void AbstractItemContainer::removeItem(const QModelIndex &index) +{ + AbstractViewItem *item = findItemByIndex(index); + + if (item) { + if (maxItemCountInItemBuffer() < m_items.count()) { + m_items.removeOne(item); + removeItemFromVisibleLayout(item); + + delete item; + } + else { + m_items.removeOne(item); + removeItemFromVisibleLayout(item); + + QModelIndex newIndex = m_itemView->nextIndex(m_items.last()->modelIndex()); + if (newIndex.isValid()) { + // Item readded as last item in buffer. + m_items.append(item); + addItemToVisibleLayout(m_items.count() - 1, item); + item->setModelIndex(newIndex); + } else { + // Item readded as first item in buffer. + newIndex = m_itemView->previousIndex(m_items.first()->modelIndex()); + + m_items.prepend(item); + addItemToVisibleLayout(0, item); + item->setModelIndex(newIndex); + } + } + } +} + +/*virtual*/ +int AbstractItemContainer::itemCount() const +{ + return m_items.count(); +} + +AbstractViewItem *AbstractItemContainer::firstItem() +{ + return m_items.first(); +} + +/*virtual*/ +AbstractViewItem* AbstractItemContainer::itemAt(const int row) const +{ + if (row<0 || row >= m_items.count()) + return 0; + return m_items.at(row); +} + +AbstractViewItem* AbstractItemContainer::findItemByIndex(const QModelIndex &index) const +{ + AbstractViewItem *item = 0; + for (int i = 0; i < m_items.count(); ++i) { + if (m_items.at(i)->modelIndex() == index) { + item = m_items.at(i); + break; + } + } + return item; +} + +bool AbstractItemContainer::itemVisibleInView(AbstractViewItem* item, const QRectF &viewRect, bool fullyVisible) const +{ + if (!item || !m_itemView) + return false; + + QRectF itemRectBoundingRect = item->mapToItem(m_itemView, item->boundingRect()).boundingRect(); + + if (fullyVisible && viewRect.contains(itemRectBoundingRect)) + return true; + else if (viewRect.intersects(itemRectBoundingRect)) + return true; + + return false; +} + +void AbstractItemContainer::updateItemBuffer() +{ + if (!m_itemView || (m_itemView && !m_itemView->boundingRect().isValid())) + return; + + int maxCount = maxItemCountInItemBuffer(); + + if (m_items.count() < maxCount) { + // New items needs to be added. + QModelIndex index; + if (m_items.count() > 0) + index = m_items.last()->modelIndex(); + while (m_items.count() < maxCount) { + index = m_itemView->nextIndex(index); + + if (!index.isValid()) + break; + + insertItem(m_items.count(), index); + } + + index = m_items.first()->modelIndex(); + while (m_items.count() < maxCount) { + index = m_itemView->previousIndex(index); + + if (!index.isValid()) + break; + + insertItem(0, index); + } + } + + QRectF viewRect = boundingRect(); + + while (m_items.count() > maxCount) { + int firstVisible = 0; + int lastVisible = 0; + findFirstAndLastVisibleBufferIndex(firstVisible, lastVisible, viewRect, false); + + AbstractViewItem* item = 0; + if (lastVisible != m_items.count() - 1) { + item = m_items.takeLast(); + } + else if (firstVisible != 0 && m_items.first()->modelIndex().row() != firstVisible-1) { + item = m_items.takeFirst(); + } + else { + // All the items are visible. Take the item at the end of the buffer. + item = m_items.takeLast(); + } + + m_items.removeOne(item); + removeItemFromVisibleLayout(item); + delete item; + } +} + +void AbstractItemContainer::insertItem(int pos, const QModelIndex &index) +{ + AbstractViewItem *item = 0; + if (m_prototype) + item = m_prototype->newItemInstance(); + + if (item) { + item->setModel(m_itemView->model()); + item->setModelIndex(index); + item->setTwoColumns(m_twoColumns); + m_items.insert(pos, item); + addItemToVisibleLayout(pos, item); + item->updateItemContents(); + if (pos == 0) + m_itemView->scrollContentsBy(qreal(0.0), + item->effectiveSizeHint(Qt::PreferredSize).height()); + } +} + +void AbstractItemContainer::findFirstAndLastVisibleBufferIndex(int &firstVisibleBufferIndex, + int &lastVisibleBufferIndex, + const QRectF &viewRect, + bool fullyVisible) const +{ + if (layout() && !layout()->isActivated()) + layout()->activate(); + + firstVisibleBufferIndex = -1; + lastVisibleBufferIndex = -1; + + int count = m_items.count(); + for (int i = 0; i < count; ++i) { + if (itemVisibleInView(m_items.at(i), viewRect, fullyVisible)) { + if (firstVisibleBufferIndex == -1) + firstVisibleBufferIndex = i; + lastVisibleBufferIndex = i; + } + else if ( lastVisibleBufferIndex != -1 ) + break; // lastVisibleBufferIndex is already set + } +} + +/*virtual*/ +int AbstractItemContainer::maxItemCountInItemBuffer() const +{ + if (m_itemView && !m_itemView->boundingRect().isEmpty()) + { + return m_itemView->indexCount(); + } + return 0; +} + + +void AbstractItemContainer::themeChange() +{ + for (int i = 0; i themeChange(); +} + +void AbstractItemContainer::updateContent() +{ + for (int i = 0; i updateItemContents(); +} + +#if (QT_VERSION >= 0x040600) +void AbstractItemContainer::setSubtreeCacheEnabled(bool enabled) +{ + for (int i = 0; i setSubtreeCacheEnabled(enabled); + if (m_prototype) + m_prototype->setSubtreeCacheEnabled(enabled); +} +#endif + +void AbstractItemContainer::setTwoColumns(const bool enabled) +{ + if (m_twoColumns == enabled) + return; + + m_twoColumns = enabled; + + for (int i = 0; i < m_items.count(); ++i) + m_items.at(i)->setTwoColumns(enabled); +} + +bool AbstractItemContainer::twoColumns() +{ + return m_twoColumns; +} + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h new file mode 100644 index 0000000000..249f7a76ea --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemcontainer.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTITEMCONTAINER_H +#define ABSTRACTITEMCONTAINER_H + +#include + +#include "gvbwidget.h" + +class QGraphicsWidget; +class AbstractItemView; +class AbstractViewItem; + +class AbstractItemContainer : public GvbWidget +{ + Q_OBJECT +public: + AbstractItemContainer(int bufferSize, QGraphicsWidget *parent=0); + virtual ~AbstractItemContainer(); + + virtual void addItem(const QModelIndex &index); + virtual void removeItem(const QModelIndex &index); + + virtual void setItemView(AbstractItemView *view); + virtual void setItemPrototype(AbstractViewItem *ptype); + virtual void reset(); + virtual int itemCount() const; + virtual AbstractViewItem* itemAt(const int row) const; + AbstractViewItem* findItemByIndex(const QModelIndex &index) const; + AbstractViewItem *prototype(); + AbstractViewItem *firstItem(); + void updateContent(); + void themeChange(); + int bufferSize() const; + virtual void setTwoColumns(const bool enabled); + bool twoColumns(); + +#if (QT_VERSION >= 0x040600) + void setSubtreeCacheEnabled(const bool enabled); + virtual void setListItemCaching(const bool enabled, const int index) = 0; +#endif + +protected: + virtual void adjustVisibleContainerSize(const QSizeF &size) = 0; + virtual void addItemToVisibleLayout(int index, AbstractViewItem *item) = 0; + virtual void removeItemFromVisibleLayout(AbstractViewItem *item) = 0; + + virtual bool event(QEvent *e); + virtual bool eventFilter(QObject *obj, QEvent *event); + virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); + virtual int maxItemCountInItemBuffer() const; + bool itemVisibleInView(AbstractViewItem* item, const QRectF &viewRect, bool fullyVisible = true) const; + +protected: + void updateItemBuffer(); + void findFirstAndLastVisibleBufferIndex(int &firstVisibleBufferIndex, + int &lastVisibleBufferIndex, + const QRectF &viewRect, + bool fullyVisible) const; + QList m_items; + AbstractItemView *m_itemView; + AbstractViewItem *m_prototype; + int m_bufferSize; + +private: + void insertItem(int pos, const QModelIndex &index); + bool m_twoColumns; + + Q_DISABLE_COPY(AbstractItemContainer) +}; + +#endif // ABSTRACTITEMCONTAINER_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp new file mode 100644 index 0000000000..63ab2f9313 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.cpp @@ -0,0 +1,443 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include "abstractitemview.h" +#include "abstractviewitem.h" +#include "scrollbar.h" + +AbstractItemView::AbstractItemView(QGraphicsWidget *parent) + : AbstractScrollArea(parent), + m_model(0), + m_rootIndex(), + m_container(0), + m_selectionModel(0), + m_currentIndex(), + m_scroller() +{ + setRootIndex(QModelIndex()); +} + +/*virtual*/ +AbstractItemView::~AbstractItemView() +{ +} + +/*virtual*/ +void AbstractItemView::setModel(QAbstractItemModel *model, AbstractViewItem *prototype) +{ + if( m_model == model || !model) + return; + + if (m_model) { + disconnect(m_model, SIGNAL(destroyed()), + this, SLOT(_q_modelDestroyed())); + disconnect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT( dataChanged(QModelIndex,QModelIndex))); + disconnect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(rowsInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)), + this, SLOT(columnsInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(columnsAboutToBeInserted(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)), + this, SLOT(columnsRemoved(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(columnsAboutToBeRemoved(QModelIndex,int,int))); + disconnect(m_model, SIGNAL(modelReset()), this, SLOT(reset())); + disconnect(m_model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged())); + + m_model = 0; + } + + setSelectionModel(0); + + m_currentIndex = QModelIndex(); + m_rootIndex = QModelIndex(); + + m_model = model; + + Q_ASSERT_X(m_model->index(0,0) == m_model->index(0,0), + "AbstractItemView::setModel", + "A model should return the exact same index " + "(including its internal id/pointer) when asked for it twice in a row."); + Q_ASSERT_X(m_model->index(0,0).parent() == QModelIndex(), + "AbstractItemView::setModel", + "The parent of a top level index should be invalid"); + + + connect(m_model, SIGNAL(destroyed()), this, SLOT(modelDestroyed())); + connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + this, SLOT( dataChanged(QModelIndex,QModelIndex))); + connect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); + connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(rowsInserted(QModelIndex,int,int))); + connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), + this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); + connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int))); + connect(m_model, SIGNAL(modelReset()), this, SLOT(reset())); + connect(m_model, SIGNAL(layoutChanged()), this, SLOT(layoutChanged())); + + setSelectionModel(new QItemSelectionModel(m_model)); + + if (prototype && m_container) { + m_container->setItemPrototype(prototype); + m_container->reset(); + } +} + +/*virtual*/ +void AbstractItemView::setContainer(AbstractItemContainer *container) +{ + m_container = container; + m_container->setItemView(this); + m_container->setParentItem(viewport()); + + viewport()->setFlag( + QGraphicsItem::ItemClipsChildrenToShape, true); + m_scroller.setScrollable(this); + installEventFilter(&m_scroller); +} + +/*virtual*/ +void AbstractItemView::setRootIndex(const QModelIndex &index) +{ + m_rootIndex = index; + // TODO fix this if we change index, container should be updated? Or do we need root index? +} + +/*virtual*/ +int AbstractItemView::indexCount() const +{ + if (m_model) + return m_model->rowCount(m_rootIndex); + return 0; +} + +/*virtual*/ +QAbstractItemModel* AbstractItemView::model() const +{ + return m_model; +} + +/*virtual*/ +QModelIndex AbstractItemView::nextIndex(const QModelIndex &index) const +{ + if (!m_model) + return QModelIndex(); + + if (index.isValid()) + return m_model->index(index.row() + 1, 0, m_rootIndex); + else + return m_model->index(0, 0, m_rootIndex); +} + +/*virtual*/ +QModelIndex AbstractItemView::previousIndex(const QModelIndex &index) const +{ + if (!m_model) + return QModelIndex(); + + if (index.isValid()) + return m_model->index(index.row() - 1, 0, m_rootIndex); + else + return m_model->index(m_model->rowCount(m_rootIndex) - 1, 0, m_rootIndex); +} + +/*virtual*/ +void AbstractItemView::setItemPrototype(AbstractViewItem* prototype) +{ + if (prototype && m_container) { + m_container->setItemPrototype(prototype); + m_container->reset(); + } +} + +void AbstractItemView::setSelectionModel(QItemSelectionModel *smodel) +{ + if (smodel && smodel->model() != m_model) { + return; + } + if (m_selectionModel) { + disconnect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + this, SLOT(currentSelectionChanged(QItemSelection, QItemSelection))); + + disconnect(m_selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + this, SLOT(currentIndexChanged(QModelIndex, QModelIndex))); + + delete m_selectionModel; + m_selectionModel = 0; + } + + m_selectionModel = smodel; + + if (m_selectionModel) { + connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), + this, SLOT(currentSelectionChanged(QItemSelection, QItemSelection))); + connect(m_selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), + this, SLOT(currentIndexChanged(QModelIndex, QModelIndex))); + } +} + +/*virtual*/ +void AbstractItemView::currentIndexChanged(const QModelIndex ¤t, const QModelIndex &previous) +{ + Q_UNUSED(previous) + + if (current != m_currentIndex) + m_currentIndex = current; +} + +/*virtual*/ +void AbstractItemView::currentSelectionChanged(const QItemSelection &selected, + const QItemSelection &deselected) +{ + Q_UNUSED(selected) + Q_UNUSED(deselected) +} + +/*virtual*/ +void AbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) +{ + Q_UNUSED(topLeft) + Q_UNUSED(bottomRight) + // TODO implement if we like to edit view items. +} + +/*virtual*/ +void AbstractItemView::rowsAboutToBeInserted(const QModelIndex &index, int start, int end) +{ + Q_UNUSED(index) + Q_UNUSED(start) + Q_UNUSED(end) + + // TODO implement +} + + +/*virtual*/ +void AbstractItemView::rowsAboutToBeRemoved(const QModelIndex &index,int start, int end) +{ + Q_UNUSED(index) + Q_UNUSED(start) + Q_UNUSED(end) +} + +/*virtual*/ +void AbstractItemView::rowsRemoved(const QModelIndex &parent,int start, int end) +{ + Q_UNUSED(parent) + Q_UNUSED(start) + Q_UNUSED(end) + + if (start <= m_currentIndex.row() && m_currentIndex.row() <= end) { + QModelIndex newCurrentIndex = m_model->index(start, 0, m_rootIndex); + if (!newCurrentIndex.isValid()) { + newCurrentIndex = m_model->index(qMax(0,start - 1), 0, m_rootIndex); + } + + if (m_selectionModel) { + m_selectionModel->setCurrentIndex(newCurrentIndex, QItemSelectionModel::NoUpdate); + } + } + for (int i = end; i >= start; --i) //The items are already removed from the model. + m_container->removeItem(QModelIndex()); // Indexes are already invalid. +} + +/*virtual*/ +void AbstractItemView::reset() +{ + m_rootIndex = QModelIndex(); + + if (m_container) + m_container->reset(); + + setCurrentIndex(QModelIndex()); + + ScrollBar *sb = verticalScrollBar(); + + if (sb) + sb->setSliderSize(0); +} + +/*virtual*/ +void AbstractItemView::rowsInserted(const QModelIndex &parent, int start, int end) +{ + if (!m_container) + return; + + for (int i = start; i <= end; ++i) + m_container->addItem(m_model->index(i, 0, parent)); + + refreshContainerGeometry(); +} + +/*virtual*/ +void AbstractItemView::modelDestroyed() +{ + m_model = 0; + setSelectionModel(0); + reset(); +} + +/*virtual*/ +void AbstractItemView::layoutChanged() +{ + m_container->reset(); +} + +bool AbstractItemView::event(QEvent *e) +{ + bool result = AbstractScrollArea::event(e); + if (e && e->type()==QEvent::LayoutRequest) { + refreshContainerGeometry(); + result = true; + } + if (e && e->type()==QEvent::GraphicsSceneResize) { + m_scroller.stopScrolling(); + refreshContainerGeometry(); + + m_container->resize(this->size().width()-verticalScrollBar()->size().width(), + m_container->preferredHeight()); + + if(verticalScrollBar()->sliderPosition() > verticalScrollBar()->sliderSize()) + verticalScrollBar()->setSliderPosition(verticalScrollBar()->sliderSize()); + + result = true; + } + return result; +} + +void AbstractItemView::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags selectionFlag) +{ + if (m_selectionModel) + m_selectionModel->setCurrentIndex(index, selectionFlag); +} + +void AbstractItemView::refreshContainerGeometry() +{ + if (!m_container || !m_model) + return; + + if (m_container->layout() && !m_container->layout()->isActivated()) + m_container->layout()->activate(); + + ScrollBar *sb = verticalScrollBar(); + + if (sb) { + AbstractViewItem *item = m_container->itemAt(0); + if (item) { + qreal oneItemH = item->size().height(); + sb->setSliderSize(oneItemH*m_model->rowCount(m_rootIndex)-size().height()); + } + if (!sb->isVisible() && verticalScrollBarPolicy() != Qt::ScrollBarAlwaysOff && + contentsRect().height() < m_container->boundingRect().height()) + sb->show(); + } +} + +void AbstractItemView::scrollContentsBy(qreal dx, qreal dy) +{ + AbstractScrollArea::scrollContentsBy(dx, dy); + + if (!viewport() || !m_container || (m_container && m_container->itemCount() <= 0) || + !m_model || (m_model && m_model->rowCount() <= 0) || + (viewport() && viewport()->boundingRect().height() < contentsRect().height())) + return; + + qreal itemH = 1; + + AbstractViewItem *item = m_container->itemAt(0); + if(item && item->size().height() > 1) { + itemH = item->size().height(); + } + else if(item && item->preferredHeight() > 1) { + itemH = item->preferredHeight(); + } + + qreal vpx = m_container->pos().x(); + qreal vpy = m_container->pos().y(); + + if ((vpy+m_container->size().height()-dy > pos().y()+size().height()) && + (qAbs(dy) < itemH) && (vpy-dy <= 0)) { + m_container->setPos(vpx, vpy-dy); + } + else { + qreal vPos = verticalScrollBar()->sliderPosition(); + int startRow = m_model->index(vPos/itemH, 0).row(); + int itemsInContainer = m_container->itemCount(); + + for (int i = 0; iitemAt(i); + changedItem->setModelIndex(m_model->index(startRow+i,0)); +#if (QT_VERSION >= 0x040600) + m_container->setListItemCaching(listItemCaching(), i); +#endif + } + + qreal diff = vPos-startRow*itemH; + + if (diff < 0) + m_container->setPos(vpx, diff); + else + m_container->setPos(vpx, -diff); + } +} + +void AbstractItemView::changeTheme() +{ + if (m_container) + m_container->themeChange(); +} + +void AbstractItemView::updateViewContent() +{ + if (m_container) + m_container->updateContent(); +} diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h new file mode 100644 index 0000000000..2e286fb002 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractitemview.h @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTITEMVIEW_H +#define ABSTRACTITEMVIEW_H + +#include +#include +#include +#include + +#include "listitemcontainer.h" +#include "abstractscrollarea.h" +#include "scroller.h" + +class QItemSelectionModel; + +class AbstractItemView : public AbstractScrollArea +{ + Q_OBJECT +public: + AbstractItemView(QGraphicsWidget *parent = 0); + virtual ~AbstractItemView(); + virtual void setContainer(AbstractItemContainer *container); + virtual void setModel(QAbstractItemModel *model, AbstractViewItem *prototype); + virtual QAbstractItemModel* model() const; + virtual void setItemPrototype(AbstractViewItem* prototype); + + void setSelectionModel(QItemSelectionModel *smodel); + + virtual QModelIndex nextIndex(const QModelIndex &index) const; + virtual QModelIndex previousIndex(const QModelIndex &index) const; + + virtual int indexCount() const; + + void refreshContainerGeometry(); // TODO Can this be moved to scroll area? + + void updateViewContent(); + virtual void scrollContentsBy(qreal dx, qreal dy); + +#if (QT_VERSION >= 0x040600) + virtual bool listItemCaching() const = 0; + virtual void setListItemCaching(bool enabled) = 0; +#endif + +protected: + virtual bool event(QEvent *e); + void changeTheme(); + +public slots: + virtual void setRootIndex(const QModelIndex &index); + void setCurrentIndex(const QModelIndex &index, + QItemSelectionModel::SelectionFlags selectionFlag = QItemSelectionModel::NoUpdate); +protected slots: + virtual void currentIndexChanged(const QModelIndex ¤t, const QModelIndex &previous); + virtual void currentSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + virtual void rowsAboutToBeInserted(const QModelIndex &index, int start, int end); + virtual void rowsInserted(const QModelIndex &parent, int start, int end); + virtual void rowsAboutToBeRemoved(const QModelIndex &index,int start, int end); + virtual void rowsRemoved(const QModelIndex &parent,int start, int end); + virtual void modelDestroyed(); + virtual void layoutChanged(); + virtual void reset(); + +protected: + + QAbstractItemModel *m_model; + QPersistentModelIndex m_rootIndex; + AbstractItemContainer *m_container; + QItemSelectionModel *m_selectionModel; + QPersistentModelIndex m_currentIndex; + +private: + Q_DISABLE_COPY(AbstractItemView) + Scroller m_scroller; +}; + + +#endif // ABSTRACTITEMVIEW_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp new file mode 100644 index 0000000000..202c06ff32 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.cpp @@ -0,0 +1,249 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "abstractscrollarea.h" +#include "scrollbar.h" + +AbstractScrollArea::AbstractScrollArea(QGraphicsWidget *parent) + : GvbWidget(parent) + , m_viewport(0) + , m_horizontalScrollBar(0) + , m_verticalScrollBar(0) + , m_prevHorizontalValue(0.0) + , m_prevVerticalValue(0.0) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setContentsMargins(0, 0, 0, 0); + + m_horizontalScrollBar = new ScrollBar(Qt::Horizontal, this); + m_horizontalScrollBar->hide(); + m_horizontalScrollBar->setContentsMargins(0, 0, 0, 0); + m_horizontalScrollBarPolicy = Qt::ScrollBarAsNeeded; + m_horizontalScrollBar->setZValue(zValue()+1); // Raise scroll bar to top + m_horizontalScrollBar->setVisible(false); + + connect(m_horizontalScrollBar, SIGNAL(sliderPositionChange(qreal)), + this, SLOT(horizontalScroll(qreal))); + connect(m_horizontalScrollBar, SIGNAL(sliderPressed()), + this, SLOT(horizontalScrollStart())); + + m_verticalScrollBar = new ScrollBar(Qt::Vertical, this); + m_verticalScrollBar->hide(); + m_verticalScrollBar->setContentsMargins(0, 0, 0, 0); + m_verticalScrollBarPolicy = Qt::ScrollBarAsNeeded; + m_verticalScrollBar->setZValue(zValue()+1); // Raise scroll bar to top + m_verticalScrollBar->setVisible(false); + + connect(m_verticalScrollBar, SIGNAL(sliderPositionChange(qreal)), + this, SLOT(verticalScroll(qreal))); + connect(m_verticalScrollBar, SIGNAL(sliderPressed()), + this, SLOT(verticalScrollStart())); + + QGraphicsWidget *viewport = new QGraphicsWidget; + setViewport(viewport); +} + +AbstractScrollArea::~AbstractScrollArea() +{ +} + +ScrollBar *AbstractScrollArea::verticalScrollBar() const +{ + return m_verticalScrollBar; +} + +ScrollBar *AbstractScrollArea::horizontalScrollBar() const +{ + return m_horizontalScrollBar; +} + +void AbstractScrollArea::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy) +{ + m_horizontalScrollBarPolicy = policy; +} + +void AbstractScrollArea::setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy) +{ + m_verticalScrollBarPolicy = policy; +} + +Qt::ScrollBarPolicy AbstractScrollArea::verticalScrollBarPolicy() const +{ + return m_verticalScrollBarPolicy; +} + +Qt::ScrollBarPolicy AbstractScrollArea::horizontalScrollBarPolicy() const +{ + return m_horizontalScrollBarPolicy; +} + +QGraphicsWidget *AbstractScrollArea::viewport() const +{ + return m_viewport; +} + +void AbstractScrollArea::setViewport(QGraphicsWidget *viewport) +{ + if (m_viewport) { + m_viewport->setParentItem(0); + + QList children = m_viewport->childItems(); + + foreach (QGraphicsItem *child, children) + child->setParentItem(0); + + delete m_viewport; + } + + m_viewport = viewport; + + if (viewport) { + + m_viewport->setParentItem(this); + m_viewport->setContentsMargins(0, 0, 0, 0); + + adjustScrollBars(); + } + + emit viewportChanged(viewport); +} + +bool AbstractScrollArea::event(QEvent *e) +{ + if (e->type() == QEvent::ApplicationLayoutDirectionChange + || e->type() == QEvent::LayoutDirectionChange) { + } else if (e->type() == QEvent::GraphicsSceneResize) { + QGraphicsSceneResizeEvent *event = + static_cast(e); + + QSizeF newSize = event->newSize(); + QRectF hrect = m_horizontalScrollBar->boundingRect(); + QRectF vrect = m_verticalScrollBar->boundingRect(); + + QSizeF vpSize = newSize; + + if (m_horizontalScrollBarPolicy != Qt::ScrollBarAlwaysOff) + vpSize.setHeight(newSize.height() - hrect.height()); + if (m_verticalScrollBarPolicy != Qt::ScrollBarAlwaysOff) + vpSize.setWidth(newSize.width() - vrect.width()); + + m_viewport->resize(vpSize); + + adjustScrollBars(); + } + + return QGraphicsWidget::event(e); +} + + +void AbstractScrollArea::scrollContentsBy(qreal dx, qreal dy) +{ + Q_UNUSED(dx) + Q_UNUSED(dy) + prepareGeometryChange(); +} + +void AbstractScrollArea::verticalScrollStart() +{ + m_prevVerticalValue = m_verticalScrollBar->sliderPosition(); +} + +void AbstractScrollArea::verticalScroll(qreal value) +{ + qreal dy = value - m_prevVerticalValue; + if (!qFuzzyCompare(dy,qreal(0.0))) { + scrollContentsBy(0.0, dy); + m_prevVerticalValue = value; + } +} + +void AbstractScrollArea::horizontalScrollStart() +{ + m_prevHorizontalValue = m_horizontalScrollBar->sliderPosition(); +} + +void AbstractScrollArea::horizontalScroll(qreal value) +{ + qreal dx = value - m_prevHorizontalValue; + if (!qFuzzyCompare(dx,qreal(0.0))) { + scrollContentsBy(dx, 0.0); + m_prevHorizontalValue = value; + } +} + +void AbstractScrollArea::adjustScrollBars() +{ + if (m_horizontalScrollBarPolicy == Qt::ScrollBarAlwaysOff) { + m_horizontalScrollBar->hide(); + } else { + m_horizontalScrollBar->show(); + + QRectF sbgeom = boundingRect(); + + sbgeom.setTop(sbgeom.bottom() - m_horizontalScrollBar->boundingRect().height()); + sbgeom.setRight(sbgeom.right() - m_verticalScrollBar->boundingRect().width()); + m_horizontalScrollBar->setGeometry(sbgeom); + } + + if (m_verticalScrollBarPolicy == Qt::ScrollBarAlwaysOff) { + m_verticalScrollBar->hide(); + QRectF sbgeom = boundingRect(); + sbgeom.setLeft(sbgeom.right()); + sbgeom.setBottom(sbgeom.bottom()); + m_verticalScrollBar->setGeometry(sbgeom); + } else { + m_verticalScrollBar->show(); + + QRectF sbgeom = boundingRect(); + + sbgeom.setLeft(sbgeom.right() - m_verticalScrollBar->boundingRect().width()); + if (m_horizontalScrollBarPolicy != Qt::ScrollBarAlwaysOff) + sbgeom.setBottom(sbgeom.bottom() - m_horizontalScrollBar->boundingRect().height()); + m_verticalScrollBar->setGeometry(sbgeom); + } +} + + + + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h new file mode 100644 index 0000000000..bc0b97f82f --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractscrollarea.h @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTSCROLLAREA_H +#define ABSTRACTSCROLLAREA_H + +#include "gvbwidget.h" + +class ScrollBar; +class QGraphicsGridLayout; + +class AbstractScrollArea : public GvbWidget +{ + Q_OBJECT + +public: + + AbstractScrollArea(QGraphicsWidget *parent = 0); + ~AbstractScrollArea(); + +public: + + void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy); + void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy); + Qt::ScrollBarPolicy verticalScrollBarPolicy() const; + Qt::ScrollBarPolicy horizontalScrollBarPolicy() const; + + QGraphicsWidget *viewport() const; + void setViewport(QGraphicsWidget *viewport); + + ScrollBar *verticalScrollBar() const; + ScrollBar *horizontalScrollBar() const; + +signals: + + void viewportChanged(QGraphicsWidget *viewport); + +protected: + + virtual bool event(QEvent *e); + virtual void scrollContentsBy(qreal dx, qreal dy); + +private slots: + + void verticalScrollStart(); + void verticalScroll(qreal); + void horizontalScrollStart(); + void horizontalScroll(qreal); + +private: + + void adjustScrollBars(); + + QGraphicsWidget *m_viewport; + ScrollBar *m_horizontalScrollBar; + ScrollBar *m_verticalScrollBar; + Qt::ScrollBarPolicy m_verticalScrollBarPolicy; + Qt::ScrollBarPolicy m_horizontalScrollBarPolicy; + qreal m_prevHorizontalValue; + qreal m_prevVerticalValue; +}; + +#endif // ABSTRACTSCROLLAREA_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp new file mode 100644 index 0000000000..2787a2e178 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractviewitem.h" + +AbstractViewItem::AbstractViewItem(QGraphicsWidget *parent) + : GvbWidget(parent), + m_index(), + m_itemView(0), + m_prototype(0) +{ +} + +/*virtual*/ +AbstractViewItem::~AbstractViewItem() +{ +} + +QModelIndex AbstractViewItem::modelIndex() const +{ + return m_index; +} + +AbstractViewItem *AbstractViewItem::prototype() const +{ + return m_prototype; +} + +AbstractItemView *AbstractViewItem::itemView() const +{ + return m_itemView; +} + +void AbstractViewItem::setItemView(AbstractItemView *itemView) +{ + m_itemView = itemView; +} + +void AbstractViewItem::setModelIndex(const QModelIndex &index) +{ + if (m_index != index) { + m_index = index; + updateItemContents(); + } +} + +/*virtual*/ +QSizeF AbstractViewItem::effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ + return GvbWidget::effectiveSizeHint(which, constraint); +} + +/*virtual*/ +bool AbstractViewItem::event(QEvent *e) +{ + return QGraphicsWidget::event(e); +} + +/*virtual*/ +void AbstractViewItem::updateItemContents() +{ + ; // No impl yet +} + +/*virtual*/ +void AbstractViewItem::themeChange() +{ + ; // No impl yet +} + +#if (QT_VERSION >= 0x040600) +/*virtual*/ +void AbstractViewItem::setSubtreeCacheEnabled(bool enabled) +{ + Q_UNUSED(enabled) + ; // No impl +} +#endif + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h new file mode 100644 index 0000000000..1eace4e501 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/abstractviewitem.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTVIEWITEM_H +#define ABSTRACTVIEWITEM_H + +#include + +#include "gvbwidget.h" +#include "abstractitemview.h" +#include "listitem.h" + +class QGraphicsWidget; + +class AbstractViewItem : public GvbWidget +{ + Q_OBJECT +public: + AbstractViewItem(QGraphicsWidget *parent = 0); + virtual ~AbstractViewItem(); + + virtual AbstractViewItem *newItemInstance() = 0; + + QModelIndex modelIndex() const; + + void setModelIndex(const QModelIndex &index); + + AbstractViewItem *prototype() const; + AbstractItemView *itemView() const; + void setItemView(AbstractItemView *itemView) ; + virtual void updateItemContents(); + virtual void themeChange(); + +#if (QT_VERSION >= 0x040600) + virtual void setSubtreeCacheEnabled(bool enabled); +#endif + + virtual QSizeF effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + + virtual void setModel(QAbstractItemModel *model) = 0; + virtual QVariant data(int role) const = 0; + virtual void setData(const QVariant &value, int role = Qt::DisplayRole) = 0; + virtual void setTwoColumns(const bool enabled) = 0; + +protected: + virtual bool event(QEvent *e); + + QPersistentModelIndex m_index; + +private: + Q_DISABLE_COPY(AbstractViewItem) + + AbstractItemView *m_itemView; + AbstractViewItem *m_prototype; + +}; + +#endif // ABSTRACTVIEWITEM_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp new file mode 100644 index 0000000000..93a1c847c7 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include "backgrounditem.h" +#include "theme.h" + +BackgroundItem::BackgroundItem(const QString &filename, QGraphicsWidget *parent) + : GvbWidget(parent), + m_background(), + m_fileName(filename) +{ + setContentsMargins(0,0,0,0); + + connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange())); +} + +BackgroundItem::~BackgroundItem() +{ + +} + +void BackgroundItem::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + GvbWidget::resizeEvent(event); + m_background = Theme::p()->pixmap(m_fileName, size().toSize()); +} + +void BackgroundItem::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + Q_UNUSED(widget) + painter->setCompositionMode(QPainter::CompositionMode_Source); + painter->drawPixmap(option->exposedRect, m_background, option->exposedRect); +} + +void BackgroundItem::themeChange() +{ + m_background = Theme::p()->pixmap(m_fileName, size().toSize()); + update(); +} + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h new file mode 100644 index 0000000000..89d8f7ef0b --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/backgrounditem.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef __BACKGROUNDITEM_H__ +#define __BACKGROUNDITEM_H__ + +#include + +#include "gvbwidget.h" + +class QGraphicsWidget; + +class BackgroundItem : public GvbWidget +{ + Q_OBJECT + +public: + BackgroundItem(const QString &filename, QGraphicsWidget *parent=0); + ~BackgroundItem(); + + void paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget = 0); + void resizeEvent(QGraphicsSceneResizeEvent *event); + +public slots: + void themeChange(); + +private: + QPixmap m_background; + QString m_fileName; +}; + +#endif /* __BACKGROUNDITEM_H__ */ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp new file mode 100644 index 0000000000..1d64c7f7a4 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "button.h" +#include "theme.h" + +static const int MinTextWidthAsChars = 8; + +class ButtonPrivate { + Q_DECLARE_PUBLIC(Button) + +public: + + ButtonPrivate(Button *button) + : down(false) + , q_ptr(button) + { + textItem = new QGraphicsSimpleTextItem(q_ptr); + } + + QGraphicsSimpleTextItem *textItem; + bool down; + Button *q_ptr; +}; + +Button::Button(const QString &text, QGraphicsItem *parent, QSizeF minimumSize) + : QGraphicsWidget(parent) + , d_ptr(new ButtonPrivate(this)), m_background(), m_selected(false) +{ + Q_D(Button); + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); + //setCacheMode(QGraphicsItem::ItemCoordinateCache); + if(minimumSize.isValid()) + setMinimumSize(minimumSize); + setContentsMargins(0, 0, 0, 0); + d->textItem->setText(text); + prepareGeometryChange(); + + m_font = Theme::p()->font(Theme::MenuItem); + d->textItem->setFont(m_font); + connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange())); +} + +Button::~Button() +{ + delete d_ptr; +} + +bool Button::isDown() +{ + Q_D(Button); + + return d->down; +} + +void Button::setText(const QString &text) +{ + Q_D(Button); + d->textItem->setText(text); + update(); +} + +QString Button::text() +{ + Q_D(Button); + return d->textItem->text(); +} + +void Button::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + Q_UNUSED(widget); + Q_UNUSED(option); + + if(!m_background.isNull()) + painter->drawPixmap(QPoint(), m_background); + if(m_selected) { + painter->setBrush(Qt::black); + painter->setOpacity(0.2); + painter->drawRect(boundingRect().toRect()); + } +} + +QSizeF Button::sizeHint(Qt::SizeHint which, + const QSizeF &constraint) const +{ + Q_D(const Button); + + switch (which) + { + case Qt::MinimumSize: + { + QFontMetricsF fm(d->textItem->font()); + return QSizeF(MinTextWidthAsChars * fm.maxWidth(), fm.height()); + } + case Qt::PreferredSize: + { + QFontMetricsF fm(d->textItem->font()); + return QSizeF(fm.width(d->textItem->text()), fm.height()); + } + default: + return QGraphicsWidget::sizeHint(which, constraint); + } +} + +void Button::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(Button); + + if (event->button() != Qt::LeftButton || + !sceneBoundingRect().contains(event->scenePos())) + return; + + d->down = true; + + prepareGeometryChange(); + emit pressed(); + +} + +void Button::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(Button); + + if (!d->down || event->button() != Qt::LeftButton) + return; + + d->down = false; + + prepareGeometryChange(); + + emit released(); + + if (sceneBoundingRect().contains(event->scenePos())) + emit clicked(); +} + +void Button::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_UNUSED(event); +} + +void Button::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + Q_D(Button); + QGraphicsWidget::resizeEvent(event); + + QRectF rect = d->textItem->boundingRect(); + QRectF buttonrect = this->boundingRect(); + d->textItem->setPos((buttonrect.width() - rect.width())/2, (buttonrect.height() - rect.height())/2 ); + + QSize currentSize = buttonrect.size().toSize(); + if( m_background.size() != currentSize && (currentSize.width() > 0 && currentSize.height() > 0) ) { + m_background = Theme::p()->pixmap("status_field_middle.svg", buttonrect.size().toSize()); + } +} + +void Button::setBackground(QPixmap& background) +{ + m_background = background; +} + +void Button::themeChange() +{ + Q_D(Button); + + m_font = Theme::p()->font(Theme::MenuItem); + d->textItem->setFont(m_font); +} diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h new file mode 100644 index 0000000000..f8068bd6d2 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef BUTTON_H +#define BUTTON_H + +#include + +class ButtonPrivate; +class QTextDocument; + +class QPixmap; +class QFont; + +class Button : public QGraphicsWidget +{ + Q_OBJECT + Q_DECLARE_PRIVATE(Button) + +public: + + Button(const QString &text, QGraphicsItem *parent=0, QSizeF minimumSize = QSizeF()); + virtual ~Button(); + +signals: + + void clicked(bool checked = false); + void pressed(); + void released(); + +public slots: + + void themeChange(); + void setText(const QString &text); + QString text(); + +public: + + void setBackground(QPixmap& background); + bool isDown(); + void select(bool select){m_selected = select;} + void click() {emit clicked();} + +private: + + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget = 0); + QSizeF sizeHint(Qt::SizeHint which, + const QSizeF &constraint = QSizeF()) const; + + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + void resizeEvent(QGraphicsSceneResizeEvent *event); + +private: + Q_DISABLE_COPY(Button) + ButtonPrivate *d_ptr; + QPixmap m_background; + QFont m_font; + bool m_selected; +}; + +#endif // BUTTON_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp new file mode 100644 index 0000000000..c4946b3eec --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "commandline.h" + +static void usage(const char *appname) +{ + Q_UNUSED(appname); + printf(" GraphicsViewBenchmark related options:\n"); + printf(" -h,-help,--help: This help\n"); + printf(" -resolution : UI resolution in format WxH where width and height are positive values\n"); + printf(" -opengl : Enables OpenGL usage. Building PRECONDITIONS: QT_NO_OPENGL is off.\n"); + printf(" -manual : Run test manually \n"); + printf("\n The following options are available in manual mode:\n"); + printf(" -rotation : UI rotation in degrees\n"); + printf(" -subtree-cache : Enables usage of subtree caching method\n"); + printf(" -fps : Output FPS count to stdout during application execution\n"); + printf(" -items : Count of items created to the list\n"); + printf("\n"); +} + +static inline bool argumentOnlyAvailableInManualMode(const char *arg) +{ + return (strcmp(arg, "-rotation") == 0) + || (strcmp(arg, "-subtree-cache") == 0) + || (strcmp(arg, "-fps") == 0) + || (strcmp(arg, "-items") == 0); +} + +bool readSettingsFromCommandLine(int argc, char *argv[], + Settings& config) +{ + bool builtWithOpenGL = false; + Settings::Options options; + +#ifndef QT_NO_OPENGL + builtWithOpenGL = true; +#endif + for (int i = 1; i < argc; ++i) { + if (strcmp(argv[i], "-manual") == 0) { + options |= Settings::ManualTest; + argv[i] = 0; + break; + } + } + + for (int i = 1; i < argc; ++i) { + if (!argv[i]) + continue; + if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0 || strcmp(argv[i], "--help") == 0) { + usage(argv[0]); + return true; + } + if (strcmp(argv[i], "-opengl") == 0) { + if (builtWithOpenGL) { + options |= Settings::UseOpenGL; + argv[i] = 0; + } else { + printf("-opengl parameter can be used only with building PRECONDITIONS: QT_NO_OPENGL is off.\n"); + usage(argv[0]); + return false; + } + } else if (strcmp(argv[i], "-resolution") == 0) { + if (i + 1 >= argc) { + printf("-resolution needs an extra parameter specifying the application UI resolution\n"); + usage(argv[0]); + return false; + } + else { + QStringList res = QString(argv[i+1]).split("x"); + if (res.count() != 2) { + printf("-resolution parameter UI resolution should be set in format WxH where width and height are positive values\n"); + usage(argv[0]); + return false; + } + int width = res.at(0).toInt(); + int height = res.at(1).toInt(); + + config.setSize(QSize(width, height)); + + if (width <=0 || height <=0) { + printf("-resolution parameter UI resolution should be set in format WxH where width and height are positive values\n"); + usage(argv[0]); + return false; + } + argv[i] = 0; + i++; + argv[i] = 0; + } + } + + if (!argv[i]) + continue; + + if (!(options & Settings::ManualTest)) { + if (argumentOnlyAvailableInManualMode(argv[i])) { + printf("\nWrong option: '%s' is only available in manual mode\n\n", argv[i]); + usage(argv[0]); + return false; + } + continue; + } + + if (strcmp(argv[i], "-rotation") == 0) { + if (i + 1 >= argc) { + printf("-rotation needs an extra parameter specifying the application UI rotation in degrees\n"); + usage(argv[0]); + return false; + } + else { + bool ok; + int angle = QString(argv[i+1]).toInt(&ok); + if (!ok) { + printf("-rotation parameter should specify rotation angle in degrees\n"); + usage(argv[0]); + return false; + } + config.setAngle(angle); + argv[i] = 0; + i++; + argv[i] = 0; + } + } else if (strcmp(argv[i], "-subtree-cache") == 0) { + options |= Settings::UseListItemCache; + argv[i] = 0; + } else if (strcmp(argv[i], "-fps") == 0) { + options |= Settings::OutputFps; + argv[i] = 0; + } else if (strcmp(argv[i], "-items") == 0) { + if (i + 1 >= argc) { + printf("-items needs an extra parameter specifying amount of list items\n"); + usage(argv[0]); + return false; + } + else { + bool ok; + int amount = QString(argv[i+1]).toInt(&ok); + if (!ok) { + printf("-items needs an extra parameter specifying amount (integer) of list items\n"); + usage(argv[0]); + return false; + } + config.setListItemCount(amount); + argv[i] = 0; + i++; + argv[i] = 0; + } + } + } + + config.setOptions(options); + + return true; +} + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h new file mode 100644 index 0000000000..0b05709704 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef COMMANDLINE_H +#define COMMANDLINE_H + +#include "settings.h" + +bool readSettingsFromCommandLine(int argc, + char *argv[], + Settings& settings); + + +#endif // COMMANDLINE_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp new file mode 100644 index 0000000000..bf25d4d0de --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "theme.h" + +#include "dummydatagen.h" + +DummyDataGenerator::DummyDataGenerator() : m_isMale(false) +{ + QFile countryCodeFile(":/contact/areacodes.txt"); + countryCodeFile.open(QIODevice::ReadOnly); + while (!countryCodeFile.atEnd()) { + m_countryCodes << QString(countryCodeFile.readLine()).remove("\n"); + } + + QFile firstNameFFile(":/contact/firstnamesF.txt"); + firstNameFFile.open(QIODevice::ReadOnly); + while (!firstNameFFile.atEnd()) { + m_firstNamesF << QString(firstNameFFile.readLine()).remove("\n"); + } + + QFile firstNameMFile(":/contact/firstnamesM.txt"); + firstNameMFile.open(QIODevice::ReadOnly); + while (!firstNameMFile.atEnd()) { + m_firstNamesM << QString(firstNameMFile.readLine()).remove("\n"); + } + + QFile lastNameFile(":/contact/lastnames.txt"); + lastNameFile.open(QIODevice::ReadOnly); + while (!lastNameFile.atEnd()) { + m_lastNames << QString(lastNameFile.readLine()).remove("\n"); + } + Reset(); +} + +DummyDataGenerator::~DummyDataGenerator() +{ + +} + +void DummyDataGenerator::Reset() +{ + qsrand(100); +} + +QString DummyDataGenerator::randomPhoneNumber(QString indexNumber) +{ + int index = qrand()%m_countryCodes.count(); + QString countryCode = m_countryCodes.at(index); + QString areaCode = QString::number(index) + QString("0").repeated(2-QString::number(index).length()); + QString beginNumber = QString::number(555-index*2); + QString endNumber = QString("0").repeated(4-indexNumber.length()) + indexNumber; + + return countryCode +" " + areaCode +" " + beginNumber +" " + endNumber; +} + +QString DummyDataGenerator::randomFirstName() +{ + m_isMale = !m_isMale; + if (m_isMale) + return m_firstNamesM.at(qrand()%m_firstNamesM.count()); + return m_firstNamesF.at(qrand()%m_firstNamesF.count()); +} + +QString DummyDataGenerator::randomLastName() +{ + return m_lastNames.at(qrand()%m_lastNames.count()); +} + +QString DummyDataGenerator::randomName() +{ + return QString(randomFirstName()+QString(", ")+randomLastName()); +} + +QString DummyDataGenerator::randomIconItem() +{ + QString avatar = Theme::p()->pixmapPath() + "contact_default_icon.svg"; + if (qrand()%4) { + int randVal = 1+qrand()%25; + + if(m_isMale && randVal > 15) { + randVal -= 15; + } + if(!m_isMale && randVal <= 10) { + randVal += 10; + } + + avatar = QString(":/avatars/avatar_%1.png").arg(randVal, 3, 10, QChar('0')); + } + return avatar; +} + +QString DummyDataGenerator::randomStatusItem() +{ + switch ( qrand()%3 ) + { + case 0: return Theme::p()->pixmapPath() + "contact_status_online.svg"; + case 1: return Theme::p()->pixmapPath() + "contact_status_offline.svg"; + case 2: return Theme::p()->pixmapPath() + "contact_status_idle.svg"; + } + return 0; +} diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h new file mode 100644 index 0000000000..413dae6bdc --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef __DUMMYDATAGEN_H__ +#define __DUMMYDATAGEN_H__ + +#include +#include + +class DummyDataGenerator : public QObject +{ + Q_OBJECT +public: + DummyDataGenerator(); + ~DummyDataGenerator(); + +public: + void Reset(); + QString randomPhoneNumber(QString indexNumber); + QString randomFirstName(); + QString randomLastName(); + QString randomName(); + QString randomIconItem(); + QString randomStatusItem(); + +private: + QStringList m_countryCodes; + QStringList m_firstNamesF; + QStringList m_firstNamesM; + QStringList m_lastNames; + bool m_isMale; +}; + +#endif // __DUMMYDATAGEN_H__ diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp new file mode 100644 index 0000000000..1bca071d5a --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "gvbwidget.h" + +GvbWidget::GvbWidget(QGraphicsItem * parent, Qt::WindowFlags wFlags) + : QGraphicsWidget(parent, wFlags) +{ + +} + +GvbWidget::~GvbWidget() +{ +} + +void GvbWidget::keyPressEvent(QKeyEvent *event) +{ + Q_UNUSED(event) +} + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h new file mode 100644 index 0000000000..a1b544eb2e --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/gvbwidget.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef GVBWIDGET_H +#define GVBWIDGET_H + +#include + +class GvbWidget : public QGraphicsWidget +{ + Q_OBJECT + +public: + + GvbWidget(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0); + ~GvbWidget(); + virtual void keyPressEvent(QKeyEvent *event); +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp new file mode 100644 index 0000000000..718c1b8a48 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.cpp @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#if (QT_VERSION >= 0x040600) +#include +#endif + +#include "iconitem.h" + +IconItem::IconItem(const QString &filename, QGraphicsItem *parent) + : GvbWidget(parent) + , m_filename(filename) + , m_rotation(0.0) +#if (QT_VERSION >= 0x040600) + , m_opacityEffect(0) +#endif + , m_smoothTransformation(false) +{ + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + setContentsMargins(0,0,0,0); + setPreferredSize(58,58); +} + +IconItem::~IconItem() +{ +} + +void IconItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + reload(); + + const QPointF c = boundingRect().center(); + painter->translate(c.x(), c.y()); + painter->rotate(m_rotation); + painter->translate(-c.x(), -c.y()); + + if (m_smoothTransformation) + painter->setRenderHints(QPainter::SmoothPixmapTransform); + + painter->drawPixmap(0,0, m_pixmap); +} + +QSizeF IconItem::sizeHint(Qt::SizeHint which, + const QSizeF &constraint) const +{ + switch (which) + { + case Qt::MinimumSize: + case Qt::PreferredSize: + case Qt::MaximumSize: + return m_pixmap.size(); + + default: + return GvbWidget::sizeHint(which, constraint); + } +} + +void IconItem::reload() +{ + const QSize iconSize = size().toSize(); + if (iconSize.width() == 0 || iconSize.height() == 0) + return; + + const QString key = m_filename+QString::number(iconSize.width())+QString::number(iconSize.height()); + if (QPixmapCache::find(key, m_pixmap)) + return; + + if (m_filename.endsWith(".svg", Qt::CaseInsensitive)) + { + m_pixmap = QPixmap(iconSize); + m_pixmap.fill(Qt::transparent); + QSvgRenderer doc(m_filename); + QPainter painter(&m_pixmap); + painter.setViewport(0, 0, iconSize.width(), iconSize.height()); + doc.render(&painter); + } + else + { + m_pixmap = QPixmap(m_filename).scaled(iconSize); + } + + QPixmapCache::insert(key, m_pixmap); + updateGeometry(); +} + +QString IconItem::fileName() const +{ + return m_filename; +} + +void IconItem::setFileName(const QString &filename) +{ + if( m_filename != filename) { + m_filename = filename; + reload(); + } +} + +#if (QT_VERSION >= 0x040600) +void IconItem::setOpacityEffectEnabled(const bool enable) +{ + if (!m_opacityEffect) + { + QRadialGradient gradient(0.5, 0.5, 1.0); + gradient.setCoordinateMode(QGradient::ObjectBoundingMode); + gradient.setColorAt(0.0, QColor(0,0,0, 255)); + gradient.setColorAt(0.46, QColor(0,0,0, 255)); + gradient.setColorAt(0.62, QColor(0,0,0, 0)); + + m_opacityEffect = new QGraphicsOpacityEffect; + m_opacityEffect->setOpacityMask(gradient); + m_opacityEffect->setOpacity(1.0); + this->setGraphicsEffect(m_opacityEffect); + } + m_opacityEffect->setEnabled(enable); +} + +bool IconItem::isOpacityEffectEnabled() const +{ + if (m_opacityEffect) + return m_opacityEffect->isEnabled(); + + return false; +} +#endif diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h new file mode 100644 index 0000000000..ea9e9a5cc1 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/iconitem.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ICONITEM_H +#define ICONITEM_H + +#include + +#include "gvbwidget.h" + +#if (QT_VERSION >= 0x040600) +class QGraphicsOpacityEffect; +#endif +class QPainter; + +class IconItem : public GvbWidget +{ + Q_OBJECT + +public: + + IconItem(const QString &filename = "", QGraphicsItem *parent = 0); + + virtual ~IconItem(); + + QString fileName() const; + void setFileName(const QString &filename); + +#if (QT_VERSION >= 0x040600) + void setOpacityEffectEnabled(const bool enable); + bool isOpacityEffectEnabled() const; +#endif + void setRotation(const qreal rotation) { m_rotation = rotation; } + qreal rotation() const { return m_rotation; } + + void setSmoothTransformationEnabled(const bool enable) { m_smoothTransformation = enable; } + bool isSmoothTransformationEnabled() const { return m_smoothTransformation; } + +private: + + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget */*widget = 0*/); + QSizeF sizeHint(Qt::SizeHint which, + const QSizeF &constraint = QSizeF()) const; + +private: + Q_DISABLE_COPY(IconItem) + void reload(); + + QString m_filename; + QPixmap m_pixmap; + qreal m_rotation; +#if (QT_VERSION >= 0x040600) + QGraphicsOpacityEffect *m_opacityEffect; +#endif + bool m_smoothTransformation; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp new file mode 100644 index 0000000000..06c7b14b19 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.cpp @@ -0,0 +1,275 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "itemrecyclinglist.h" +#include "listitemcontainer.h" +#include "abstractviewitem.h" +#include "recycledlistitem.h" +#include "theme.h" +#include "scrollbar.h" + +ItemRecyclingList::ItemRecyclingList(const int itemBuffer, QGraphicsWidget * parent) + : ItemRecyclingListView(parent), + m_listModel(new ListModel(this)) +{ + ListItemContainer *container = new ListItemContainer(itemBuffer, this, this); + container->setParentItem(this); + ItemRecyclingListView::setContainer(container); + ItemRecyclingListView::setModel(m_listModel, new RecycledListItem(this)); + setObjectName("ItemRecyclingList"); + connect(Theme::p(), SIGNAL(themeChanged()), this, SLOT(themeChange())); + + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +} + +/* virtual */ +ItemRecyclingList::~ItemRecyclingList() +{ +} + +/* virtual */ +void ItemRecyclingList::insertItem(int index, RecycledListItem *item) +{ + if (index<0) + index = 0; + if (index > m_listModel->rowCount()) + index = m_listModel->rowCount(); + if (m_listModel && item) + m_listModel->insert(index,item); + + updateListItemBackgrounds(index); +} + +/* virtual */ +void ItemRecyclingList::addItem(RecycledListItem *item) +{ + if (item) + m_listModel->appendRow(item); + + const int index = m_listModel->rowCount()-1; + updateListItemBackgrounds(index); +} + +/* virtual */ +void ItemRecyclingList::clear() +{ + m_listModel->clear(); +} + +/* virtual */ +AbstractViewItem *ItemRecyclingList::takeItem(const int row) +{ + if (row < 0 || row >= m_listModel->rowCount() || !m_listModel) + return 0; + return m_listModel->takeItem(row); +} + +/*virtual*/ +void ItemRecyclingList::setItemPrototype(AbstractViewItem* prototype) +{ + ItemRecyclingListView::setItemPrototype(prototype); +} + +void ItemRecyclingList::themeChange() +{ + const bool caching = listItemCaching(); + setListItemCaching(false); + + const QString iconName = Theme::p()->pixmapPath()+"contact_default_icon.svg"; + const int count = m_listModel->rowCount(); + + for (int i=0; iitem(i); + if (ritem) { + ListItem *item = ritem->item(); + + // Update default icons + const QString filename = item->icon(ListItem::LeftIcon)->fileName(); + if (filename.contains("contact_default_icon")) { + item->icon(ListItem::LeftIcon)->setFileName(iconName); + } + + // Update status icons + QString statusIcon = item->icon(ListItem::RightIcon)->fileName(); + const int index = statusIcon.indexOf("contact_status"); + if (index != -1) { + statusIcon.remove(0, index); + item->icon(ListItem::RightIcon)->setFileName(Theme::p()->pixmapPath()+statusIcon); + } + + // Update fonts + item->setFont(Theme::p()->font(Theme::ContactName), ListItem::FirstPos); + item->setFont(Theme::p()->font(Theme::ContactNumber), ListItem::SecondPos); + item->setFont(Theme::p()->font(Theme::ContactEmail), ListItem::ThirdPos); + + // Update list dividers + if (i%2) { + item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushOdd()); + item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityOdd()); + } + else { + item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushEven()); + item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityEven()); + } + + // Update borders + item->setBorderPen(Theme::p()->listItemBorderPen()); + item->setRounding(Theme::p()->listItemRounding()); + + // Update icons + item->icon(ListItem::LeftIcon)->setRotation(Theme::p()->iconRotation(ListItem::LeftIcon)); + item->icon(ListItem::RightIcon)->setRotation(Theme::p()->iconRotation(ListItem::RightIcon)); +#if (QT_VERSION >= 0x040600) + item->icon(ListItem::LeftIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::LeftIcon)); + item->icon(ListItem::RightIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::RightIcon)); +#endif + item->icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::LeftIcon)); + item->icon(ListItem::RightIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::RightIcon)); + } + } + updateViewContent(); + setListItemCaching(caching); +} + +void ItemRecyclingList::keyPressEvent(QKeyEvent *event) +{ + static QTime keyPressInterval = QTime::currentTime(); + static qreal step = 0.0; + static bool repeat = false; + int interval = keyPressInterval.elapsed(); + + ScrollBar* sb = verticalScrollBar(); + qreal currentValue = sb->sliderPosition(); + + if(interval < 250 ) { + if(!repeat) step = 0.0; + step = step + 2.0; + if(step > 100) step = 100; + repeat = true; + } + else { + step = 1.0; + if(m_listModel->item(0)) m_listModel->item(0)->size().height(); + step = m_listModel->item(0)->size().height(); + repeat = false; + } + + if(event->key() == Qt::Key_Up ) { //Up Arrow + sb->setSliderPosition(currentValue - step); + } + + if(event->key() == Qt::Key_Down ) { //Down Arrow + sb->setSliderPosition(currentValue + step); + } + keyPressInterval.start(); +} + +bool ItemRecyclingList::listItemCaching() const +{ +#if (QT_VERSION >= 0x040600) + ListItemContainer *container = + static_cast(m_container); + + return container->listItemCaching(); +#else + return false; +#endif +} + +void ItemRecyclingList::setListItemCaching(bool enabled) +{ +#if (QT_VERSION >= 0x040600) + ListItemContainer *container = + static_cast(m_container); + container->setListItemCaching(enabled); +#else + Q_UNUSED(enabled) +#endif +} + +void ItemRecyclingList::updateListItemBackgrounds(int index) +{ + const int itemCount = m_listModel->rowCount(); + + for (int i=index; iitem(i); + if (ritem) { + ListItem *item = ritem->item(); + if (i%2) { + item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushOdd()); + item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityOdd()); + } + else { + item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushEven()); + item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityEven()); + } + } + } +} + +void ItemRecyclingList::setTwoColumns(const bool enabled) +{ + if (twoColumns() == enabled) + return; + +#if (QT_VERSION >= 0x040600) + const bool caching = listItemCaching(); + setListItemCaching(false); +#endif + + m_container->setTwoColumns(enabled); + refreshContainerGeometry(); + +#if (QT_VERSION >= 0x040600) + setListItemCaching(caching); +#endif +} + +bool ItemRecyclingList::twoColumns() +{ + return m_container->twoColumns(); +} + diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h new file mode 100644 index 0000000000..715edf4c4c --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ITEMRECYCLINGLIST_H +#define ITEMRECYCLINGLIST_H + +#include "listitem.h" +#include "abstractitemview.h" +#include "listmodel.h" +#include "itemrecyclinglistview.h" +#include "recycledlistitem.h" + +class QGraphicsWidget; + +class ItemRecyclingList : public ItemRecyclingListView +{ + Q_OBJECT + +public: + ItemRecyclingList(const int itemBuffer = 4, QGraphicsWidget * parent = 0); + virtual ~ItemRecyclingList(); + + virtual void insertItem(int index, RecycledListItem *item); + virtual void addItem(RecycledListItem *item); + virtual void clear(); + virtual AbstractViewItem *takeItem(const int row); + virtual void setItemPrototype(AbstractViewItem* prototype); + virtual void keyPressEvent(QKeyEvent *event); + virtual bool listItemCaching() const; + virtual void setListItemCaching(bool enabled); + + void setTwoColumns(const bool enabled); + bool twoColumns(); + +public slots: + void themeChange(); + +private: + void updateListItemBackgrounds(int index); + +private: + Q_DISABLE_COPY(ItemRecyclingList) + + ListModel *m_listModel; +}; + +#endif // ITEMRECYCLINGLIST_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.pri b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.pri new file mode 100644 index 0000000000..55b551ef8f --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglist.pri @@ -0,0 +1,19 @@ +HEADERS += $$ROOTDIR/tests/itemrecyclinglist/itemrecyclinglist.h \ + $$ROOTDIR/tests/itemrecyclinglist/itemrecyclinglistview.h \ + $$ROOTDIR/tests/itemrecyclinglist/abstractitemview.h \ + $$ROOTDIR/tests/itemrecyclinglist/abstractviewitem.h \ + $$ROOTDIR/tests/itemrecyclinglist/recycledlistitem.h \ + $$ROOTDIR/tests/itemrecyclinglist/listitemcontainer.h \ + $$ROOTDIR/tests/itemrecyclinglist/abstractitemcontainer.h \ + $$ROOTDIR/tests/itemrecyclinglist/listmodel.h + +SOURCES += $$ROOTDIR/tests/itemrecyclinglist/itemrecyclinglist.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/itemrecyclinglistview.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/abstractitemview.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/abstractviewitem.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/recycledlistitem.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/listitemcontainer.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/abstractitemcontainer.cpp \ + $$ROOTDIR/tests/itemrecyclinglist/listmodel.cpp + +INCLUDEPATH += $$ROOTDIR/tests/itemrecyclinglist diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp new file mode 100644 index 0000000000..1b6f0a2224 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "itemrecyclinglistview.h" + +ItemRecyclingListView::ItemRecyclingListView(QGraphicsWidget * parent) + : AbstractItemView(parent), m_rootIndex() +{ +} + +/*virtual*/ +ItemRecyclingListView::~ItemRecyclingListView() +{ +} +void ItemRecyclingListView::setCurrentRow(const int row) +{ + setCurrentIndex(model()->index(row,0)); +} + +int ItemRecyclingListView::rows() const +{ + if (m_model) + return m_model->rowCount(); + return 0; +} + +/*virtual*/ +void ItemRecyclingListView::rowsInserted(const QModelIndex &parent, int start, int end) +{ + if (parent == m_rootIndex) { + AbstractItemView::rowsInserted(parent, start, end); + } +} + +/*virtual*/ +void ItemRecyclingListView::rowsRemoved(const QModelIndex &parent, int start, int end) +{ + if (parent == m_rootIndex) { + AbstractItemView::rowsRemoved(parent, start, end); + } +} diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h new file mode 100644 index 0000000000..9798fe5cf1 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/itemrecyclinglistview.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ITEMRECYCLINGLISTVIEW_H +#define ITEMRECYCLINGLISTVIEW_H + +#include "abstractitemview.h" + +class ItemRecyclingListView : public AbstractItemView +{ +public: + ItemRecyclingListView(QGraphicsWidget * parent = 0); + virtual ~ItemRecyclingListView(); + void setCurrentRow(const int row); + int rows() const; +#if (QT_VERSION >= 0x040600) + virtual bool listItemCaching() const = 0; + virtual void setListItemCaching(bool enabled) = 0; +#endif + +protected: + void rowsInserted(const QModelIndex &parent, int start, int end); + void rowsRemoved(const QModelIndex &parent,int start,int end); + +private: + QModelIndex m_rootIndex; +}; + +#endif // ITEMRECYCLINGLISTVIEW_H diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp new file mode 100644 index 0000000000..ad73ca98f7 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "label.h" + +Label::Label(const QString& text, QGraphicsItem *parent) + : GvbWidget(parent) +{ + m_textItem = new QGraphicsSimpleTextItem(this); + setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); + setContentsMargins(0, 0, 0, 0); + setText(text); +#if QT_VERSION >= 0x040600 + // This flag was introduced in Qt 4.6. + setFlag(QGraphicsItem::ItemHasNoContents, true); +#endif +} + +Label::~Label() +{ +} + +void Label::setText(const QString& text) +{ + m_textItem->setText(text); + prepareGeometryChange(); +} + +QString Label::text() const +{ + return m_textItem->text(); +} + +void Label::setFont(const QFont font) +{ + m_textItem->setFont(font); +} + +void Label::resizeEvent(QGraphicsSceneResizeEvent *event) +{ + GvbWidget::resizeEvent(event); +} + +QSizeF Label::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ + switch (which) + { + case Qt::MinimumSize: + // fall thru + case Qt::PreferredSize: + { + QFontMetricsF fm(m_textItem->font()); + return QSizeF(fm.width(m_textItem->text()), fm.height()); + } + default: + return GvbWidget::sizeHint(which, constraint); + } +} diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h new file mode 100644 index 0000000000..3e877d6f23 --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TEXTITEM_H +#define TEXTITEM_H + +#include "gvbwidget.h" + +class QPainter; +class QStyleOptionGraphicsItem; +class QGraphicsTextItem; + +class Label : public GvbWidget +{ + Q_OBJECT + +public: + + Label(const QString& text, QGraphicsItem *parent = 0); + ~Label(); + +public: + + void setText(const QString& text); + QString text() const; + void setFont(const QFont font); + +private: + void resizeEvent(QGraphicsSceneResizeEvent *event); + QSizeF sizeHint(Qt::SizeHint which, + const QSizeF &constraint = QSizeF()) const; + +private: + Q_DISABLE_COPY(Label) + QGraphicsSimpleTextItem *m_textItem; +}; + +#endif diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp new file mode 100644 index 0000000000..e9ce6fb15d --- /dev/null +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/listitem.cpp @@ -0,0 +1,314 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include "listitem.h" +#include "theme.h" + +struct ItemData +{ + QHash texts; + QHash fonts; + QHash icons; + QHash iconRotations; + QHash iconSmoothTransformations; + QHash iconOpacityEffets; + QPen borderPen; + QBrush backgroundBrush; + qreal backgroundOpacity; + QSize rounding; +}; +Q_DECLARE_METATYPE(ItemData); + +ListItem::ListItem(QGraphicsWidget *parent) + : GvbWidget(parent), + m_txtlayout(new QGraphicsGridLayout()), + m_layout(new QGraphicsLinearLayout(Qt::Horizontal)), + m_liconlayout(new QGraphicsLinearLayout(Qt::Horizontal)), + m_riconlayout(new QGraphicsLinearLayout(Qt::Horizontal)) + ,m_fonts() + ,m_borderPen(Qt::NoPen) + ,m_backgroundBrush(QBrush()) + ,m_backgroundOpacity(1.0) + ,m_rounding(0.0, 0.0) +{ + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + setContentsMargins(0,4,4,0); + m_layout->setContentsMargins(0,0,0,0); + + m_txtlayout->setContentsMargins(0,8,0,8); + m_liconlayout->setContentsMargins(8,8,8,8); + m_riconlayout->setContentsMargins(0,8,4,8); + + m_layout->insertItem(0, m_liconlayout); + m_layout->insertItem(1, m_txtlayout); + m_layout->insertItem(2, m_riconlayout); + + m_layout->setStretchFactor(m_liconlayout, 1); + m_layout->setStretchFactor(m_txtlayout, 5); + m_layout->setStretchFactor(m_riconlayout, 1); + + setFlag(QGraphicsItem::ItemClipsToShape); + setLayout(m_layout); +} + +ListItem::~ListItem() +{ + if ( !m_liconlayout->parentLayoutItem() ) + delete m_liconlayout; + + if ( !m_riconlayout->parentLayoutItem() ) + delete m_riconlayout; +} + +void ListItem::setIcon( IconItem *iconItem, const IconItemPos iconPos ) +{ + if (iconPos == LeftIcon) { + if (m_liconlayout->count() > 0 && m_liconlayout->itemAt(0)) { + delete m_liconlayout->itemAt(0); + m_liconlayout->addItem( iconItem ); + } + else { + m_liconlayout->addItem( iconItem ); + } + m_liconlayout->itemAt(0)->setMaximumSize(58,58); + } + else if (iconPos == RightIcon) { + if (m_riconlayout->count() > 0 && m_riconlayout->itemAt(0)) { + delete m_riconlayout->itemAt(0); + m_riconlayout->addItem( iconItem ); + } + else { + m_riconlayout->addItem( iconItem ); + } + m_riconlayout->itemAt(0)->setMaximumSize(22,22); + } + m_layout->invalidate(); +} + +IconItem* ListItem::icon( const IconItemPos iconPos ) const +{ + QGraphicsLayoutItem* item = 0; + + if (iconPos == LeftIcon && m_liconlayout->count() > 0) { + item = m_liconlayout->itemAt(0); + } + else if (iconPos == RightIcon && m_riconlayout->count() > 0) { + item = m_riconlayout->itemAt(0); + } + + if (item) { + IconItem* titem = static_cast(item); + return titem; + } + return 0; +} + +QVariant ListItem::data(int role) const +{ + if (role != Qt::DisplayRole) + return QVariant(); + + ItemData data; + + if (text(ListItem::FirstPos).size() > 0) { + data.texts[ListItem::FirstPos] = text(ListItem::FirstPos); + data.fonts[ListItem::FirstPos] = m_fonts[ListItem::FirstPos]; + } + if (text(ListItem::SecondPos).size() > 0) { + data.texts[ListItem::SecondPos] = text(ListItem::SecondPos); + data.fonts[ListItem::SecondPos] = m_fonts[ListItem::SecondPos]; + } + if (text(ListItem::ThirdPos).size() > 0) { + data.texts[ListItem::ThirdPos] = text(ListItem::ThirdPos); + data.fonts[ListItem::ThirdPos] = m_fonts[ListItem::ThirdPos]; + } + if (text(ListItem::LastPos).size() > 0) { + data.texts[ListItem::LastPos] = text(ListItem::LastPos); + data.fonts[ListItem::LastPos] = m_fonts[ListItem::LastPos]; + } + + if (icon(ListItem::LeftIcon)) { + data.icons[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->fileName(); + data.iconRotations[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->rotation(); + data.iconSmoothTransformations[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->isSmoothTransformationEnabled(); +#if (QT_VERSION >= 0x040600) + data.iconOpacityEffets[ListItem::LeftIcon] = icon(ListItem::LeftIcon)->isOpacityEffectEnabled(); +#endif + } + + if (icon(ListItem::RightIcon)) { + data.icons[ListItem::RightIcon] = icon(ListItem::RightIcon)->fileName(); + data.iconRotations[ListItem::RightIcon] = icon(ListItem::RightIcon)->rotation(); + data.iconSmoothTransformations[ListItem::RightIcon] = icon(ListItem::RightIcon)->isSmoothTransformationEnabled(); +#if (QT_VERSION >= 0x040600) + data.iconOpacityEffets[ListItem::RightIcon] = icon(ListItem::RightIcon)->isOpacityEffectEnabled(); +#endif + } + + data.borderPen = m_borderPen; + data.backgroundBrush = m_backgroundBrush; + data.backgroundOpacity = m_backgroundOpacity; + data.rounding = m_rounding; + + QVariant var; + var.setValue(data); + return var; +} + +void ListItem::setData(const QVariant &value, int role) +{ + if (role != Qt::DisplayRole) + return; + + ItemData data = value.value(); + QList textkeys = data.texts.keys(); + + for( int i = 0; i iconkeys = data.icons.keys(); + for( int i = 0; isetFileName(data.icons[iconkeys.at(i)]); + else { + IconItem *iconItem = new IconItem(data.icons[iconkeys.at(i)], this); + setIcon(iconItem, iconkeys.at(i)); + } + } + + if (icon(ListItem::LeftIcon)) { + icon(ListItem::LeftIcon)->setRotation(data.iconRotations[ListItem::LeftIcon]); + icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(data.iconSmoothTransformations[ListItem::LeftIcon]); +#if (QT_VERSION >= 0x040600) + icon(ListItem::LeftIcon)->setOpacityEffectEnabled(data.iconOpacityEffets[ListItem::LeftIcon]); +#endif + } + + if (icon(ListItem::RightIcon)) { + icon(ListItem::RightIcon)->setRotation(data.iconRotations[ListItem::RightIcon]); + icon(ListItem::RightIcon)->setSmoothTransformationEnabled(data.iconSmoothTransformations[ListItem::RightIcon]); +#if (QT_VERSION >= 0x040600) + icon(ListItem::RightIcon)->setOpacityEffectEnabled(data.iconOpacityEffets[ListItem::RightIcon]); +#endif + } + + m_borderPen = data.borderPen; + m_backgroundBrush = data.backgroundBrush; + m_backgroundOpacity = data.backgroundOpacity; + m_rounding = data.rounding; +} + +void ListItem::setText(const QString str, const TextPos position) +{ + QGraphicsLayoutItem * item = 0; + + if (m_txtlayout->rowCount() > position && position >= 0) + item = m_txtlayout->itemAt(position, 0); + + if (!item) { + Label *label = new Label(str,this); + m_txtlayout->addItem(label, position, 0); + if (m_fonts.contains(position)) + label->setFont(m_fonts[position]); + } + else { + Label *titem = static_cast