summaryrefslogtreecommitdiffstats
ModeNameSize
-rw-r--r--.bzrignore673logstatsplain
-rw-r--r--.hgignore866logstatsplain
-rw-r--r--.hgtags3691logstatsplain
d---------Demo735logstatsplain
d---------Doc928logstatsplain
d---------Grammar35logstatsplain
d---------Include3362logstatsplain
-rw-r--r--LICENSE13741logstatsplain
d---------Lib9251logstatsplain
d---------Mac472logstatsplain
-rw-r--r--Makefile.pre.in38598logstatsplain
d---------Misc1234logstatsplain
d---------Modules5116logstatsplain
d---------Objects1660logstatsplain
d---------PC1376logstatsplain
d---------PCbuild2140logstatsplain
d---------Parser911logstatsplain
d---------Python2785logstatsplain
-rw-r--r--README56985logstatsplain
d---------RISCOS322logstatsplain
d---------Tools638logstatsplain
-rwxr-xr-xconfigure676056logstatsplain
-rw-r--r--configure.in105786logstatsplain
-rwxr-xr-xinstall-sh7122logstatsplain
-rw-r--r--pyconfig.h.in29240logstatsplain
-rw-r--r--setup.py81533logstatsplain
'>50
-rw-r--r--examples/activeqt/hierarchy/objects.cpp108
-rw-r--r--examples/activeqt/hierarchy/objects.h100
-rw-r--r--examples/activeqt/menus/fileopen.xpm22
-rw-r--r--examples/activeqt/menus/filesave.xpm22
-rw-r--r--examples/activeqt/menus/main.cpp64
-rw-r--r--examples/activeqt/menus/menus.cpp178
-rw-r--r--examples/activeqt/menus/menus.h76
-rw-r--r--examples/activeqt/menus/menus.inf9
-rw-r--r--examples/activeqt/menus/menus.pro14
-rw-r--r--examples/activeqt/multiple/ax1.h87
-rw-r--r--examples/activeqt/multiple/ax2.h94
-rw-r--r--examples/activeqt/multiple/main.cpp53
-rw-r--r--examples/activeqt/multiple/multiple.inf9
-rw-r--r--examples/activeqt/multiple/multiple.pro16
-rw-r--r--examples/activeqt/multiple/multipleax.rc32
-rw-r--r--examples/activeqt/opengl/glbox.cpp250
-rw-r--r--examples/activeqt/opengl/glbox.h90
-rw-r--r--examples/activeqt/opengl/globjwin.cpp111
-rw-r--r--examples/activeqt/opengl/globjwin.h62
-rw-r--r--examples/activeqt/opengl/main.cpp91
-rw-r--r--examples/activeqt/opengl/opengl.inf9
-rw-r--r--examples/activeqt/opengl/opengl.pro19
-rw-r--r--examples/activeqt/qutlook/addressview.cpp289
-rw-r--r--examples/activeqt/qutlook/addressview.h79
-rw-r--r--examples/activeqt/qutlook/fileopen.xpm22
-rw-r--r--examples/activeqt/qutlook/fileprint.xpm24
-rw-r--r--examples/activeqt/qutlook/filesave.xpm22
-rw-r--r--examples/activeqt/qutlook/main.cpp56
-rw-r--r--examples/activeqt/qutlook/qutlook.pro23
-rw-r--r--examples/activeqt/simple/main.cpp137
-rw-r--r--examples/activeqt/simple/simple.inf11
-rw-r--r--examples/activeqt/simple/simple.pro13
-rw-r--r--examples/activeqt/webbrowser/main.cpp189
-rw-r--r--examples/activeqt/webbrowser/mainwindow.ui306
-rw-r--r--examples/activeqt/webbrowser/webaxwidget.h67
-rw-r--r--examples/activeqt/webbrowser/webbrowser.pro17
-rw-r--r--examples/activeqt/webbrowser/wincemainwindow.ui299
-rw-r--r--examples/activeqt/wrapper/main.cpp161
-rw-r--r--examples/activeqt/wrapper/wrapper.inf9
-rw-r--r--examples/activeqt/wrapper/wrapper.pro15
-rw-r--r--examples/activeqt/wrapper/wrapperax.rc32
-rw-r--r--examples/assistant/README38
-rw-r--r--examples/assistant/assistant.pro8
-rw-r--r--examples/assistant/simpletextviewer/documentation/about.txt9
-rw-r--r--examples/assistant/simpletextviewer/documentation/browse.html34
-rw-r--r--examples/assistant/simpletextviewer/documentation/filedialog.html48
-rw-r--r--examples/assistant/simpletextviewer/documentation/findfile.html32
-rw-r--r--examples/assistant/simpletextviewer/documentation/images/browse.pngbin0 -> 21553 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.pngbin0 -> 9589 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/images/filedialog.pngbin0 -> 12318 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/images/handbook.pngbin0 -> 1060 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/images/mainwindow.pngbin0 -> 12769 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/images/open.pngbin0 -> 11697 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/images/wildcard.pngbin0 -> 11266 bytes-rw-r--r--examples/assistant/simpletextviewer/documentation/index.html41
-rw-r--r--examples/assistant/simpletextviewer/documentation/intro.html28
-rw-r--r--examples/assistant/simpletextviewer/documentation/openfile.html36
-rw-r--r--examples/assistant/simpletextviewer/documentation/simpletextviewer.adp40
-rw-r--r--examples/assistant/simpletextviewer/documentation/wildcardmatching.html57
-rw-r--r--examples/assistant/simpletextviewer/findfiledialog.cpp221
-rw-r--r--examples/assistant/simpletextviewer/findfiledialog.h99
-rw-r--r--examples/assistant/simpletextviewer/main.cpp52
-rw-r--r--examples/assistant/simpletextviewer/mainwindow.cpp154
-rw-r--r--examples/assistant/simpletextviewer/mainwindow.h91
-rw-r--r--examples/assistant/simpletextviewer/simpletextviewer.pro16
-rw-r--r--examples/dbus/complexpingpong/complexping.cpp118
-rw-r--r--examples/dbus/complexpingpong/complexping.h59
-rw-r--r--examples/dbus/complexpingpong/complexping.pro16
-rw-r--r--examples/dbus/complexpingpong/complexpingpong.pro4
-rw-r--r--examples/dbus/complexpingpong/complexpong.cpp105
-rw-r--r--examples/dbus/complexpingpong/complexpong.h68
-rw-r--r--examples/dbus/complexpingpong/complexpong.pro16
-rw-r--r--examples/dbus/complexpingpong/ping-common.h42
-rw-r--r--examples/dbus/dbus-chat/chat.cpp164
-rw-r--r--examples/dbus/dbus-chat/chat.h82
-rw-r--r--examples/dbus/dbus-chat/chat_adaptor.cpp35
-rw-r--r--examples/dbus/dbus-chat/chat_adaptor.h57
-rw-r--r--examples/dbus/dbus-chat/chat_interface.cpp25
-rw-r--r--examples/dbus/dbus-chat/chat_interface.h49
-rw-r--r--examples/dbus/dbus-chat/chatmainwindow.ui185
-rw-r--r--examples/dbus/dbus-chat/chatsetnickname.ui149
-rw-r--r--examples/dbus/dbus-chat/com.trolltech.chat.xml15
-rw-r--r--examples/dbus/dbus-chat/dbus-chat.pro19
-rw-r--r--examples/dbus/dbus.pro12
-rw-r--r--examples/dbus/listnames/listnames.cpp92
-rw-r--r--examples/dbus/listnames/listnames.pro17
-rw-r--r--examples/dbus/pingpong/ping-common.h42
-rw-r--r--examples/dbus/pingpong/ping.cpp75
-rw-r--r--examples/dbus/pingpong/ping.pro16
-rw-r--r--examples/dbus/pingpong/pingpong.pro4
-rw-r--r--examples/dbus/pingpong/pong.cpp80
-rw-r--r--examples/dbus/pingpong/pong.h54
-rw-r--r--examples/dbus/pingpong/pong.pro16
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.cpp138
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.h76
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.pro20
-rw-r--r--examples/dbus/remotecontrolledcar/car/car.xml11
-rw-r--r--examples/dbus/remotecontrolledcar/car/car_adaptor.cpp59
-rw-r--r--examples/dbus/remotecontrolledcar/car/car_adaptor_p.h57
-rw-r--r--examples/dbus/remotecontrolledcar/car/main.cpp73
-rw-r--r--examples/dbus/remotecontrolledcar/controller/car.xml11
-rw-r--r--examples/dbus/remotecontrolledcar/controller/car_interface.cpp26
-rw-r--r--examples/dbus/remotecontrolledcar/controller/car_interface_p.h74
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.cpp83
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.h71
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.pro21
-rw-r--r--examples/dbus/remotecontrolledcar/controller/controller.ui64
-rw-r--r--examples/dbus/remotecontrolledcar/controller/main.cpp53
-rw-r--r--examples/dbus/remotecontrolledcar/remotecontrolledcar.pro8
-rw-r--r--examples/designer/README37
-rw-r--r--examples/designer/calculatorbuilder/calculatorbuilder.pro14
-rw-r--r--examples/designer/calculatorbuilder/calculatorbuilder.qrc5
-rw-r--r--examples/designer/calculatorbuilder/calculatorform.cpp92
-rw-r--r--examples/designer/calculatorbuilder/calculatorform.h71
-rw-r--r--examples/designer/calculatorbuilder/calculatorform.ui303
-rw-r--r--examples/designer/calculatorbuilder/main.cpp54
-rw-r--r--examples/designer/calculatorform/calculatorform.cpp66
-rw-r--r--examples/designer/calculatorform/calculatorform.h66
-rw-r--r--examples/designer/calculatorform/calculatorform.pro13
-rw-r--r--examples/designer/calculatorform/calculatorform.ui284
-rw-r--r--examples/designer/calculatorform/main.cpp53
-rw-r--r--examples/designer/containerextension/containerextension.pro26
-rw-r--r--examples/designer/containerextension/multipagewidget.cpp131
-rw-r--r--examples/designer/containerextension/multipagewidget.h88
-rw-r--r--examples/designer/containerextension/multipagewidgetcontainerextension.cpp101
-rw-r--r--examples/designer/containerextension/multipagewidgetcontainerextension.h75
-rw-r--r--examples/designer/containerextension/multipagewidgetextensionfactory.cpp65
-rw-r--r--examples/designer/containerextension/multipagewidgetextensionfactory.h64
-rw-r--r--examples/designer/containerextension/multipagewidgetplugin.cpp197
-rw-r--r--examples/designer/containerextension/multipagewidgetplugin.h81
-rw-r--r--examples/designer/customwidgetplugin/analogclock.cpp111
-rw-r--r--examples/designer/customwidgetplugin/analogclock.h59
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.cpp156
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.h73
-rw-r--r--examples/designer/customwidgetplugin/customwidgetplugin.pro21
-rw-r--r--examples/designer/designer.pro19
-rw-r--r--examples/designer/taskmenuextension/taskmenuextension.pro25
-rw-r--r--examples/designer/taskmenuextension/tictactoe.cpp176
-rw-r--r--examples/designer/taskmenuextension/tictactoe.h83
-rw-r--r--examples/designer/taskmenuextension/tictactoedialog.cpp99
-rw-r--r--examples/designer/taskmenuextension/tictactoedialog.h73
-rw-r--r--examples/designer/taskmenuextension/tictactoeplugin.cpp134
-rw-r--r--examples/designer/taskmenuextension/tictactoeplugin.h78
-rw-r--r--examples/designer/taskmenuextension/tictactoetaskmenu.cpp104
-rw-r--r--examples/designer/taskmenuextension/tictactoetaskmenu.h88
-rw-r--r--examples/designer/worldtimeclockbuilder/form.ui162
-rw-r--r--examples/designer/worldtimeclockbuilder/main.cpp70
-rw-r--r--examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro11
-rw-r--r--examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc5
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclock.cpp122
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclock.h73
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp124
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.h74
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro21
-rw-r--r--examples/desktop/README41
-rw-r--r--examples/desktop/desktop.pro11
-rw-r--r--examples/desktop/screenshot/main.cpp52
-rw-r--r--examples/desktop/screenshot/screenshot.cpp198
-rw-r--r--examples/desktop/screenshot/screenshot.h100
-rw-r--r--examples/desktop/screenshot/screenshot.pro9
-rw-r--r--examples/desktop/systray/images/bad.svg64
-rw-r--r--examples/desktop/systray/images/heart.svg55
-rw-r--r--examples/desktop/systray/images/trash.svg58
-rw-r--r--examples/desktop/systray/main.cpp63
-rw-r--r--examples/desktop/systray/systray.pro22
-rw-r--r--examples/desktop/systray/systray.qrc7
-rw-r--r--examples/desktop/systray/window.cpp259
-rw-r--r--examples/desktop/systray/window.h113
-rw-r--r--examples/dialogs/README40
-rw-r--r--examples/dialogs/classwizard/classwizard.cpp431
-rw-r--r--examples/dialogs/classwizard/classwizard.h157
-rw-r--r--examples/dialogs/classwizard/classwizard.pro10
-rw-r--r--examples/dialogs/classwizard/classwizard.qrc11
-rw-r--r--examples/dialogs/classwizard/images/background.pngbin0 -> 22578 bytes-rw-r--r--examples/dialogs/classwizard/images/banner.pngbin0 -> 3947 bytes-rw-r--r--examples/dialogs/classwizard/images/logo1.pngbin0 -> 1619 bytes-rw-r--r--examples/dialogs/classwizard/images/logo2.pngbin0 -> 1619 bytes-rw-r--r--examples/dialogs/classwizard/images/logo3.pngbin0 -> 1619 bytes-rw-r--r--examples/dialogs/classwizard/images/watermark1.pngbin0 -> 14516 bytes-rw-r--r--examples/dialogs/classwizard/images/watermark2.pngbin0 -> 14912 bytes-rw-r--r--examples/dialogs/classwizard/main.cpp64
-rw-r--r--examples/dialogs/configdialog/configdialog.cpp117
-rw-r--r--examples/dialogs/configdialog/configdialog.h70
-rw-r--r--examples/dialogs/configdialog/configdialog.pro14
-rw-r--r--examples/dialogs/configdialog/configdialog.qrc7
-rw-r--r--examples/dialogs/configdialog/images/config.pngbin0 -> 6758 bytes-rw-r--r--examples/dialogs/configdialog/images/query.pngbin0 -> 2116 bytes-rw-r--r--examples/dialogs/configdialog/images/update.pngbin0 -> 7890 bytes-rw-r--r--examples/dialogs/configdialog/main.cpp53
-rw-r--r--examples/dialogs/configdialog/pages.cpp152
-rw-r--r--examples/dialogs/configdialog/pages.h65
-rw-r--r--examples/dialogs/dialogs.pro17
-rw-r--r--examples/dialogs/extension/extension.pro9
-rw-r--r--examples/dialogs/extension/finddialog.cpp113
-rw-r--r--examples/dialogs/extension/finddialog.h79
-rw-r--r--examples/dialogs/extension/main.cpp51
-rw-r--r--examples/dialogs/findfiles/findfiles.pro9
-rw-r--r--examples/dialogs/findfiles/main.cpp52
-rw-r--r--examples/dialogs/findfiles/window.cpp250
-rw-r--r--examples/dialogs/findfiles/window.h91
-rw-r--r--examples/dialogs/licensewizard/images/logo.pngbin0 -> 1810 bytes-rw-r--r--examples/dialogs/licensewizard/images/watermark.pngbin0 -> 34998 bytes-rw-r--r--examples/dialogs/licensewizard/licensewizard.cpp360
-rw-r--r--examples/dialogs/licensewizard/licensewizard.h164
-rw-r--r--examples/dialogs/licensewizard/licensewizard.pro10
-rw-r--r--examples/dialogs/licensewizard/licensewizard.qrc6
-rw-r--r--examples/dialogs/licensewizard/main.cpp64
-rw-r--r--examples/dialogs/sipdialog/dialog.cpp124
-rw-r--r--examples/dialogs/sipdialog/dialog.h64
-rw-r--r--examples/dialogs/sipdialog/main.cpp53
-rw-r--r--examples/dialogs/sipdialog/sipdialog.pro12
-rw-r--r--examples/dialogs/standarddialogs/dialog.cpp390
-rw-r--r--examples/dialogs/standarddialogs/dialog.h99
-rw-r--r--examples/dialogs/standarddialogs/main.cpp61
-rw-r--r--examples/dialogs/standarddialogs/standarddialogs.pro11
-rw-r--r--examples/dialogs/tabdialog/main.cpp58
-rw-r--r--examples/dialogs/tabdialog/tabdialog.cpp196
-rw-r--r--examples/dialogs/tabdialog/tabdialog.h100
-rw-r--r--examples/dialogs/tabdialog/tabdialog.pro10
-rw-r--r--examples/dialogs/trivialwizard/trivialwizard.cpp136
-rw-r--r--examples/dialogs/trivialwizard/trivialwizard.pro7
-rw-r--r--examples/draganddrop/README40
-rw-r--r--examples/draganddrop/delayedencoding/delayedencoding.pro14
-rw-r--r--examples/draganddrop/delayedencoding/delayedencoding.qrc6
-rw-r--r--examples/draganddrop/delayedencoding/images/drag.pngbin0 -> 977 bytes-rw-r--r--examples/draganddrop/delayedencoding/images/example.svg59
-rw-r--r--examples/draganddrop/delayedencoding/main.cpp52
-rw-r--r--examples/draganddrop/delayedencoding/mimedata.cpp66
-rw-r--r--examples/draganddrop/delayedencoding/mimedata.h64
-rw-r--r--examples/draganddrop/delayedencoding/sourcewidget.cpp115
-rw-r--r--examples/draganddrop/delayedencoding/sourcewidget.h71
-rw-r--r--examples/draganddrop/draganddrop.pro15
-rw-r--r--examples/draganddrop/draggableicons/draggableicons.pro10
-rw-r--r--examples/draganddrop/draggableicons/draggableicons.qrc7
-rw-r--r--examples/draganddrop/draggableicons/dragwidget.cpp169
-rw-r--r--examples/draganddrop/draggableicons/dragwidget.h66
-rw-r--r--examples/draganddrop/draggableicons/images/boat.pngbin0 -> 2772 bytes-rw-r--r--examples/draganddrop/draggableicons/images/car.pngbin0 -> 2963 bytes-rw-r--r--examples/draganddrop/draggableicons/images/house.pngbin0 -> 3292 bytes-rw-r--r--examples/draganddrop/draggableicons/main.cpp62
-rw-r--r--examples/draganddrop/draggabletext/draggabletext.pro12
-rw-r--r--examples/draganddrop/draggabletext/draggabletext.qrc5
-rw-r--r--examples/draganddrop/draggabletext/draglabel.cpp52
-rw-r--r--examples/draganddrop/draggabletext/draglabel.h59
-rw-r--r--examples/draganddrop/draggabletext/dragwidget.cpp164
-rw-r--r--examples/draganddrop/draggabletext/dragwidget.h63
-rw-r--r--examples/draganddrop/draggabletext/main.cpp53
-rw-r--r--examples/draganddrop/draggabletext/words.txt41
-rw-r--r--examples/draganddrop/dropsite/droparea.cpp127
-rw-r--r--examples/draganddrop/dropsite/droparea.h78
-rw-r--r--examples/draganddrop/dropsite/dropsite.pro12
-rw-r--r--examples/draganddrop/dropsite/dropsitewindow.cpp146
-rw-r--r--examples/draganddrop/dropsite/dropsitewindow.h78
-rw-r--r--examples/draganddrop/dropsite/main.cpp54
-rw-r--r--examples/draganddrop/fridgemagnets/draglabel.cpp90
-rw-r--r--examples/draganddrop/fridgemagnets/draglabel.h65
-rw-r--r--examples/draganddrop/fridgemagnets/dragwidget.cpp212
-rw-r--r--examples/draganddrop/fridgemagnets/dragwidget.h66
-rw-r--r--examples/draganddrop/fridgemagnets/fridgemagnets.pro12
-rw-r--r--examples/draganddrop/fridgemagnets/fridgemagnets.qrc5
-rw-r--r--examples/draganddrop/fridgemagnets/main.cpp53
-rw-r--r--examples/draganddrop/fridgemagnets/words.txt48
-rw-r--r--examples/draganddrop/puzzle/example.jpgbin0 -> 42654 bytes-rw-r--r--examples/draganddrop/puzzle/main.cpp55
-rw-r--r--examples/draganddrop/puzzle/mainwindow.cpp151
-rw-r--r--examples/draganddrop/puzzle/mainwindow.h77
-rw-r--r--examples/draganddrop/puzzle/pieceslist.cpp122
-rw-r--r--examples/draganddrop/puzzle/pieceslist.h62
-rw-r--r--examples/draganddrop/puzzle/puzzle.pro20
-rw-r--r--examples/draganddrop/puzzle/puzzle.qrc5
-rw-r--r--examples/draganddrop/puzzle/puzzlewidget.cpp205
-rw-r--r--examples/draganddrop/puzzle/puzzlewidget.h86
-rw-r--r--examples/examples.pro43
-rw-r--r--examples/graphicsview/README40
-rw-r--r--examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro12
-rw-r--r--examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.qrc5
-rw-r--r--examples/graphicsview/basicgraphicslayouts/images/block.pngbin0 -> 2146 bytes-rw-r--r--examples/graphicsview/basicgraphicslayouts/layoutitem.cpp99
-rw-r--r--examples/graphicsview/basicgraphicslayouts/layoutitem.h62
-rw-r--r--examples/graphicsview/basicgraphicslayouts/main.cpp59
-rw-r--r--examples/graphicsview/basicgraphicslayouts/window.cpp91
-rw-r--r--examples/graphicsview/basicgraphicslayouts/window.h58
-rw-r--r--examples/graphicsview/collidingmice/collidingmice.pro14
-rw-r--r--examples/graphicsview/collidingmice/images/cheese.jpgbin0 -> 3029 bytes-rw-r--r--examples/graphicsview/collidingmice/main.cpp88
-rw-r--r--examples/graphicsview/collidingmice/mice.qrc5
-rw-r--r--examples/graphicsview/collidingmice/mouse.cpp200
-rw-r--r--examples/graphicsview/collidingmice/mouse.h72
-rw-r--r--examples/graphicsview/diagramscene/arrow.cpp147
-rw-r--r--examples/graphicsview/diagramscene/arrow.h94
-rw-r--r--examples/graphicsview/diagramscene/diagramitem.cpp152
-rw-r--r--examples/graphicsview/diagramscene/diagramitem.h97
-rw-r--r--examples/graphicsview/diagramscene/diagramscene.cpp241
-rw-r--r--examples/graphicsview/diagramscene/diagramscene.h113
-rw-r--r--examples/graphicsview/diagramscene/diagramscene.pro20
-rw-r--r--examples/graphicsview/diagramscene/diagramscene.qrc20
-rw-r--r--examples/graphicsview/diagramscene/diagramtextitem.cpp82
-rw-r--r--examples/graphicsview/diagramscene/diagramtextitem.h79
-rw-r--r--examples/graphicsview/diagramscene/images/background1.pngbin0 -> 112 bytes-rw-r--r--examples/graphicsview/diagramscene/images/background2.pngbin0 -> 114 bytes-rw-r--r--examples/graphicsview/diagramscene/images/background3.pngbin0 -> 116 bytes-rw-r--r--examples/graphicsview/diagramscene/images/background4.pngbin0 -> 96 bytes-rw-r--r--examples/graphicsview/diagramscene/images/bold.pngbin0 -> 274 bytes-rw-r--r--examples/graphicsview/diagramscene/images/bringtofront.pngbin0 -> 293 bytes-rw-r--r--examples/graphicsview/diagramscene/images/delete.pngbin0 -> 831 bytes-rw-r--r--examples/graphicsview/diagramscene/images/floodfill.pngbin0 -> 282 bytes-rw-r--r--examples/graphicsview/diagramscene/images/italic.pngbin0 -> 247 bytes-rw-r--r--examples/graphicsview/diagramscene/images/linecolor.pngbin0 -> 145 bytes-rw-r--r--examples/graphicsview/diagramscene/images/linepointer.pngbin0 -> 141 bytes-rw-r--r--examples/graphicsview/diagramscene/images/pointer.pngbin0 -> 173 bytes-rw-r--r--examples/graphicsview/diagramscene/images/sendtoback.pngbin0 -> 318 bytes-rw-r--r--examples/graphicsview/diagramscene/images/textpointer.pngbin0 -> 753 bytes-rw-r--r--examples/graphicsview/diagramscene/images/underline.pngbin0 -> 250 bytes-rw-r--r--examples/graphicsview/diagramscene/main.cpp56
-rw-r--r--examples/graphicsview/diagramscene/mainwindow.cpp651
-rw-r--r--examples/graphicsview/diagramscene/mainwindow.h151
-rw-r--r--examples/graphicsview/dragdroprobot/coloritem.cpp129
-rw-r--r--examples/graphicsview/dragdroprobot/coloritem.h64
-rw-r--r--examples/graphicsview/dragdroprobot/dragdroprobot.pro18
-rw-r--r--examples/graphicsview/dragdroprobot/images/head.pngbin0 -> 14972 bytes-rw-r--r--examples/graphicsview/dragdroprobot/main.cpp78
-rw-r--r--examples/graphicsview/dragdroprobot/robot.cpp273
-rw-r--r--examples/graphicsview/dragdroprobot/robot.h110
-rw-r--r--examples/graphicsview/dragdroprobot/robot.qrc5
-rw-r--r--examples/graphicsview/elasticnodes/edge.cpp144
-rw-r--r--examples/graphicsview/elasticnodes/edge.h78
-rw-r--r--examples/graphicsview/elasticnodes/elasticnodes.pro16
-rw-r--r--examples/graphicsview/elasticnodes/graphwidget.cpp224
-rw-r--r--examples/graphicsview/elasticnodes/graphwidget.h71
-rw-r--r--examples/graphicsview/elasticnodes/main.cpp54
-rw-r--r--examples/graphicsview/elasticnodes/node.cpp185
-rw-r--r--examples/graphicsview/elasticnodes/node.h84
-rw-r--r--examples/graphicsview/graphicsview.pro18
-rw-r--r--examples/graphicsview/padnavigator/backside.ui208
-rw-r--r--examples/graphicsview/padnavigator/images/artsfftscope.pngbin0 -> 1291 bytes-rw-r--r--examples/graphicsview/padnavigator/images/blue_angle_swirl.jpgbin0 -> 11826 bytes-rw-r--r--examples/graphicsview/padnavigator/images/kontact_contacts.pngbin0 -> 4382 bytes-rw-r--r--examples/graphicsview/padnavigator/images/kontact_journal.pngbin0 -> 3261 bytes-rw-r--r--examples/graphicsview/padnavigator/images/kontact_mail.pngbin0 -> 3202 bytes-rw-r--r--examples/graphicsview/padnavigator/images/kontact_notes.pngbin0 -> 3893 bytes-rw-r--r--examples/graphicsview/padnavigator/images/kopeteavailable.pngbin0 -> 2380 bytes-rw-r--r--examples/graphicsview/padnavigator/images/metacontact_online.pngbin0 -> 2545 bytes-rw-r--r--examples/graphicsview/padnavigator/images/minitools.pngbin0 -> 2087 bytes-rw-r--r--examples/graphicsview/padnavigator/main.cpp59
-rw-r--r--examples/graphicsview/padnavigator/padnavigator.pro24
-rw-r--r--examples/graphicsview/padnavigator/padnavigator.qrc14
-rw-r--r--examples/graphicsview/padnavigator/panel.cpp238
-rw-r--r--examples/graphicsview/padnavigator/panel.h92
-rw-r--r--examples/graphicsview/padnavigator/roundrectitem.cpp164
-rw-r--r--examples/graphicsview/padnavigator/roundrectitem.h83
-rw-r--r--examples/graphicsview/padnavigator/splashitem.cpp92
-rw-r--r--examples/graphicsview/padnavigator/splashitem.h63
-rw-r--r--examples/graphicsview/portedasteroids/animateditem.cpp95
-rw-r--r--examples/graphicsview/portedasteroids/animateditem.h84
-rw-r--r--examples/graphicsview/portedasteroids/bg.pngbin0 -> 3793 bytes-rw-r--r--examples/graphicsview/portedasteroids/ledmeter.cpp161
-rw-r--r--examples/graphicsview/portedasteroids/ledmeter.h96
-rw-r--r--examples/graphicsview/portedasteroids/main.cpp60
-rw-r--r--examples/graphicsview/portedasteroids/portedasteroids.pro19
-rw-r--r--examples/graphicsview/portedasteroids/portedasteroids.qrc163
-rw-r--r--examples/graphicsview/portedasteroids/sounds/Explosion.wavbin0 -> 18427 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites.h170
-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits.ini9
-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits.pov31
-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0000.pngbin0 -> 215 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0001.pngbin0 -> 236 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0002.pngbin0 -> 244 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0003.pngbin0 -> 277 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0004.pngbin0 -> 259 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0005.pngbin0 -> 251 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0006.pngbin0 -> 214 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0007.pngbin0 -> 177 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0008.pngbin0 -> 175 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0009.pngbin0 -> 221 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0010.pngbin0 -> 243 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0011.pngbin0 -> 272 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0012.pngbin0 -> 265 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0013.pngbin0 -> 253 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0014.pngbin0 -> 214 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/bits/bits0015.pngbin0 -> 196 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/exhaust/exhaust.pngbin0 -> 92 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/missile/missile.pngbin0 -> 89 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/powerups/brake.pngbin0 -> 151 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/powerups/energy.pngbin0 -> 134 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/powerups/shield.pngbin0 -> 171 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/powerups/shoot.pngbin0 -> 181 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/powerups/teleport.pngbin0 -> 160 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock1.ini9
-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock1.pov26
-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10000.pngbin0 -> 2502 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10001.pngbin0 -> 2483 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10002.pngbin0 -> 2519 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10003.pngbin0 -> 2460 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10004.pngbin0 -> 2486 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10005.pngbin0 -> 2416 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10006.pngbin0 -> 2419 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10007.pngbin0 -> 2374 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10008.pngbin0 -> 2329 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10009.pngbin0 -> 2227 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10010.pngbin0 -> 2218 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10011.pngbin0 -> 2178 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10012.pngbin0 -> 2172 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10013.pngbin0 -> 2229 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10014.pngbin0 -> 2270 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10015.pngbin0 -> 2348 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10016.pngbin0 -> 2402 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10017.pngbin0 -> 2489 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10018.pngbin0 -> 2530 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10019.pngbin0 -> 2591 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10020.pngbin0 -> 2540 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10021.pngbin0 -> 2606 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10022.pngbin0 -> 2591 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10023.pngbin0 -> 2566 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10024.pngbin0 -> 2512 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10025.pngbin0 -> 2456 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10026.pngbin0 -> 2420 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10027.pngbin0 -> 2557 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10028.pngbin0 -> 2567 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10029.pngbin0 -> 2572 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10030.pngbin0 -> 2620 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock1/rock10031.pngbin0 -> 2558 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock2.ini9
-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock2.pov26
-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20000.pngbin0 -> 1338 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20001.pngbin0 -> 1363 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20002.pngbin0 -> 1385 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20003.pngbin0 -> 1389 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20004.pngbin0 -> 1361 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20005.pngbin0 -> 1393 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20006.pngbin0 -> 1361 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20007.pngbin0 -> 1369 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20008.pngbin0 -> 1368 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20009.pngbin0 -> 1311 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20010.pngbin0 -> 1340 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20011.pngbin0 -> 1322 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20012.pngbin0 -> 1350 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20013.pngbin0 -> 1337 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20014.pngbin0 -> 1341 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20015.pngbin0 -> 1373 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20016.pngbin0 -> 1357 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20017.pngbin0 -> 1354 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20018.pngbin0 -> 1320 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20019.pngbin0 -> 1356 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20020.pngbin0 -> 1379 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20021.pngbin0 -> 1401 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20022.pngbin0 -> 1418 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20023.pngbin0 -> 1401 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20024.pngbin0 -> 1383 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20025.pngbin0 -> 1360 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20026.pngbin0 -> 1376 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20027.pngbin0 -> 1331 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20028.pngbin0 -> 1353 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20029.pngbin0 -> 1376 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20030.pngbin0 -> 1290 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock2/rock20031.pngbin0 -> 1313 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock3.ini9
-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock3.pov26
-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30000.pngbin0 -> 738 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30001.pngbin0 -> 730 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30002.pngbin0 -> 769 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30003.pngbin0 -> 766 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30004.pngbin0 -> 770 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30005.pngbin0 -> 756 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30006.pngbin0 -> 760 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30007.pngbin0 -> 750 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30008.pngbin0 -> 747 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30009.pngbin0 -> 752 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30010.pngbin0 -> 727 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30011.pngbin0 -> 737 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30012.pngbin0 -> 724 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30013.pngbin0 -> 751 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30014.pngbin0 -> 720 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30015.pngbin0 -> 741 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30016.pngbin0 -> 723 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30017.pngbin0 -> 722 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30018.pngbin0 -> 716 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30019.pngbin0 -> 735 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30020.pngbin0 -> 735 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30021.pngbin0 -> 731 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30022.pngbin0 -> 735 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30023.pngbin0 -> 732 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30024.pngbin0 -> 727 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30025.pngbin0 -> 721 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30026.pngbin0 -> 716 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30027.pngbin0 -> 721 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30028.pngbin0 -> 739 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30029.pngbin0 -> 740 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30030.pngbin0 -> 725 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/rock3/rock30031.pngbin0 -> 715 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0000.pngbin0 -> 1702 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0001.pngbin0 -> 1690 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0002.pngbin0 -> 1849 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0003.pngbin0 -> 1858 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0004.pngbin0 -> 1725 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0005.pngbin0 -> 1876 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/shield/shield0006.pngbin0 -> 1848 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship.ini9
-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship.pov128
-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0000.pngbin0 -> 1772 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0001.pngbin0 -> 1893 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0002.pngbin0 -> 1899 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0003.pngbin0 -> 1878 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0004.pngbin0 -> 1979 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0005.pngbin0 -> 2054 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0006.pngbin0 -> 1956 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0007.pngbin0 -> 1929 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0008.pngbin0 -> 1790 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0009.pngbin0 -> 1913 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0010.pngbin0 -> 1954 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0011.pngbin0 -> 1975 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0012.pngbin0 -> 1953 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0013.pngbin0 -> 1924 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0014.pngbin0 -> 1900 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0015.pngbin0 -> 1799 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0016.pngbin0 -> 1738 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0017.pngbin0 -> 1868 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0018.pngbin0 -> 1945 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0019.pngbin0 -> 1972 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0020.pngbin0 -> 2014 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0021.pngbin0 -> 2002 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0022.pngbin0 -> 1920 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0023.pngbin0 -> 1840 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0024.pngbin0 -> 1733 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0025.pngbin0 -> 1880 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0026.pngbin0 -> 1951 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0027.pngbin0 -> 2014 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0028.pngbin0 -> 2019 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0029.pngbin0 -> 2022 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0030.pngbin0 -> 1969 bytes-rw-r--r--examples/graphicsview/portedasteroids/sprites/ship/ship0031.pngbin0 -> 1880 bytes-rw-r--r--examples/graphicsview/portedasteroids/toplevel.cpp543
-rw-r--r--examples/graphicsview/portedasteroids/toplevel.h126
-rw-r--r--examples/graphicsview/portedasteroids/view.cpp967
-rw-r--r--examples/graphicsview/portedasteroids/view.h184
-rw-r--r--examples/graphicsview/portedcanvas/blendshadow.cpp94
-rw-r--r--examples/graphicsview/portedcanvas/butterfly.pngbin0 -> 36868 bytes-rw-r--r--examples/graphicsview/portedcanvas/canvas.cpp733
-rw-r--r--examples/graphicsview/portedcanvas/canvas.doc29
-rw-r--r--examples/graphicsview/portedcanvas/canvas.h131
-rw-r--r--examples/graphicsview/portedcanvas/main.cpp92
-rw-r--r--examples/graphicsview/portedcanvas/makeimg.cpp133
-rw-r--r--examples/graphicsview/portedcanvas/portedcanvas.pro16
-rw-r--r--examples/graphicsview/portedcanvas/portedcanvas.qrc7
-rw-r--r--examples/graphicsview/portedcanvas/qt-trans.xpm54
-rw-r--r--examples/graphicsview/portedcanvas/qtlogo.pngbin0 -> 21921 bytes-rw-r--r--examples/help/README38
-rw-r--r--examples/help/contextsensitivehelp/contextsensitivehelp.pro18
-rw-r--r--examples/help/contextsensitivehelp/doc/amount.html11
-rw-r--r--examples/help/contextsensitivehelp/doc/filter.html12
-rw-r--r--examples/help/contextsensitivehelp/doc/plants.html44
-rw-r--r--examples/help/contextsensitivehelp/doc/rain.html11
-rw-r--r--examples/help/contextsensitivehelp/doc/source.html33
-rw-r--r--examples/help/contextsensitivehelp/doc/temperature.html13
-rw-r--r--examples/help/contextsensitivehelp/doc/time.html11
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qchbin0 -> 27648 bytes-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhcbin0 -> 10240 bytes-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhcp14
-rw-r--r--examples/help/contextsensitivehelp/doc/wateringmachine.qhp25
-rw-r--r--examples/help/contextsensitivehelp/helpbrowser.cpp81
-rw-r--r--examples/help/contextsensitivehelp/helpbrowser.h65
-rw-r--r--examples/help/contextsensitivehelp/main.cpp51
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.cpp69
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.h62
-rw-r--r--examples/help/contextsensitivehelp/wateringconfigdialog.ui446
-rw-r--r--examples/help/help.pro11
-rw-r--r--examples/help/remotecontrol/enter.pngbin0 -> 315 bytes-rw-r--r--examples/help/remotecontrol/main.cpp54
-rw-r--r--examples/help/remotecontrol/remotecontrol.cpp175
-rw-r--r--examples/help/remotecontrol/remotecontrol.h79
-rw-r--r--examples/help/remotecontrol/remotecontrol.pro13
-rw-r--r--examples/help/remotecontrol/remotecontrol.qrc5
-rw-r--r--examples/help/remotecontrol/remotecontrol.ui228
-rw-r--r--examples/help/simpletextviewer/assistant.cpp110
-rw-r--r--examples/help/simpletextviewer/assistant.h63
-rw-r--r--examples/help/simpletextviewer/documentation/about.txt9
-rw-r--r--examples/help/simpletextviewer/documentation/browse.html34
-rw-r--r--examples/help/simpletextviewer/documentation/filedialog.html48
-rw-r--r--examples/help/simpletextviewer/documentation/findfile.html32
-rw-r--r--examples/help/simpletextviewer/documentation/images/browse.pngbin0 -> 21553 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/fadedfilemenu.pngbin0 -> 9589 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/filedialog.pngbin0 -> 12318 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/handbook.pngbin0 -> 1060 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/icon.pngbin0 -> 5513 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/mainwindow.pngbin0 -> 12769 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/open.pngbin0 -> 11697 bytes-rw-r--r--examples/help/simpletextviewer/documentation/images/wildcard.pngbin0 -> 11266 bytes-rw-r--r--examples/help/simpletextviewer/documentation/index.html41
-rw-r--r--examples/help/simpletextviewer/documentation/intro.html28
-rw-r--r--examples/help/simpletextviewer/documentation/openfile.html36
-rw-r--r--examples/help/simpletextviewer/documentation/simpletextviewer.qchbin0 -> 108544 bytes-rw-r--r--examples/help/simpletextviewer/documentation/simpletextviewer.qhcbin0 -> 18432 bytes-rw-r--r--examples/help/simpletextviewer/documentation/simpletextviewer.qhcp30
-rw-r--r--examples/help/simpletextviewer/documentation/simpletextviewer.qhp49
-rw-r--r--examples/help/simpletextviewer/documentation/wildcardmatching.html57
-rw-r--r--examples/help/simpletextviewer/findfiledialog.cpp222
-rw-r--r--examples/help/simpletextviewer/findfiledialog.h99
-rw-r--r--examples/help/simpletextviewer/main.cpp52
-rw-r--r--examples/help/simpletextviewer/mainwindow.cpp147
-rw-r--r--examples/help/simpletextviewer/mainwindow.h84
-rw-r--r--examples/help/simpletextviewer/simpletextviewer.pro16
-rw-r--r--examples/help/simpletextviewer/textedit.cpp75
-rw-r--r--examples/help/simpletextviewer/textedit.h61
-rw-r--r--examples/ipc/README35
-rw-r--r--examples/ipc/ipc.pro8
-rw-r--r--examples/ipc/localfortuneclient/client.cpp153
-rw-r--r--examples/ipc/localfortuneclient/client.h82
-rw-r--r--examples/ipc/localfortuneclient/localfortuneclient.pro12
-rw-r--r--examples/ipc/localfortuneclient/main.cpp52
-rw-r--r--examples/ipc/localfortuneserver/localfortuneserver.pro12
-rw-r--r--examples/ipc/localfortuneserver/main.cpp56
-rw-r--r--examples/ipc/localfortuneserver/server.cpp111
-rw-r--r--examples/ipc/localfortuneserver/server.h70
-rw-r--r--examples/ipc/sharedmemory/dialog.cpp189
-rw-r--r--examples/ipc/sharedmemory/dialog.h71
-rw-r--r--examples/ipc/sharedmemory/dialog.ui47
-rw-r--r--examples/ipc/sharedmemory/image.pngbin0 -> 10199 bytes-rw-r--r--examples/ipc/sharedmemory/main.cpp54
-rw-r--r--examples/ipc/sharedmemory/qt.pngbin0 -> 2383 bytes-rw-r--r--examples/ipc/sharedmemory/sharedmemory.pro13
-rw-r--r--examples/itemviews/README39
-rw-r--r--examples/itemviews/addressbook/adddialog.cpp83
-rw-r--r--examples/itemviews/addressbook/adddialog.h72
-rw-r--r--examples/itemviews/addressbook/addressbook.pro17
-rw-r--r--examples/itemviews/addressbook/addresswidget.cpp238
-rw-r--r--examples/itemviews/addressbook/addresswidget.h83
-rw-r--r--examples/itemviews/addressbook/main.cpp53
-rw-r--r--examples/itemviews/addressbook/mainwindow.cpp138
-rw-r--r--examples/itemviews/addressbook/mainwindow.h76
-rw-r--r--examples/itemviews/addressbook/newaddresstab.cpp78
-rw-r--r--examples/itemviews/addressbook/newaddresstab.h75
-rw-r--r--examples/itemviews/addressbook/tablemodel.cpp185
-rw-r--r--examples/itemviews/addressbook/tablemodel.h73
-rw-r--r--examples/itemviews/basicsortfiltermodel/basicsortfiltermodel.pro10
-rw-r--r--examples/itemviews/basicsortfiltermodel/main.cpp94
-rw-r--r--examples/itemviews/basicsortfiltermodel/window.cpp157
-rw-r--r--examples/itemviews/basicsortfiltermodel/window.h89
-rw-r--r--examples/itemviews/chart/chart.pro13
-rw-r--r--examples/itemviews/chart/chart.qrc5
-rw-r--r--examples/itemviews/chart/main.cpp54
-rw-r--r--examples/itemviews/chart/mainwindow.cpp173
-rw-r--r--examples/itemviews/chart/mainwindow.h73
-rw-r--r--examples/itemviews/chart/mydata.cht8
-rw-r--r--examples/itemviews/chart/pieview.cpp562
-rw-r--r--examples/itemviews/chart/pieview.h115
-rw-r--r--examples/itemviews/chart/qtdata.cht14
-rw-r--r--examples/itemviews/coloreditorfactory/coloreditorfactory.pro11
-rw-r--r--examples/itemviews/coloreditorfactory/colorlisteditor.cpp77
-rw-r--r--examples/itemviews/coloreditorfactory/colorlisteditor.h70
-rw-r--r--examples/itemviews/coloreditorfactory/main.cpp54
-rw-r--r--examples/itemviews/coloreditorfactory/window.cpp95
-rw-r--r--examples/itemviews/coloreditorfactory/window.h58
-rw-r--r--examples/itemviews/combowidgetmapper/combowidgetmapper.pro9
-rw-r--r--examples/itemviews/combowidgetmapper/main.cpp52
-rw-r--r--examples/itemviews/combowidgetmapper/window.cpp137
-rw-r--r--examples/itemviews/combowidgetmapper/window.h87
-rw-r--r--examples/itemviews/customsortfiltermodel/customsortfiltermodel.pro12
-rw-r--r--examples/itemviews/customsortfiltermodel/main.cpp96
-rw-r--r--examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp116
-rw-r--r--examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.h74
-rw-r--r--examples/itemviews/customsortfiltermodel/window.cpp168
-rw-r--r--examples/itemviews/customsortfiltermodel/window.h91
-rw-r--r--examples/itemviews/dirview/dirview.pro7
-rw-r--r--examples/itemviews/dirview/main.cpp62
-rw-r--r--examples/itemviews/editabletreemodel/default.txt40
-rw-r--r--examples/itemviews/editabletreemodel/editabletreemodel.pro16
-rw-r--r--examples/itemviews/editabletreemodel/editabletreemodel.qrc5
-rw-r--r--examples/itemviews/editabletreemodel/main.cpp54
-rw-r--r--examples/itemviews/editabletreemodel/mainwindow.cpp181
-rw-r--r--examples/itemviews/editabletreemodel/mainwindow.h72
-rw-r--r--examples/itemviews/editabletreemodel/mainwindow.ui128
-rw-r--r--examples/itemviews/editabletreemodel/treeitem.cpp180
-rw-r--r--examples/itemviews/editabletreemodel/treeitem.h75
-rw-r--r--examples/itemviews/editabletreemodel/treemodel.cpp289
-rw-r--r--examples/itemviews/editabletreemodel/treemodel.h98
-rw-r--r--examples/itemviews/fetchmore/fetchmore.pro12
-rw-r--r--examples/itemviews/fetchmore/filelistmodel.cpp116
-rw-r--r--examples/itemviews/fetchmore/filelistmodel.h76
-rw-r--r--examples/itemviews/fetchmore/main.cpp51
-rw-r--r--examples/itemviews/fetchmore/window.cpp82
-rw-r--r--examples/itemviews/fetchmore/window.h65
-rw-r--r--examples/itemviews/itemviews.pro22
-rw-r--r--examples/itemviews/pixelator/imagemodel.cpp92
-rw-r--r--examples/itemviews/pixelator/imagemodel.h69
-rw-r--r--examples/itemviews/pixelator/images.qrc5
-rw-r--r--examples/itemviews/pixelator/images/qt.pngbin0 -> 656 bytes-rw-r--r--examples/itemviews/pixelator/main.cpp55
-rw-r--r--examples/itemviews/pixelator/mainwindow.cpp245
-rw-r--r--examples/itemviews/pixelator/mainwindow.h75
-rw-r--r--examples/itemviews/pixelator/pixelator.pro14
-rw-r--r--examples/itemviews/pixelator/pixeldelegate.cpp108
-rw-r--r--examples/itemviews/pixelator/pixeldelegate.h80
-rw-r--r--examples/itemviews/puzzle/example.jpgbin0 -> 42654 bytes-rw-r--r--examples/itemviews/puzzle/main.cpp55
-rw-r--r--examples/itemviews/puzzle/mainwindow.cpp150
-rw-r--r--examples/itemviews/puzzle/mainwindow.h78
-rw-r--r--examples/itemviews/puzzle/piecesmodel.cpp204
-rw-r--r--examples/itemviews/puzzle/piecesmodel.h81
-rw-r--r--examples/itemviews/puzzle/puzzle.pro14
-rw-r--r--examples/itemviews/puzzle/puzzle.qrc5
-rw-r--r--examples/itemviews/puzzle/puzzlewidget.cpp205
-rw-r--r--examples/itemviews/puzzle/puzzlewidget.h86
-rw-r--r--examples/itemviews/simpledommodel/domitem.cpp102
-rw-r--r--examples/itemviews/simpledommodel/domitem.h67
-rw-r--r--examples/itemviews/simpledommodel/dommodel.cpp190
-rw-r--r--examples/itemviews/simpledommodel/dommodel.h77
-rw-r--r--examples/itemviews/simpledommodel/main.cpp53
-rw-r--r--examples/itemviews/simpledommodel/mainwindow.cpp85
-rw-r--r--examples/itemviews/simpledommodel/mainwindow.h71
-rw-r--r--examples/itemviews/simpledommodel/simpledommodel.pro15
-rw-r--r--examples/itemviews/simpletreemodel/default.txt40
-rw-r--r--examples/itemviews/simpletreemodel/main.cpp62
-rw-r--r--examples/itemviews/simpletreemodel/simpletreemodel.pro13
-rw-r--r--examples/itemviews/simpletreemodel/simpletreemodel.qrc5
-rw-r--r--examples/itemviews/simpletreemodel/treeitem.cpp117
-rw-r--r--examples/itemviews/simpletreemodel/treeitem.h71
-rw-r--r--examples/itemviews/simpletreemodel/treemodel.cpp219
-rw-r--r--examples/itemviews/simpletreemodel/treemodel.h77
-rw-r--r--examples/itemviews/simplewidgetmapper/main.cpp52
-rw-r--r--examples/itemviews/simplewidgetmapper/simplewidgetmapper.pro9
-rw-r--r--examples/itemviews/simplewidgetmapper/window.cpp134
-rw-r--r--examples/itemviews/simplewidgetmapper/window.h85
-rw-r--r--examples/itemviews/spinboxdelegate/delegate.cpp103
-rw-r--r--examples/itemviews/spinboxdelegate/delegate.h71
-rw-r--r--examples/itemviews/spinboxdelegate/main.cpp87
-rw-r--r--examples/itemviews/spinboxdelegate/spinboxdelegate.pro9
-rw-r--r--examples/itemviews/stardelegate/main.cpp108
-rw-r--r--examples/itemviews/stardelegate/stardelegate.cpp130
-rw-r--r--examples/itemviews/stardelegate/stardelegate.h70
-rw-r--r--examples/itemviews/stardelegate/stardelegate.pro14
-rw-r--r--examples/itemviews/stardelegate/stareditor.cpp99
-rw-r--r--examples/itemviews/stardelegate/stareditor.h78
-rw-r--r--examples/itemviews/stardelegate/starrating.cpp103
-rw-r--r--examples/itemviews/stardelegate/starrating.h77
-rw-r--r--examples/layouts/README41
-rw-r--r--examples/layouts/basiclayouts/basiclayouts.pro9
-rw-r--r--examples/layouts/basiclayouts/dialog.cpp150
-rw-r--r--examples/layouts/basiclayouts/dialog.h91
-rw-r--r--examples/layouts/basiclayouts/main.cpp51
-rw-r--r--examples/layouts/borderlayout/borderlayout.cpp214
-rw-r--r--examples/layouts/borderlayout/borderlayout.h89
-rw-r--r--examples/layouts/borderlayout/borderlayout.pro11
-rw-r--r--examples/layouts/borderlayout/main.cpp52
-rw-r--r--examples/layouts/borderlayout/window.cpp69
-rw-r--r--examples/layouts/borderlayout/window.h62
-rw-r--r--examples/layouts/dynamiclayouts/dialog.cpp170
-rw-r--r--examples/layouts/dynamiclayouts/dialog.h91
-rw-r--r--examples/layouts/dynamiclayouts/dynamiclayouts.pro9
-rw-r--r--examples/layouts/dynamiclayouts/main.cpp51
-rw-r--r--examples/layouts/flowlayout/flowlayout.cpp154
-rw-r--r--examples/layouts/flowlayout/flowlayout.h73
-rw-r--r--examples/layouts/flowlayout/flowlayout.pro11
-rw-r--r--examples/layouts/flowlayout/main.cpp52
-rw-r--r--examples/layouts/flowlayout/window.cpp59
-rw-r--r--examples/layouts/flowlayout/window.h59
-rw-r--r--examples/layouts/layouts.pro10
-rw-r--r--examples/linguist/README37
-rw-r--r--examples/linguist/arrowpad/arrowpad.cpp65
-rw-r--r--examples/linguist/arrowpad/arrowpad.h69
-rw-r--r--examples/linguist/arrowpad/arrowpad.pro16
-rw-r--r--examples/linguist/arrowpad/main.cpp64
-rw-r--r--examples/linguist/arrowpad/mainwindow.cpp62
-rw-r--r--examples/linguist/arrowpad/mainwindow.h69
-rw-r--r--examples/linguist/hellotr/hellotr.pro11
-rw-r--r--examples/linguist/hellotr/main.cpp71
-rw-r--r--examples/linguist/linguist.pro9
-rw-r--r--examples/linguist/trollprint/main.cpp61
-rw-r--r--examples/linguist/trollprint/mainwindow.cpp96
-rw-r--r--examples/linguist/trollprint/mainwindow.h75
-rw-r--r--examples/linguist/trollprint/printpanel.cpp86
-rw-r--r--examples/linguist/trollprint/printpanel.h70
-rw-r--r--examples/linguist/trollprint/trollprint.pro12
-rw-r--r--examples/linguist/trollprint/trollprint_pt.ts65
-rw-r--r--examples/mainwindows/README40
-rw-r--r--examples/mainwindows/application/application.pro12
-rw-r--r--examples/mainwindows/application/application.qrc10
-rw-r--r--examples/mainwindows/application/images/copy.pngbin0 -> 1338 bytes-rw-r--r--examples/mainwindows/application/images/cut.pngbin0 -> 1323 bytes-rw-r--r--examples/mainwindows/application/images/new.pngbin0 -> 852 bytes-rw-r--r--examples/mainwindows/application/images/open.pngbin0 -> 2073 bytes-rw-r--r--examples/mainwindows/application/images/paste.pngbin0 -> 1645 bytes-rw-r--r--examples/mainwindows/application/images/save.pngbin0 -> 1187 bytes-rw-r--r--examples/mainwindows/application/main.cpp56
-rw-r--r--examples/mainwindows/application/mainwindow.cpp388
-rw-r--r--examples/mainwindows/application/mainwindow.h106
-rw-r--r--examples/mainwindows/dockwidgets/dockwidgets.pro10
-rw-r--r--examples/mainwindows/dockwidgets/dockwidgets.qrc8
-rw-r--r--examples/mainwindows/dockwidgets/images/new.pngbin0 -> 977 bytes-rw-r--r--examples/mainwindows/dockwidgets/images/print.pngbin0 -> 1732 bytes-rw-r--r--examples/mainwindows/dockwidgets/images/save.pngbin0 -> 1894 bytes-rw-r--r--examples/mainwindows/dockwidgets/images/undo.pngbin0 -> 1768 bytes-rw-r--r--examples/mainwindows/dockwidgets/main.cpp53
-rw-r--r--examples/mainwindows/dockwidgets/mainwindow.cpp343
-rw-r--r--examples/mainwindows/dockwidgets/mainwindow.h98
-rw-r--r--examples/mainwindows/mainwindows.pro13
-rw-r--r--examples/mainwindows/mdi/images/copy.pngbin0 -> 1338 bytes-rw-r--r--examples/mainwindows/mdi/images/cut.pngbin0 -> 1323 bytes-rw-r--r--examples/mainwindows/mdi/images/new.pngbin0 -> 852 bytes-rw-r--r--examples/mainwindows/mdi/images/open.pngbin0 -> 2073 bytes-rw-r--r--examples/mainwindows/mdi/images/paste.pngbin0 -> 1645 bytes-rw-r--r--examples/mainwindows/mdi/images/save.pngbin0 -> 1187 bytes-rw-r--r--examples/mainwindows/mdi/main.cpp54
-rw-r--r--examples/mainwindows/mdi/mainwindow.cpp399
-rw-r--r--examples/mainwindows/mdi/mainwindow.h119
-rw-r--r--examples/mainwindows/mdi/mdi.pro12
-rw-r--r--examples/mainwindows/mdi/mdi.qrc10
-rw-r--r--examples/mainwindows/mdi/mdichild.cpp176
-rw-r--r--examples/mainwindows/mdi/mdichild.h77
-rw-r--r--examples/mainwindows/menus/main.cpp52
-rw-r--r--examples/mainwindows/menus/mainwindow.cpp371
-rw-r--r--examples/mainwindows/menus/mainwindow.h125
-rw-r--r--examples/mainwindows/menus/menus.pro9
-rw-r--r--examples/mainwindows/recentfiles/main.cpp52
-rw-r--r--examples/mainwindows/recentfiles/mainwindow.cpp256
-rw-r--r--examples/mainwindows/recentfiles/mainwindow.h97
-rw-r--r--examples/mainwindows/recentfiles/recentfiles.pro9
-rw-r--r--examples/mainwindows/sdi/images/copy.pngbin0 -> 1338 bytes-rw-r--r--examples/mainwindows/sdi/images/cut.pngbin0 -> 1323 bytes-rw-r--r--examples/mainwindows/sdi/images/new.pngbin0 -> 852 bytes-rw-r--r--examples/mainwindows/sdi/images/open.pngbin0 -> 2073 bytes-rw-r--r--examples/mainwindows/sdi/images/paste.pngbin0 -> 1645 bytes-rw-r--r--examples/mainwindows/sdi/images/save.pngbin0 -> 1187 bytes-rw-r--r--examples/mainwindows/sdi/main.cpp53
-rw-r--r--examples/mainwindows/sdi/mainwindow.cpp375
-rw-r--r--examples/mainwindows/sdi/mainwindow.h109
-rw-r--r--examples/mainwindows/sdi/sdi.pro10
-rw-r--r--examples/mainwindows/sdi/sdi.qrc10
-rw-r--r--examples/network/README40
-rw-r--r--examples/network/blockingfortuneclient/blockingclient.cpp154
-rw-r--r--examples/network/blockingfortuneclient/blockingclient.h85
-rw-r--r--examples/network/blockingfortuneclient/blockingfortuneclient.pro12
-rw-r--r--examples/network/blockingfortuneclient/fortunethread.cpp138
-rw-r--r--examples/network/blockingfortuneclient/fortunethread.h74
-rw-r--r--examples/network/blockingfortuneclient/main.cpp52
-rw-r--r--examples/network/broadcastreceiver/broadcastreceiver.pro10
-rw-r--r--examples/network/broadcastreceiver/main.cpp52
-rw-r--r--examples/network/broadcastreceiver/receiver.cpp88
-rw-r--r--examples/network/broadcastreceiver/receiver.h69
-rw-r--r--examples/network/broadcastsender/broadcastsender.pro10
-rw-r--r--examples/network/broadcastsender/main.cpp52
-rw-r--r--examples/network/broadcastsender/sender.cpp92
-rw-r--r--examples/network/broadcastsender/sender.h76
-rw-r--r--examples/network/download/download.pro19
-rw-r--r--examples/network/download/main.cpp176
-rw-r--r--examples/network/downloadmanager/downloadmanager.cpp173
-rw-r--r--examples/network/downloadmanager/downloadmanager.h85
-rw-r--r--examples/network/downloadmanager/downloadmanager.pro20
-rw-r--r--examples/network/downloadmanager/main.cpp68
-rw-r--r--examples/network/downloadmanager/textprogressbar.cpp99
-rw-r--r--examples/network/downloadmanager/textprogressbar.h64
-rw-r--r--examples/network/fortuneclient/client.cpp191
-rw-r--r--examples/network/fortuneclient/client.h86
-rw-r--r--examples/network/fortuneclient/fortuneclient.pro10
-rw-r--r--examples/network/fortuneclient/main.cpp52
-rw-r--r--examples/network/fortuneserver/fortuneserver.pro10
-rw-r--r--examples/network/fortuneserver/main.cpp56
-rw-r--r--examples/network/fortuneserver/server.cpp123
-rw-r--r--examples/network/fortuneserver/server.h72
-rw-r--r--examples/network/ftp/ftp.pro11
-rw-r--r--examples/network/ftp/ftp.qrc7
-rw-r--r--examples/network/ftp/ftpwindow.cpp349
-rw-r--r--examples/network/ftp/ftpwindow.h104
-rw-r--r--examples/network/ftp/images/cdtoparent.pngbin0 -> 139 bytes-rw-r--r--examples/network/ftp/images/dir.pngbin0 -> 154 bytes-rw-r--r--examples/network/ftp/images/file.pngbin0 -> 129 bytes-rw-r--r--examples/network/ftp/main.cpp54
-rw-r--r--examples/network/http/authenticationdialog.ui129
-rw-r--r--examples/network/http/http.pro11
-rw-r--r--examples/network/http/httpwindow.cpp262
-rw-r--r--examples/network/http/httpwindow.h94
-rw-r--r--examples/network/http/main.cpp52
-rw-r--r--examples/network/loopback/dialog.cpp187
-rw-r--r--examples/network/loopback/dialog.h90
-rw-r--r--examples/network/loopback/loopback.pro10
-rw-r--r--examples/network/loopback/main.cpp52
-rw-r--r--examples/network/network-chat/chatdialog.cpp141
-rw-r--r--examples/network/network-chat/chatdialog.h70
-rw-r--r--examples/network/network-chat/chatdialog.ui79
-rw-r--r--examples/network/network-chat/client.cpp140
-rw-r--r--examples/network/network-chat/client.h83
-rw-r--r--examples/network/network-chat/connection.cpp276
-rw-r--r--examples/network/network-chat/connection.h108
-rw-r--r--examples/network/network-chat/main.cpp52
-rw-r--r--examples/network/network-chat/network-chat.pro19
-rw-r--r--examples/network/network-chat/peermanager.cpp170
-rw-r--r--examples/network/network-chat/peermanager.h85
-rw-r--r--examples/network/network-chat/server.cpp58
-rw-r--r--examples/network/network-chat/server.h63
-rw-r--r--examples/network/network.pro21
-rw-r--r--examples/network/securesocketclient/certificateinfo.cpp100
-rw-r--r--examples/network/securesocketclient/certificateinfo.h69
-rw-r--r--examples/network/securesocketclient/certificateinfo.ui85
-rw-r--r--examples/network/securesocketclient/encrypted.pngbin0 -> 750 bytes-rw-r--r--examples/network/securesocketclient/main.cpp63
-rw-r--r--examples/network/securesocketclient/securesocketclient.pro16
-rw-r--r--examples/network/securesocketclient/securesocketclient.qrc5
-rw-r--r--examples/network/securesocketclient/sslclient.cpp218
-rw-r--r--examples/network/securesocketclient/sslclient.h81
-rw-r--r--examples/network/securesocketclient/sslclient.ui190
-rw-r--r--examples/network/securesocketclient/sslerrors.ui110
-rw-r--r--examples/network/threadedfortuneserver/dialog.cpp82
-rw-r--r--examples/network/threadedfortuneserver/dialog.h66
-rw-r--r--examples/network/threadedfortuneserver/fortuneserver.cpp69
-rw-r--r--examples/network/threadedfortuneserver/fortuneserver.h64
-rw-r--r--examples/network/threadedfortuneserver/fortunethread.cpp77
-rw-r--r--examples/network/threadedfortuneserver/fortunethread.h67
-rw-r--r--examples/network/threadedfortuneserver/main.cpp56
-rw-r--r--examples/network/threadedfortuneserver/threadedfortuneserver.pro14
-rw-r--r--examples/network/torrent/addtorrentdialog.cpp170
-rw-r--r--examples/network/torrent/addtorrentdialog.h74
-rw-r--r--examples/network/torrent/bencodeparser.cpp235
-rw-r--r--examples/network/torrent/bencodeparser.h81
-rw-r--r--examples/network/torrent/connectionmanager.cpp89
-rw-r--r--examples/network/torrent/connectionmanager.h66
-rw-r--r--examples/network/torrent/filemanager.cpp447
-rw-r--r--examples/network/torrent/filemanager.h144
-rw-r--r--examples/network/torrent/forms/addtorrentform.ui266
-rw-r--r--examples/network/torrent/icons.qrc12
-rw-r--r--examples/network/torrent/icons/1downarrow.pngbin0 -> 895 bytes-rw-r--r--examples/network/torrent/icons/1uparrow.pngbin0 -> 822 bytes-rw-r--r--examples/network/torrent/icons/bottom.pngbin0 -> 1632 bytes-rw-r--r--examples/network/torrent/icons/edit_add.pngbin0 -> 394 bytes-rw-r--r--examples/network/torrent/icons/edit_remove.pngbin0 -> 368 bytes-rw-r--r--examples/network/torrent/icons/exit.pngbin0 -> 1426 bytes-rw-r--r--examples/network/torrent/icons/peertopeer.pngbin0 -> 10072 bytes-rw-r--r--examples/network/torrent/icons/player_pause.pngbin0 -> 690 bytes-rw-r--r--examples/network/torrent/icons/player_play.pngbin0 -> 900 bytes-rw-r--r--examples/network/torrent/icons/player_stop.pngbin0 -> 627 bytes-rw-r--r--examples/network/torrent/icons/stop.pngbin0 -> 1252 bytes-rw-r--r--examples/network/torrent/main.cpp57
-rw-r--r--examples/network/torrent/mainwindow.cpp713
-rw-r--r--examples/network/torrent/mainwindow.h132
-rw-r--r--examples/network/torrent/metainfo.cpp218
-rw-r--r--examples/network/torrent/metainfo.h122
-rw-r--r--examples/network/torrent/peerwireclient.cpp665
-rw-r--r--examples/network/torrent/peerwireclient.h210
-rw-r--r--examples/network/torrent/ratecontroller.cpp156
-rw-r--r--examples/network/torrent/ratecontroller.h80
-rw-r--r--examples/network/torrent/torrent.pro37
-rw-r--r--examples/network/torrent/torrentclient.cpp1529
-rw-r--r--examples/network/torrent/torrentclient.h205
-rw-r--r--examples/network/torrent/torrentserver.cpp104
-rw-r--r--examples/network/torrent/torrentserver.h72
-rw-r--r--examples/network/torrent/trackerclient.cpp237
-rw-r--r--examples/network/torrent/trackerclient.h104
-rw-r--r--examples/opengl/2dpainting/2dpainting.pro17
-rw-r--r--examples/opengl/2dpainting/glwidget.cpp73
-rw-r--r--examples/opengl/2dpainting/glwidget.h73
-rw-r--r--examples/opengl/2dpainting/helper.cpp91
-rw-r--r--examples/opengl/2dpainting/helper.h72
-rw-r--r--examples/opengl/2dpainting/main.cpp51
-rw-r--r--examples/opengl/2dpainting/widget.cpp73
-rw-r--r--examples/opengl/2dpainting/widget.h72
-rw-r--r--examples/opengl/2dpainting/window.cpp72
-rw-r--r--examples/opengl/2dpainting/window.h67
-rw-r--r--examples/opengl/README41
-rw-r--r--examples/opengl/framebufferobject/bubbles.svg215
-rw-r--r--examples/opengl/framebufferobject/designer.pngbin0 -> 2810 bytes-rw-r--r--examples/opengl/framebufferobject/framebufferobject.pro22
-rw-r--r--examples/opengl/framebufferobject/framebufferobject.qrc6
-rw-r--r--examples/opengl/framebufferobject/glwidget.cpp309
-rw-r--r--examples/opengl/framebufferobject/glwidget.h82
-rw-r--r--examples/opengl/framebufferobject/main.cpp62
-rw-r--r--examples/opengl/framebufferobject2/cubelogo.pngbin0 -> 5920 bytes-rw-r--r--examples/opengl/framebufferobject2/framebufferobject2.pro11
-rw-r--r--examples/opengl/framebufferobject2/framebufferobject2.qrc5
-rw-r--r--examples/opengl/framebufferobject2/glwidget.cpp249
-rw-r--r--examples/opengl/framebufferobject2/glwidget.h66
-rw-r--r--examples/opengl/framebufferobject2/main.cpp62
-rw-r--r--examples/opengl/grabber/glwidget.cpp284
-rw-r--r--examples/opengl/grabber/glwidget.h98
-rw-r--r--examples/opengl/grabber/grabber.pro12
-rw-r--r--examples/opengl/grabber/main.cpp52
-rw-r--r--examples/opengl/grabber/mainwindow.cpp207
-rw-r--r--examples/opengl/grabber/mainwindow.h95
-rw-r--r--examples/opengl/hellogl/glwidget.cpp266
-rw-r--r--examples/opengl/hellogl/glwidget.h99
-rw-r--r--examples/opengl/hellogl/hellogl.pro12
-rw-r--r--examples/opengl/hellogl/main.cpp52
-rw-r--r--examples/opengl/hellogl/window.cpp90
-rw-r--r--examples/opengl/hellogl/window.h70
-rw-r--r--examples/opengl/hellogl_es/bubble.cpp140
-rw-r--r--examples/opengl/hellogl_es/bubble.h77
-rw-r--r--examples/opengl/hellogl_es/cl_helper.h133
-rw-r--r--examples/opengl/hellogl_es/glwidget.cpp457
-rw-r--r--examples/opengl/hellogl_es/glwidget.h87
-rw-r--r--examples/opengl/hellogl_es/hellogl_es.pro34
-rw-r--r--examples/opengl/hellogl_es/main.cpp53
-rw-r--r--examples/opengl/hellogl_es/mainwindow.cpp108
-rw-r--r--examples/opengl/hellogl_es/mainwindow.h60
-rw-r--r--examples/opengl/hellogl_es/qt.pngbin0 -> 5174 bytes-rw-r--r--examples/opengl/hellogl_es/texture.qrc5
-rw-r--r--examples/opengl/hellogl_es2/bubble.cpp140
-rw-r--r--examples/opengl/hellogl_es2/bubble.h77
-rw-r--r--examples/opengl/hellogl_es2/glwidget.cpp642
-rw-r--r--examples/opengl/hellogl_es2/glwidget.h94
-rw-r--r--examples/opengl/hellogl_es2/hellogl_es2.pro27
-rw-r--r--examples/opengl/hellogl_es2/main.cpp53
-rw-r--r--examples/opengl/hellogl_es2/mainwindow.cpp108
-rw-r--r--examples/opengl/hellogl_es2/mainwindow.h60
-rw-r--r--examples/opengl/hellogl_es2/qt.pngbin0 -> 5174 bytes-rw-r--r--examples/opengl/hellogl_es2/texture.qrc5
-rw-r--r--examples/opengl/opengl.pro29
-rw-r--r--examples/opengl/overpainting/bubble.cpp113
-rw-r--r--examples/opengl/overpainting/bubble.h76
-rw-r--r--examples/opengl/overpainting/glwidget.cpp360
-rw-r--r--examples/opengl/overpainting/glwidget.h114
-rw-r--r--examples/opengl/overpainting/main.cpp51
-rw-r--r--examples/opengl/overpainting/overpainting.pro13
-rw-r--r--examples/opengl/pbuffers/cubelogo.pngbin0 -> 5920 bytes-rw-r--r--examples/opengl/pbuffers/glwidget.cpp260
-rw-r--r--examples/opengl/pbuffers/glwidget.h70
-rw-r--r--examples/opengl/pbuffers/main.cpp62
-rw-r--r--examples/opengl/pbuffers/pbuffers.pro11
-rw-r--r--examples/opengl/pbuffers/pbuffers.qrc5
-rw-r--r--examples/opengl/pbuffers2/bubbles.svg215
-rw-r--r--examples/opengl/pbuffers2/designer.pngbin0 -> 2810 bytes-rw-r--r--examples/opengl/pbuffers2/glwidget.cpp326
-rw-r--r--examples/opengl/pbuffers2/glwidget.h85
-rw-r--r--examples/opengl/pbuffers2/main.cpp62
-rw-r--r--examples/opengl/pbuffers2/pbuffers2.pro21
-rw-r--r--examples/opengl/pbuffers2/pbuffers2.qrc6
-rw-r--r--examples/opengl/samplebuffers/glwidget.cpp165
-rw-r--r--examples/opengl/samplebuffers/glwidget.h62
-rw-r--r--examples/opengl/samplebuffers/main.cpp72
-rw-r--r--examples/opengl/samplebuffers/samplebuffers.pro10
-rw-r--r--examples/opengl/textures/glwidget.cpp182
-rw-r--r--examples/opengl/textures/glwidget.h84
-rw-r--r--examples/opengl/textures/images/side1.pngbin0 -> 935 bytes-rw-r--r--examples/opengl/textures/images/side2.pngbin0 -> 1622 bytes-rw-r--r--examples/opengl/textures/images/side3.pngbin0 -> 2117 bytes-rw-r--r--examples/opengl/textures/images/side4.pngbin0 -> 1222 bytes-rw-r--r--examples/opengl/textures/images/side5.pngbin0 -> 1806 bytes-rw-r--r--examples/opengl/textures/images/side6.pngbin0 -> 2215 bytes-rw-r--r--examples/opengl/textures/main.cpp54
-rw-r--r--examples/opengl/textures/textures.pro13
-rw-r--r--examples/opengl/textures/textures.qrc10
-rw-r--r--examples/opengl/textures/window.cpp89
-rw-r--r--examples/opengl/textures/window.h67
-rw-r--r--examples/painting/README42
-rw-r--r--examples/painting/basicdrawing/basicdrawing.pro12
-rw-r--r--examples/painting/basicdrawing/basicdrawing.qrc6
-rw-r--r--examples/painting/basicdrawing/images/brick.pngbin0 -> 767 bytes-rw-r--r--examples/painting/basicdrawing/images/qt-logo.pngbin0 -> 3696 bytes-rw-r--r--examples/painting/basicdrawing/main.cpp54
-rw-r--r--examples/painting/basicdrawing/renderarea.cpp209
-rw-r--r--examples/painting/basicdrawing/renderarea.h84
-rw-r--r--examples/painting/basicdrawing/window.cpp262
-rw-r--r--examples/painting/basicdrawing/window.h88
-rw-r--r--examples/painting/concentriccircles/circlewidget.cpp125
-rw-r--r--examples/painting/concentriccircles/circlewidget.h74
-rw-r--r--examples/painting/concentriccircles/concentriccircles.pro11
-rw-r--r--examples/painting/concentriccircles/main.cpp52
-rw-r--r--examples/painting/concentriccircles/window.cpp94
-rw-r--r--examples/painting/concentriccircles/window.h71
-rw-r--r--examples/painting/fontsampler/fontsampler.pro10
-rw-r--r--examples/painting/fontsampler/main.cpp52
-rw-r--r--examples/painting/fontsampler/mainwindow.cpp373
-rw-r--r--examples/painting/fontsampler/mainwindow.h83
-rw-r--r--examples/painting/fontsampler/mainwindowbase.ui140
-rw-r--r--examples/painting/imagecomposition/imagecomposer.cpp209
-rw-r--r--examples/painting/imagecomposition/imagecomposer.h88
-rw-r--r--examples/painting/imagecomposition/imagecomposition.pro11
-rw-r--r--examples/painting/imagecomposition/imagecomposition.qrc6
-rw-r--r--examples/painting/imagecomposition/images/background.pngbin0 -> 18579 bytes-rw-r--r--examples/painting/imagecomposition/images/blackrectangle.pngbin0 -> 90 bytes-rw-r--r--examples/painting/imagecomposition/images/butterfly.pngbin0 -> 36868 bytes-rw-r--r--examples/painting/imagecomposition/images/checker.pngbin0 -> 10384 bytes-rw-r--r--examples/painting/imagecomposition/main.cpp56
-rw-r--r--examples/painting/painterpaths/main.cpp52
-rw-r--r--examples/painting/painterpaths/painterpaths.pro12
-rw-r--r--examples/painting/painterpaths/renderarea.cpp131
-rw-r--r--examples/painting/painterpaths/renderarea.h81
-rw-r--r--examples/painting/painterpaths/window.cpp289
-rw-r--r--examples/painting/painterpaths/window.h93
-rw-r--r--examples/painting/painting.pro16
-rw-r--r--examples/painting/svgviewer/files/bubbles.svg215
-rw-r--r--examples/painting/svgviewer/files/cubic.svg77
-rw-r--r--examples/painting/svgviewer/files/spheres.svg72
-rw-r--r--examples/painting/svgviewer/main.cpp63
-rw-r--r--examples/painting/svgviewer/mainwindow.cpp164
-rw-r--r--examples/painting/svgviewer/mainwindow.h81
-rw-r--r--examples/painting/svgviewer/svgview.cpp188
-rw-r--r--examples/painting/svgviewer/svgview.h84
-rw-r--r--examples/painting/svgviewer/svgviewer.pro23
-rw-r--r--examples/painting/svgviewer/svgviewer.qrc6
-rw-r--r--examples/painting/transformations/main.cpp52
-rw-r--r--examples/painting/transformations/renderarea.cpp173
-rw-r--r--examples/painting/transformations/renderarea.h91
-rw-r--r--examples/painting/transformations/transformations.pro11
-rw-r--r--examples/painting/transformations/window.cpp181
-rw-r--r--examples/painting/transformations/window.h81
-rw-r--r--examples/phonon/README39
-rw-r--r--examples/phonon/capabilities/capabilities.pro16
-rw-r--r--examples/phonon/capabilities/main.cpp58
-rw-r--r--examples/phonon/capabilities/window.cpp166
-rw-r--r--examples/phonon/capabilities/window.h97
-rw-r--r--examples/phonon/musicplayer/main.cpp57
-rw-r--r--examples/phonon/musicplayer/mainwindow.cpp352
-rw-r--r--examples/phonon/musicplayer/mainwindow.h112
-rw-r--r--examples/phonon/musicplayer/musicplayer.pro16
-rw-r--r--examples/phonon/phonon.pro10
-rw-r--r--examples/qmake/precompile/main.cpp61
-rw-r--r--examples/qmake/precompile/mydialog.cpp48
-rw-r--r--examples/qmake/precompile/mydialog.h55
-rw-r--r--examples/qmake/precompile/mydialog.ui47
-rw-r--r--examples/qmake/precompile/myobject.cpp58
-rw-r--r--examples/qmake/precompile/myobject.h56
-rw-r--r--examples/qmake/precompile/precompile.pro22
-rw-r--r--examples/qmake/precompile/stable.h53
-rw-r--r--examples/qmake/precompile/util.cpp50
-rw-r--r--examples/qmake/tutorial/hello.cpp50
-rw-r--r--examples/qmake/tutorial/hello.h48
-rw-r--r--examples/qmake/tutorial/hellounix.cpp43
-rw-r--r--examples/qmake/tutorial/hellowin.cpp43
-rw-r--r--examples/qmake/tutorial/main.cpp54
-rw-r--r--examples/qtconcurrent/README38
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.cpp147
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.h82
-rw-r--r--examples/qtconcurrent/imagescaling/imagescaling.pro13
-rw-r--r--examples/qtconcurrent/imagescaling/main.cpp64
-rw-r--r--examples/qtconcurrent/map/main.cpp82
-rw-r--r--examples/qtconcurrent/map/map.pro14
-rw-r--r--examples/qtconcurrent/progressdialog/main.cpp100
-rw-r--r--examples/qtconcurrent/progressdialog/progressdialog.pro14
-rw-r--r--examples/qtconcurrent/qtconcurrent.pro12
-rw-r--r--examples/qtconcurrent/runfunction/main.cpp73
-rw-r--r--examples/qtconcurrent/runfunction/runfunction.pro14
-rw-r--r--examples/qtconcurrent/wordcount/main.cpp167
-rw-r--r--examples/qtconcurrent/wordcount/wordcount.pro14
-rw-r--r--examples/qtestlib/README38
-rw-r--r--examples/qtestlib/qtestlib.pro8
-rw-r--r--examples/qtestlib/tutorial1/testqstring.cpp65
-rw-r--r--examples/qtestlib/tutorial1/tutorial1.pro8
-rw-r--r--examples/qtestlib/tutorial2/testqstring.cpp81
-rw-r--r--examples/qtestlib/tutorial2/tutorial2.pro8
-rw-r--r--examples/qtestlib/tutorial3/testgui.cpp71
-rw-r--r--examples/qtestlib/tutorial3/tutorial3.pro8
-rw-r--r--examples/qtestlib/tutorial4/testgui.cpp91
-rw-r--r--examples/qtestlib/tutorial4/tutorial4.pro8
-rw-r--r--examples/qtestlib/tutorial5/benchmarking.cpp135
-rw-r--r--examples/qtestlib/tutorial5/tutorial5.pro8
-rw-r--r--examples/qws/README38
-rw-r--r--examples/qws/ahigl/ahigl.pro16
-rw-r--r--examples/qws/ahigl/qscreenahigl_qws.cpp963
-rw-r--r--examples/qws/ahigl/qscreenahigl_qws.h91
-rw-r--r--examples/qws/ahigl/qscreenahiglplugin.cpp97
-rw-r--r--examples/qws/ahigl/qwindowsurface_ahigl.cpp349
-rw-r--r--examples/qws/ahigl/qwindowsurface_ahigl_p.h92
-rw-r--r--examples/qws/dbscreen/dbscreen.cpp99
-rw-r--r--examples/qws/dbscreen/dbscreen.h70
-rw-r--r--examples/qws/dbscreen/dbscreen.pro11
-rw-r--r--examples/qws/dbscreen/dbscreendriverplugin.cpp80
-rw-r--r--examples/qws/framebuffer/framebuffer.pro11
-rw-r--r--examples/qws/framebuffer/main.c586
-rw-r--r--examples/qws/mousecalibration/calibration.cpp145
-rw-r--r--examples/qws/mousecalibration/calibration.h68
-rw-r--r--examples/qws/mousecalibration/main.cpp93
-rw-r--r--examples/qws/mousecalibration/mousecalibration.pro11
-rw-r--r--examples/qws/mousecalibration/scribblewidget.cpp93
-rw-r--r--examples/qws/mousecalibration/scribblewidget.h71
-rw-r--r--examples/qws/qws.pro7
-rw-r--r--examples/qws/simpledecoration/analogclock.cpp111
-rw-r--r--examples/qws/simpledecoration/analogclock.h58
-rw-r--r--examples/qws/simpledecoration/main.cpp60
-rw-r--r--examples/qws/simpledecoration/mydecoration.cpp375
-rw-r--r--examples/qws/simpledecoration/mydecoration.h73
-rw-r--r--examples/qws/simpledecoration/simpledecoration.pro12
-rw-r--r--examples/qws/svgalib/README5
-rw-r--r--examples/qws/svgalib/svgalib.pro19
-rw-r--r--examples/qws/svgalib/svgalibpaintdevice.cpp67
-rw-r--r--examples/qws/svgalib/svgalibpaintdevice.h66
-rw-r--r--examples/qws/svgalib/svgalibpaintengine.cpp192
-rw-r--r--examples/qws/svgalib/svgalibpaintengine.h79
-rw-r--r--examples/qws/svgalib/svgalibplugin.cpp75
-rw-r--r--examples/qws/svgalib/svgalibscreen.cpp354
-rw-r--r--examples/qws/svgalib/svgalibscreen.h84
-rw-r--r--examples/qws/svgalib/svgalibsurface.cpp87
-rw-r--r--examples/qws/svgalib/svgalibsurface.h76
-rw-r--r--examples/richtext/README42
-rw-r--r--examples/richtext/calendar/calendar.pro9
-rw-r--r--examples/richtext/calendar/main.cpp53
-rw-r--r--examples/richtext/calendar/mainwindow.cpp215
-rw-r--r--examples/richtext/calendar/mainwindow.h74
-rw-r--r--examples/richtext/orderform/detailsdialog.cpp157
-rw-r--r--examples/richtext/orderform/detailsdialog.h91
-rw-r--r--examples/richtext/orderform/main.cpp56
-rw-r--r--examples/richtext/orderform/mainwindow.cpp250
-rw-r--r--examples/richtext/orderform/mainwindow.h77
-rw-r--r--examples/richtext/orderform/orderform.pro11
-rw-r--r--examples/richtext/richtext.pro12
-rw-r--r--examples/richtext/syntaxhighlighter/highlighter.cpp148
-rw-r--r--examples/richtext/syntaxhighlighter/highlighter.h85
-rw-r--r--examples/richtext/syntaxhighlighter/main.cpp53
-rw-r--r--examples/richtext/syntaxhighlighter/mainwindow.cpp130
-rw-r--r--examples/richtext/syntaxhighlighter/mainwindow.h76
-rw-r--r--examples/richtext/syntaxhighlighter/syntaxhighlighter.pro17
-rw-r--r--examples/richtext/textobject/files/heart.svg55
-rw-r--r--examples/richtext/textobject/main.cpp55
-rw-r--r--examples/richtext/textobject/svgtextobject.cpp72
-rw-r--r--examples/richtext/textobject/svgtextobject.h70
-rw-r--r--examples/richtext/textobject/textobject.pro14
-rw-r--r--examples/richtext/textobject/window.cpp117
-rw-r--r--examples/richtext/textobject/window.h81
-rw-r--r--examples/script/README40
-rw-r--r--examples/script/calculator/calculator.js264
-rw-r--r--examples/script/calculator/calculator.pro12
-rw-r--r--examples/script/calculator/calculator.qrc6
-rw-r--r--examples/script/calculator/calculator.ui406
-rw-r--r--examples/script/calculator/main.cpp101
-rw-r--r--examples/script/context2d/context2d.cpp825
-rw-r--r--examples/script/context2d/context2d.h261
-rw-r--r--examples/script/context2d/context2d.pro23
-rw-r--r--examples/script/context2d/context2d.qrc5
-rw-r--r--examples/script/context2d/domimage.cpp157
-rw-r--r--examples/script/context2d/domimage.h87
-rw-r--r--examples/script/context2d/environment.cpp561
-rw-r--r--examples/script/context2d/environment.h145
-rw-r--r--examples/script/context2d/main.cpp53
-rw-r--r--examples/script/context2d/qcontext2dcanvas.cpp143
-rw-r--r--examples/script/context2d/qcontext2dcanvas.h98
-rw-r--r--examples/script/context2d/scripts/alpha.js21
-rw-r--r--examples/script/context2d/scripts/arc.js30
-rw-r--r--examples/script/context2d/scripts/bezier.js26
-rw-r--r--examples/script/context2d/scripts/clock.js99
-rw-r--r--examples/script/context2d/scripts/fill1.js8
-rw-r--r--examples/script/context2d/scripts/grad.js20
-rw-r--r--examples/script/context2d/scripts/linecap.js24
-rw-r--r--examples/script/context2d/scripts/linestye.js10
-rw-r--r--examples/script/context2d/scripts/moveto.js20
-rw-r--r--examples/script/context2d/scripts/moveto2.js24
-rw-r--r--examples/script/context2d/scripts/pacman.js83
-rw-r--r--examples/script/context2d/scripts/plasma.js58
-rw-r--r--examples/script/context2d/scripts/pong.js235
-rw-r--r--examples/script/context2d/scripts/quad.js21
-rw-r--r--examples/script/context2d/scripts/rgba.js19
-rw-r--r--examples/script/context2d/scripts/rotate.js16
-rw-r--r--examples/script/context2d/scripts/scale.js67
-rw-r--r--examples/script/context2d/scripts/stroke1.js10
-rw-r--r--examples/script/context2d/scripts/translate.js29
-rw-r--r--examples/script/context2d/window.cpp174
-rw-r--r--examples/script/context2d/window.h81
-rw-r--r--examples/script/customclass/bytearrayclass.cpp304
-rw-r--r--examples/script/customclass/bytearrayclass.h90
-rw-r--r--examples/script/customclass/bytearrayclass.pri6
-rw-r--r--examples/script/customclass/bytearrayprototype.cpp136
-rw-r--r--examples/script/customclass/bytearrayprototype.h80
-rw-r--r--examples/script/customclass/customclass.pro13
-rw-r--r--examples/script/customclass/main.cpp70
-rw-r--r--examples/script/defaultprototypes/code.js20
-rw-r--r--examples/script/defaultprototypes/defaultprototypes.pro10
-rw-r--r--examples/script/defaultprototypes/defaultprototypes.qrc5
-rw-r--r--examples/script/defaultprototypes/main.cpp84
-rw-r--r--examples/script/defaultprototypes/prototypes.cpp110
-rw-r--r--examples/script/defaultprototypes/prototypes.h78
-rw-r--r--examples/script/helloscript/helloscript.pro9
-rw-r--r--examples/script/helloscript/helloscript.qrc5
-rw-r--r--examples/script/helloscript/helloscript.qs5
-rw-r--r--examples/script/helloscript/main.cpp97
-rw-r--r--examples/script/marshal/main.cpp106
-rw-r--r--examples/script/marshal/marshal.pro9
-rw-r--r--examples/script/qscript/main.cpp221
-rw-r--r--examples/script/qscript/qscript.pro14
-rw-r--r--examples/script/qsdbg/example.qs17
-rw-r--r--examples/script/qsdbg/main.cpp74
-rw-r--r--examples/script/qsdbg/qsdbg.pri9
-rw-r--r--examples/script/qsdbg/qsdbg.pro19
-rw-r--r--examples/script/qsdbg/scriptbreakpointmanager.cpp159
-rw-r--r--examples/script/qsdbg/scriptbreakpointmanager.h122
-rw-r--r--examples/script/qsdbg/scriptdebugger.cpp737
-rw-r--r--examples/script/qsdbg/scriptdebugger.h85
-rw-r--r--examples/script/qstetrix/main.cpp142
-rw-r--r--examples/script/qstetrix/qstetrix.pro17
-rw-r--r--examples/script/qstetrix/tetrix.qrc8
-rw-r--r--examples/script/qstetrix/tetrixboard.cpp139
-rw-r--r--examples/script/qstetrix/tetrixboard.h102
-rw-r--r--examples/script/qstetrix/tetrixboard.js261
-rw-r--r--examples/script/qstetrix/tetrixpiece.js131
-rw-r--r--examples/script/qstetrix/tetrixwindow.js16
-rw-r--r--examples/script/qstetrix/tetrixwindow.ui175
-rw-r--r--examples/script/script.pro11
-rw-r--r--examples/sql/README40
-rw-r--r--examples/sql/cachedtable/cachedtable.pro11
-rw-r--r--examples/sql/cachedtable/main.cpp58
-rw-r--r--examples/sql/cachedtable/tableeditor.cpp106
-rw-r--r--examples/sql/cachedtable/tableeditor.h73
-rw-r--r--examples/sql/connection.h136
-rw-r--r--examples/sql/drilldown/drilldown.pro16
-rw-r--r--examples/sql/drilldown/drilldown.qrc11
-rw-r--r--examples/sql/drilldown/imageitem.cpp124
-rw-r--r--examples/sql/drilldown/imageitem.h75
-rw-r--r--examples/sql/drilldown/images/beijing.pngbin0 -> 99093 bytes-rw-r--r--examples/sql/drilldown/images/berlin.pngbin0 -> 81944 bytes-rw-r--r--examples/sql/drilldown/images/brisbane.pngbin0 -> 57785 bytes-rw-r--r--examples/sql/drilldown/images/munich.pngbin0 -> 59769 bytes-rw-r--r--examples/sql/drilldown/images/oslo.pngbin0 -> 41781 bytes-rw-r--r--examples/sql/drilldown/images/redwood.pngbin0 -> 39050 bytes-rw-r--r--examples/sql/drilldown/informationwindow.cpp170
-rw-r--r--examples/sql/drilldown/informationwindow.h91
-rw-r--r--examples/sql/drilldown/logo.pngbin0 -> 13378 bytes-rw-r--r--examples/sql/drilldown/main.cpp59
-rw-r--r--examples/sql/drilldown/view.cpp179
-rw-r--r--examples/sql/drilldown/view.h81
-rw-r--r--examples/sql/masterdetail/albumdetails.xml98
-rw-r--r--examples/sql/masterdetail/database.h97
-rw-r--r--examples/sql/masterdetail/dialog.cpp283
-rw-r--r--examples/sql/masterdetail/dialog.h83
-rw-r--r--examples/sql/masterdetail/images/icon.pngbin0 -> 30095 bytes-rw-r--r--examples/sql/masterdetail/images/image.pngbin0 -> 166692 bytes-rw-r--r--examples/sql/masterdetail/main.cpp60
-rw-r--r--examples/sql/masterdetail/mainwindow.cpp430
-rw-r--r--examples/sql/masterdetail/mainwindow.h104
-rw-r--r--examples/sql/masterdetail/masterdetail.pro16
-rw-r--r--examples/sql/masterdetail/masterdetail.qrc6
-rw-r--r--examples/sql/querymodel/customsqlmodel.cpp65
-rw-r--r--examples/sql/querymodel/customsqlmodel.h59
-rw-r--r--examples/sql/querymodel/editablesqlmodel.cpp110
-rw-r--r--examples/sql/querymodel/editablesqlmodel.h63
-rw-r--r--examples/sql/querymodel/main.cpp87
-rw-r--r--examples/sql/querymodel/querymodel.pro13
-rw-r--r--examples/sql/relationaltablemodel/relationaltablemodel.cpp115
-rw-r--r--examples/sql/relationaltablemodel/relationaltablemodel.pro9
-rw-r--r--examples/sql/sql.pro12
-rw-r--r--examples/sql/sqlwidgetmapper/main.cpp52
-rw-r--r--examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro10
-rw-r--r--examples/sql/sqlwidgetmapper/window.cpp159
-rw-r--r--examples/sql/sqlwidgetmapper/window.h90
-rw-r--r--examples/sql/tablemodel/tablemodel.cpp84
-rw-r--r--examples/sql/tablemodel/tablemodel.pro9
-rw-r--r--examples/threads/README40
-rw-r--r--examples/threads/mandelbrot/main.cpp54
-rw-r--r--examples/threads/mandelbrot/mandelbrot.pro13
-rw-r--r--examples/threads/mandelbrot/mandelbrotwidget.cpp240
-rw-r--r--examples/threads/mandelbrot/mandelbrotwidget.h85
-rw-r--r--examples/threads/mandelbrot/renderthread.cpp216
-rw-r--r--examples/threads/mandelbrot/renderthread.h89
-rw-r--r--examples/threads/queuedcustomtype/block.cpp74
-rw-r--r--examples/threads/queuedcustomtype/block.h71
-rw-r--r--examples/threads/queuedcustomtype/main.cpp129
-rw-r--r--examples/threads/queuedcustomtype/queuedcustomtype.pro7
-rw-r--r--examples/threads/queuedcustomtype/renderthread.cpp110
-rw-r--r--examples/threads/queuedcustomtype/renderthread.h77
-rw-r--r--examples/threads/queuedcustomtype/window.cpp137
-rw-r--r--examples/threads/queuedcustomtype/window.h77
-rw-r--r--examples/threads/semaphores/semaphores.cpp107
-rw-r--r--examples/threads/semaphores/semaphores.pro10
-rw-r--r--examples/threads/threads.pro10
-rw-r--r--examples/threads/waitconditions/waitconditions.cpp126
-rw-r--r--examples/threads/waitconditions/waitconditions.pro20
-rw-r--r--examples/tools/README40
-rw-r--r--examples/tools/codecs/codecs.pro11
-rw-r--r--examples/tools/codecs/encodedfiles/.gitattributes2
-rw-r--r--examples/tools/codecs/encodedfiles/iso-8859-1.txt6
-rw-r--r--examples/tools/codecs/encodedfiles/iso-8859-15.txt8
-rw-r--r--examples/tools/codecs/encodedfiles/utf-16.txtbin0 -> 162 bytes-rw-r--r--examples/tools/codecs/encodedfiles/utf-16be.txtbin0 -> 160 bytes-rw-r--r--examples/tools/codecs/encodedfiles/utf-16le.txtbin0 -> 160 bytes-rw-r--r--examples/tools/codecs/encodedfiles/utf-8.txt6
-rw-r--r--examples/tools/codecs/main.cpp52
-rw-r--r--examples/tools/codecs/mainwindow.cpp203
-rw-r--r--examples/tools/codecs/mainwindow.h88
-rw-r--r--examples/tools/codecs/previewform.cpp102
-rw-r--r--examples/tools/codecs/previewform.h80
-rw-r--r--examples/tools/completer/completer.pro12
-rw-r--r--examples/tools/completer/completer.qrc6
-rw-r--r--examples/tools/completer/dirmodel.cpp63
-rw-r--r--examples/tools/completer/dirmodel.h61
-rw-r--r--examples/tools/completer/main.cpp55
-rw-r--r--examples/tools/completer/mainwindow.cpp264
-rw-r--r--examples/tools/completer/mainwindow.h87
-rw-r--r--examples/tools/completer/resources/countries.txt241
-rw-r--r--examples/tools/completer/resources/wordlist.txt1486
-rw-r--r--examples/tools/customcompleter/customcompleter.pro12
-rw-r--r--examples/tools/customcompleter/customcompleter.qrc5
-rw-r--r--examples/tools/customcompleter/main.cpp55
-rw-r--r--examples/tools/customcompleter/mainwindow.cpp118
-rw-r--r--examples/tools/customcompleter/mainwindow.h77
-rw-r--r--examples/tools/customcompleter/resources/wordlist.txt1455
-rw-r--r--examples/tools/customcompleter/textedit.cpp174
-rw-r--r--examples/tools/customcompleter/textedit.h79
-rw-r--r--examples/tools/customtype/customtype.pro3
-rw-r--r--examples/tools/customtype/main.cpp74
-rw-r--r--examples/tools/customtype/message.cpp90
-rw-r--r--examples/tools/customtype/message.h76
-rw-r--r--examples/tools/customtypesending/customtypesending.pro5
-rw-r--r--examples/tools/customtypesending/main.cpp68
-rw-r--r--examples/tools/customtypesending/message.cpp72
-rw-r--r--examples/tools/customtypesending/message.h72
-rw-r--r--examples/tools/customtypesending/window.cpp80
-rw-r--r--examples/tools/customtypesending/window.h73
-rw-r--r--examples/tools/echoplugin/echoplugin.pro11
-rw-r--r--examples/tools/echoplugin/echowindow/echointerface.h62
-rw-r--r--examples/tools/echoplugin/echowindow/echowindow.cpp119
-rw-r--r--examples/tools/echoplugin/echowindow/echowindow.h80
-rw-r--r--examples/tools/echoplugin/echowindow/echowindow.pro18
-rw-r--r--examples/tools/echoplugin/echowindow/main.cpp57
-rw-r--r--examples/tools/echoplugin/plugin/echoplugin.cpp55
-rw-r--r--examples/tools/echoplugin/plugin/echoplugin.h60
-rw-r--r--examples/tools/echoplugin/plugin/plugin.pro15
-rw-r--r--examples/tools/i18n/i18n.pro26
-rw-r--r--examples/tools/i18n/i18n.qrc18
-rw-r--r--examples/tools/i18n/languagechooser.cpp167
-rw-r--r--examples/tools/i18n/languagechooser.h86
-rw-r--r--examples/tools/i18n/main.cpp55
-rw-r--r--examples/tools/i18n/mainwindow.cpp96
-rw-r--r--examples/tools/i18n/mainwindow.h77
-rw-r--r--examples/tools/i18n/translations/i18n_ar.qmbin0 -> 736 bytes-rw-r--r--examples/tools/i18n/translations/i18n_ar.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_cs.qmbin0 -> 796 bytes-rw-r--r--examples/tools/i18n/translations/i18n_cs.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_de.qmbin0 -> 848 bytes-rw-r--r--examples/tools/i18n/translations/i18n_de.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_el.qmbin0 -> 804 bytes-rw-r--r--examples/tools/i18n/translations/i18n_el.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_en.qmbin0 -> 810 bytes-rw-r--r--examples/tools/i18n/translations/i18n_en.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_eo.qmbin0 -> 806 bytes-rw-r--r--examples/tools/i18n/translations/i18n_eo.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_fr.qmbin0 -> 844 bytes-rw-r--r--examples/tools/i18n/translations/i18n_fr.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_it.qmbin0 -> 808 bytes-rw-r--r--examples/tools/i18n/translations/i18n_it.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_jp.qmbin0 -> 722 bytes-rw-r--r--examples/tools/i18n/translations/i18n_jp.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_ko.qmbin0 -> 690 bytes-rw-r--r--examples/tools/i18n/translations/i18n_ko.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_no.qmbin0 -> 804 bytes-rw-r--r--examples/tools/i18n/translations/i18n_no.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_ru.qmbin0 -> 806 bytes-rw-r--r--examples/tools/i18n/translations/i18n_ru.ts59
-rw-r--r--examples/tools/i18n/translations/i18n_sv.qmbin0 -> 814 bytes-rw-r--r--examples/tools/i18n/translations/i18n_sv.ts57
-rw-r--r--examples/tools/i18n/translations/i18n_zh.qmbin0 -> 700 bytes-rw-r--r--examples/tools/i18n/translations/i18n_zh.ts57
-rw-r--r--examples/tools/plugandpaint/interfaces.h111
-rw-r--r--examples/tools/plugandpaint/main.cpp58
-rw-r--r--examples/tools/plugandpaint/mainwindow.cpp310
-rw-r--r--examples/tools/plugandpaint/mainwindow.h104
-rw-r--r--examples/tools/plugandpaint/paintarea.cpp196
-rw-r--r--examples/tools/plugandpaint/paintarea.h92
-rw-r--r--examples/tools/plugandpaint/plugandpaint.pro22
-rw-r--r--examples/tools/plugandpaint/plugindialog.cpp157
-rw-r--r--examples/tools/plugandpaint/plugindialog.h77
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictools.pro15
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictoolsplugin.cpp198
-rw-r--r--examples/tools/plugandpaintplugins/basictools/basictoolsplugin.h88
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafilters.pro15
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.cpp125
-rw-r--r--examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h64
-rw-r--r--examples/tools/plugandpaintplugins/plugandpaintplugins.pro9
-rw-r--r--examples/tools/regexp/main.cpp52
-rw-r--r--examples/tools/regexp/regexp.pro9
-rw-r--r--examples/tools/regexp/regexpdialog.cpp188
-rw-r--r--examples/tools/regexp/regexpdialog.h86
-rw-r--r--examples/tools/settingseditor/inifiles/licensepage.ini46
-rw-r--r--examples/tools/settingseditor/inifiles/qsa.ini26
-rw-r--r--examples/tools/settingseditor/locationdialog.cpp217
-rw-r--r--examples/tools/settingseditor/locationdialog.h85
-rw-r--r--examples/tools/settingseditor/main.cpp52
-rw-r--r--examples/tools/settingseditor/mainwindow.cpp223
-rw-r--r--examples/tools/settingseditor/mainwindow.h92
-rw-r--r--examples/tools/settingseditor/settingseditor.pro15
-rw-r--r--examples/tools/settingseditor/settingstree.cpp263
-rw-r--r--examples/tools/settingseditor/settingstree.h91
-rw-r--r--examples/tools/settingseditor/variantdelegate.cpp317
-rw-r--r--examples/tools/settingseditor/variantdelegate.h82
-rw-r--r--examples/tools/styleplugin/plugin/plugin.pro21
-rw-r--r--examples/tools/styleplugin/plugin/simplestyle.cpp49
-rw-r--r--examples/tools/styleplugin/plugin/simplestyle.h61
-rw-r--r--examples/tools/styleplugin/plugin/simplestyleplugin.cpp65
-rw-r--r--examples/tools/styleplugin/plugin/simplestyleplugin.h65
-rw-r--r--examples/tools/styleplugin/styleplugin.pro9
-rw-r--r--examples/tools/styleplugin/stylewindow/main.cpp58
-rw-r--r--examples/tools/styleplugin/stylewindow/stylewindow.cpp61
-rw-r--r--examples/tools/styleplugin/stylewindow/stylewindow.h55
-rw-r--r--examples/tools/styleplugin/stylewindow/stylewindow.pro17
-rw-r--r--examples/tools/tools.pro22
-rw-r--r--examples/tools/treemodelcompleter/main.cpp55
-rw-r--r--examples/tools/treemodelcompleter/mainwindow.cpp247
-rw-r--r--examples/tools/treemodelcompleter/mainwindow.h89
-rw-r--r--examples/tools/treemodelcompleter/resources/treemodel.txt20
-rw-r--r--examples/tools/treemodelcompleter/treemodelcompleter.cpp98
-rw-r--r--examples/tools/treemodelcompleter/treemodelcompleter.h71
-rw-r--r--examples/tools/treemodelcompleter/treemodelcompleter.pro12
-rw-r--r--examples/tools/treemodelcompleter/treemodelcompleter.qrc5
-rw-r--r--examples/tools/undoframework/commands.cpp163
-rw-r--r--examples/tools/undoframework/commands.h104
-rw-r--r--examples/tools/undoframework/diagramitem.cpp66
-rw-r--r--examples/tools/undoframework/diagramitem.h73
-rw-r--r--examples/tools/undoframework/diagramscene.cpp76
-rw-r--r--examples/tools/undoframework/diagramscene.h75
-rw-r--r--examples/tools/undoframework/images/cross.pngbin0 -> 114 bytes-rw-r--r--examples/tools/undoframework/main.cpp58
-rw-r--r--examples/tools/undoframework/mainwindow.cpp209
-rw-r--r--examples/tools/undoframework/mainwindow.h100
-rw-r--r--examples/tools/undoframework/undoframework.pro16
-rw-r--r--examples/tools/undoframework/undoframework.qrc6
-rw-r--r--examples/tutorials/README37
-rw-r--r--examples/tutorials/addressbook-fr/README42
-rw-r--r--examples/tutorials/addressbook-fr/addressbook-fr.pro8
-rw-r--r--examples/tutorials/addressbook-fr/part1/addressbook.cpp68
-rw-r--r--examples/tutorials/addressbook-fr/part1/addressbook.h67
-rw-r--r--examples/tutorials/addressbook-fr/part1/main.cpp55
-rw-r--r--examples/tutorials/addressbook-fr/part1/part1.pro9
-rw-r--r--examples/tutorials/addressbook-fr/part2/addressbook.cpp158
-rw-r--r--examples/tutorials/addressbook-fr/part2/addressbook.h85
-rw-r--r--examples/tutorials/addressbook-fr/part2/main.cpp55
-rw-r--r--examples/tutorials/addressbook-fr/part2/part2.pro9
-rw-r--r--examples/tutorials/addressbook-fr/part3/addressbook.cpp217
-rw-r--r--examples/tutorials/addressbook-fr/part3/addressbook.h87
-rw-r--r--examples/tutorials/addressbook-fr/part3/main.cpp53
-rw-r--r--examples/tutorials/addressbook-fr/part3/part3.pro9
-rw-r--r--examples/tutorials/addressbook-fr/part4/addressbook.cpp291
-rw-r--r--examples/tutorials/addressbook-fr/part4/addressbook.h100
-rw-r--r--examples/tutorials/addressbook-fr/part4/main.cpp53
-rw-r--r--examples/tutorials/addressbook-fr/part4/part4.pro9
-rw-r--r--examples/tutorials/addressbook-fr/part5/addressbook.cpp315
-rw-r--r--examples/tutorials/addressbook-fr/part5/addressbook.h103
-rw-r--r--examples/tutorials/addressbook-fr/part5/finddialog.cpp87
-rw-r--r--examples/tutorials/addressbook-fr/part5/finddialog.h69
-rw-r--r--examples/tutorials/addressbook-fr/part5/main.cpp53
-rw-r--r--examples/tutorials/addressbook-fr/part5/part5.pro11
-rw-r--r--examples/tutorials/addressbook-fr/part6/addressbook.cpp396
-rw-r--r--examples/tutorials/addressbook-fr/part6/addressbook.h104
-rw-r--r--examples/tutorials/addressbook-fr/part6/finddialog.cpp83
-rw-r--r--examples/tutorials/addressbook-fr/part6/finddialog.h69
-rw-r--r--examples/tutorials/addressbook-fr/part6/main.cpp53
-rw-r--r--examples/tutorials/addressbook-fr/part6/part6.pro11
-rw-r--r--examples/tutorials/addressbook-fr/part7/addressbook.cpp449
-rw-r--r--examples/tutorials/addressbook-fr/part7/addressbook.h106
-rw-r--r--examples/tutorials/addressbook-fr/part7/finddialog.cpp83
-rw-r--r--examples/tutorials/addressbook-fr/part7/finddialog.h69
-rw-r--r--examples/tutorials/addressbook-fr/part7/main.cpp53
-rw-r--r--examples/tutorials/addressbook-fr/part7/part7.pro11
-rw-r--r--examples/tutorials/addressbook/README42
-rw-r--r--examples/tutorials/addressbook/addressbook.pro8
-rw-r--r--examples/tutorials/addressbook/part1/addressbook.cpp68
-rw-r--r--examples/tutorials/addressbook/part1/addressbook.h67
-rw-r--r--examples/tutorials/addressbook/part1/main.cpp55
-rw-r--r--examples/tutorials/addressbook/part1/part1.pro9
-rw-r--r--examples/tutorials/addressbook/part2/addressbook.cpp158
-rw-r--r--examples/tutorials/addressbook/part2/addressbook.h85
-rw-r--r--examples/tutorials/addressbook/part2/main.cpp55
-rw-r--r--examples/tutorials/addressbook/part2/part2.pro9
-rw-r--r--examples/tutorials/addressbook/part3/addressbook.cpp217
-rw-r--r--examples/tutorials/addressbook/part3/addressbook.h87
-rw-r--r--examples/tutorials/addressbook/part3/main.cpp53
-rw-r--r--examples/tutorials/addressbook/part3/part3.pro9
-rw-r--r--examples/tutorials/addressbook/part4/addressbook.cpp291
-rw-r--r--examples/tutorials/addressbook/part4/addressbook.h100
-rw-r--r--examples/tutorials/addressbook/part4/main.cpp53
-rw-r--r--examples/tutorials/addressbook/part4/part4.pro9
-rw-r--r--examples/tutorials/addressbook/part5/addressbook.cpp315
-rw-r--r--examples/tutorials/addressbook/part5/addressbook.h103
-rw-r--r--examples/tutorials/addressbook/part5/finddialog.cpp87
-rw-r--r--examples/tutorials/addressbook/part5/finddialog.h69
-rw-r--r--examples/tutorials/addressbook/part5/main.cpp53
-rw-r--r--examples/tutorials/addressbook/part5/part5.pro11
-rw-r--r--examples/tutorials/addressbook/part6/addressbook.cpp396
-rw-r--r--examples/tutorials/addressbook/part6/addressbook.h104
-rw-r--r--examples/tutorials/addressbook/part6/finddialog.cpp83
-rw-r--r--examples/tutorials/addressbook/part6/finddialog.h69
-rw-r--r--examples/tutorials/addressbook/part6/main.cpp53
-rw-r--r--examples/tutorials/addressbook/part6/part6.pro11
-rw-r--r--examples/tutorials/addressbook/part7/addressbook.cpp449
-rw-r--r--examples/tutorials/addressbook/part7/addressbook.h106
-rw-r--r--examples/tutorials/addressbook/part7/finddialog.cpp83
-rw-r--r--examples/tutorials/addressbook/part7/finddialog.h69
-rw-r--r--examples/tutorials/addressbook/part7/main.cpp53
-rw-r--r--examples/tutorials/addressbook/part7/part7.pro11
-rw-r--r--examples/tutorials/tutorials.pro8
-rw-r--r--examples/uitools/multipleinheritance/calculatorform.cpp66
-rw-r--r--examples/uitools/multipleinheritance/calculatorform.h63
-rw-r--r--examples/uitools/multipleinheritance/calculatorform.ui303
-rw-r--r--examples/uitools/multipleinheritance/main.cpp53
-rw-r--r--examples/uitools/multipleinheritance/multipleinheritance.pro11
-rw-r--r--examples/uitools/textfinder/forms/input.txt9
-rw-r--r--examples/uitools/textfinder/forms/textfinder.ui89
-rw-r--r--examples/uitools/textfinder/main.cpp56
-rw-r--r--examples/uitools/textfinder/textfinder.cpp156
-rw-r--r--examples/uitools/textfinder/textfinder.h75
-rw-r--r--examples/uitools/textfinder/textfinder.pro10
-rw-r--r--examples/uitools/textfinder/textfinder.qrc6
-rw-r--r--examples/uitools/uitools.pro10
-rwxr-xr-xexamples/webkit/formextractor/form.html64
-rw-r--r--examples/webkit/formextractor/formextractor.cpp74
-rw-r--r--examples/webkit/formextractor/formextractor.h67
-rw-r--r--examples/webkit/formextractor/formextractor.pro16
-rw-r--r--examples/webkit/formextractor/formextractor.qrc5
-rw-r--r--examples/webkit/formextractor/formextractor.ui159
-rw-r--r--examples/webkit/formextractor/main.cpp53
-rw-r--r--examples/webkit/formextractor/mainwindow.cpp87
-rw-r--r--examples/webkit/formextractor/mainwindow.h75
-rw-r--r--examples/webkit/previewer/main.cpp53
-rw-r--r--examples/webkit/previewer/mainwindow.cpp197
-rw-r--r--examples/webkit/previewer/mainwindow.h87
-rw-r--r--examples/webkit/previewer/previewer.cpp65
-rw-r--r--examples/webkit/previewer/previewer.h65
-rw-r--r--examples/webkit/previewer/previewer.pro13
-rw-r--r--examples/webkit/previewer/previewer.ui99
-rw-r--r--examples/webkit/webkit.pro9
-rw-r--r--examples/widgets/README44
-rw-r--r--examples/widgets/analogclock/analogclock.cpp146
-rw-r--r--examples/widgets/analogclock/analogclock.h60
-rw-r--r--examples/widgets/analogclock/analogclock.pro9
-rw-r--r--examples/widgets/analogclock/main.cpp52
-rw-r--r--examples/widgets/calculator/button.cpp64
-rw-r--r--examples/widgets/calculator/button.h59
-rw-r--r--examples/widgets/calculator/calculator.cpp398
-rw-r--r--examples/widgets/calculator/calculator.h108
-rw-r--r--examples/widgets/calculator/calculator.pro11
-rw-r--r--examples/widgets/calculator/main.cpp52
-rw-r--r--examples/widgets/calendarwidget/calendarwidget.pro9
-rw-r--r--examples/widgets/calendarwidget/main.cpp52
-rw-r--r--examples/widgets/calendarwidget/window.cpp462
-rw-r--r--examples/widgets/calendarwidget/window.h128
-rw-r--r--examples/widgets/charactermap/charactermap.pro11
-rw-r--r--examples/widgets/charactermap/characterwidget.cpp178
-rw-r--r--examples/widgets/charactermap/characterwidget.h87
-rw-r--r--examples/widgets/charactermap/main.cpp52
-rw-r--r--examples/widgets/charactermap/mainwindow.cpp196
-rw-r--r--examples/widgets/charactermap/mainwindow.h84
-rw-r--r--examples/widgets/codeeditor/codeeditor.cpp171
-rw-r--r--examples/widgets/codeeditor/codeeditor.h106
-rw-r--r--examples/widgets/codeeditor/codeeditor.pro9
-rw-r--r--examples/widgets/codeeditor/main.cpp56
-rw-r--r--examples/widgets/digitalclock/digitalclock.cpp73
-rw-r--r--examples/widgets/digitalclock/digitalclock.h60
-rw-r--r--examples/widgets/digitalclock/digitalclock.pro9
-rw-r--r--examples/widgets/digitalclock/main.cpp52
-rw-r--r--examples/widgets/groupbox/groupbox.pro9
-rw-r--r--examples/widgets/groupbox/main.cpp52
-rw-r--r--examples/widgets/groupbox/window.cpp190
-rw-r--r--examples/widgets/groupbox/window.h67
-rw-r--r--examples/widgets/icons/iconpreviewarea.cpp142
-rw-r--r--examples/widgets/icons/iconpreviewarea.h78
-rw-r--r--examples/widgets/icons/icons.pro25
-rw-r--r--examples/widgets/icons/iconsizespinbox.cpp71
-rw-r--r--examples/widgets/icons/iconsizespinbox.h60
-rw-r--r--examples/widgets/icons/imagedelegate.cpp106
-rw-r--r--examples/widgets/icons/imagedelegate.h69
-rw-r--r--examples/widgets/icons/images/designer.pngbin0 -> 4205 bytes-rw-r--r--examples/widgets/icons/images/find_disabled.pngbin0 -> 501 bytes-rw-r--r--examples/widgets/icons/images/find_normal.pngbin0 -> 838 bytes-rw-r--r--examples/widgets/icons/images/monkey_off_128x128.pngbin0 -> 7045 bytes-rw-r--r--examples/widgets/icons/images/monkey_off_16x16.pngbin0 -> 683 bytes-rw-r--r--examples/widgets/icons/images/monkey_off_32x32.pngbin0 -> 1609 bytes-rw-r--r--examples/widgets/icons/images/monkey_off_64x64.pngbin0 -> 3533 bytes-rw-r--r--examples/widgets/icons/images/monkey_on_128x128.pngbin0 -> 6909 bytes-rw-r--r--examples/widgets/icons/images/monkey_on_16x16.pngbin0 -> 681 bytes-rw-r--r--examples/widgets/icons/images/monkey_on_32x32.pngbin0 -> 1577 bytes-rw-r--r--examples/widgets/icons/images/monkey_on_64x64.pngbin0 -> 3479 bytes-rw-r--r--examples/widgets/icons/images/qt_extended_16x16.pngbin0 -> 834 bytes-rw-r--r--examples/widgets/icons/images/qt_extended_32x32.pngbin0 -> 1892 bytes-rw-r--r--examples/widgets/icons/images/qt_extended_48x48.pngbin0 -> 3672 bytes-rw-r--r--examples/widgets/icons/main.cpp52
-rw-r--r--examples/widgets/icons/mainwindow.cpp443
-rw-r--r--examples/widgets/icons/mainwindow.h117
-rw-r--r--examples/widgets/imageviewer/imageviewer.cpp278
-rw-r--r--examples/widgets/imageviewer/imageviewer.h104
-rw-r--r--examples/widgets/imageviewer/imageviewer.pro13
-rw-r--r--examples/widgets/imageviewer/main.cpp52
-rw-r--r--examples/widgets/lineedits/lineedits.pro9
-rw-r--r--examples/widgets/lineedits/main.cpp52
-rw-r--r--examples/widgets/lineedits/window.cpp257
-rw-r--r--examples/widgets/lineedits/window.h76
-rw-r--r--examples/widgets/movie/animation.mngbin0 -> 5464 bytes-rw-r--r--examples/widgets/movie/main.cpp52
-rw-r--r--examples/widgets/movie/movie.pro9
-rw-r--r--examples/widgets/movie/movieplayer.cpp211
-rw-r--r--examples/widgets/movie/movieplayer.h97
-rw-r--r--examples/widgets/scribble/main.cpp52
-rw-r--r--examples/widgets/scribble/mainwindow.cpp251
-rw-r--r--examples/widgets/scribble/mainwindow.h93
-rw-r--r--examples/widgets/scribble/scribble.pro11
-rw-r--r--examples/widgets/scribble/scribblearea.cpp215
-rw-r--r--examples/widgets/scribble/scribblearea.h91
-rw-r--r--examples/widgets/shapedclock/main.cpp52
-rw-r--r--examples/widgets/shapedclock/shapedclock.cpp159
-rw-r--r--examples/widgets/shapedclock/shapedclock.h67
-rw-r--r--examples/widgets/shapedclock/shapedclock.pro9
-rw-r--r--examples/widgets/sliders/main.cpp52
-rw-r--r--examples/widgets/sliders/sliders.pro11
-rw-r--r--examples/widgets/sliders/slidersgroup.cpp133
-rw-r--r--examples/widgets/sliders/slidersgroup.h79
-rw-r--r--examples/widgets/sliders/window.cpp146
-rw-r--r--examples/widgets/sliders/window.h85
-rw-r--r--examples/widgets/spinboxes/main.cpp52
-rw-r--r--examples/widgets/spinboxes/spinboxes.pro9
-rw-r--r--examples/widgets/spinboxes/window.cpp252
-rw-r--r--examples/widgets/spinboxes/window.h82
-rw-r--r--examples/widgets/styles/images/woodbackground.pngbin0 -> 7691 bytes-rw-r--r--examples/widgets/styles/images/woodbutton.pngbin0 -> 7689 bytes-rw-r--r--examples/widgets/styles/main.cpp54
-rw-r--r--examples/widgets/styles/norwegianwoodstyle.cpp331
-rw-r--r--examples/widgets/styles/norwegianwoodstyle.h79
-rw-r--r--examples/widgets/styles/styles.pro14
-rw-r--r--examples/widgets/styles/styles.qrc6
-rw-r--r--examples/widgets/styles/widgetgallery.cpp276
-rw-r--r--examples/widgets/styles/widgetgallery.h122
-rw-r--r--examples/widgets/stylesheet/images/checkbox_checked.pngbin0 -> 263 bytes-rw-r--r--examples/widgets/stylesheet/images/checkbox_checked_hover.pngbin0 -> 266 bytes-rw-r--r--examples/widgets/stylesheet/images/checkbox_checked_pressed.pngbin0 -> 425 bytes-rw-r--r--examples/widgets/stylesheet/images/checkbox_unchecked.pngbin0 -> 159 bytes-rw-r--r--examples/widgets/stylesheet/images/checkbox_unchecked_hover.pngbin0 -> 159 bytes-rw-r--r--examples/widgets/stylesheet/images/checkbox_unchecked_pressed.pngbin0 -> 320 bytes-rw-r--r--examples/widgets/stylesheet/images/down_arrow.pngbin0 -> 175 bytes-rw-r--r--examples/widgets/stylesheet/images/down_arrow_disabled.pngbin0 -> 174 bytes-rw-r--r--examples/widgets/stylesheet/images/frame.pngbin0 -> 253 bytes-rw-r--r--examples/widgets/stylesheet/images/pagefold.pngbin0 -> 1545 bytes-rw-r--r--examples/widgets/stylesheet/images/pushbutton.pngbin0 -> 533 bytes-rw-r--r--examples/widgets/stylesheet/images/pushbutton_hover.pngbin0 -> 525 bytes-rw-r--r--examples/widgets/stylesheet/images/pushbutton_pressed.pngbin0 -> 513 bytes-rw-r--r--examples/widgets/stylesheet/images/radiobutton_checked.pngbin0 -> 355 bytes-rw-r--r--examples/widgets/stylesheet/images/radiobutton_checked_hover.pngbin0 -> 532 bytes-rw-r--r--examples/widgets/stylesheet/images/radiobutton_checked_pressed.pngbin0 -> 599 bytes-rw-r--r--examples/widgets/stylesheet/images/radiobutton_unchecked.pngbin0 -> 240 bytes-rw-r--r--examples/widgets/stylesheet/images/radiobutton_unchecked_hover.pngbin0 -> 492 bytes-rw-r--r--examples/widgets/stylesheet/images/radiobutton_unchecked_pressed.pngbin0 -> 556 bytes-rw-r--r--examples/widgets/stylesheet/images/sizegrip.pngbin0 -> 129 bytes-rw-r--r--examples/widgets/stylesheet/images/spindown.pngbin0 -> 276 bytes-rw-r--r--examples/widgets/stylesheet/images/spindown_hover.pngbin0 -> 268 bytes-rw-r--r--examples/widgets/stylesheet/images/spindown_off.pngbin0 -> 249 bytes-rw-r--r--examples/widgets/stylesheet/images/spindown_pressed.pngbin0 -> 264 bytes-rw-r--r--examples/widgets/stylesheet/images/spinup.pngbin0 -> 283 bytes-rw-r--r--examples/widgets/stylesheet/images/spinup_hover.pngbin0 -> 277 bytes-rw-r--r--examples/widgets/stylesheet/images/spinup_off.pngbin0 -> 274 bytes-rw-r--r--examples/widgets/stylesheet/images/spinup_pressed.pngbin0 -> 277 bytes-rw-r--r--examples/widgets/stylesheet/images/up_arrow.pngbin0 -> 197 bytes-rw-r--r--examples/widgets/stylesheet/images/up_arrow_disabled.pngbin0 -> 172 bytes-rw-r--r--examples/widgets/stylesheet/layouts/default.ui329
-rw-r--r--examples/widgets/stylesheet/layouts/pagefold.ui349
-rw-r--r--examples/widgets/stylesheet/main.cpp54
-rw-r--r--examples/widgets/stylesheet/mainwindow.cpp75
-rw-r--r--examples/widgets/stylesheet/mainwindow.h67
-rw-r--r--examples/widgets/stylesheet/mainwindow.ui356
-rw-r--r--examples/widgets/stylesheet/qss/coffee.qss112
-rw-r--r--examples/widgets/stylesheet/qss/default.qss1
-rw-r--r--examples/widgets/stylesheet/qss/pagefold.qss299
-rw-r--r--examples/widgets/stylesheet/stylesheet.pro14
-rw-r--r--examples/widgets/stylesheet/stylesheet.qrc39
-rw-r--r--examples/widgets/stylesheet/stylesheeteditor.cpp94
-rw-r--r--examples/widgets/stylesheet/stylesheeteditor.h68
-rw-r--r--examples/widgets/stylesheet/stylesheeteditor.ui171
-rw-r--r--examples/widgets/tablet/main.cpp61
-rw-r--r--examples/widgets/tablet/mainwindow.cpp275
-rw-r--r--examples/widgets/tablet/mainwindow.h114
-rw-r--r--examples/widgets/tablet/tablet.pro13
-rw-r--r--examples/widgets/tablet/tabletapplication.cpp57
-rw-r--r--examples/widgets/tablet/tabletapplication.h67
-rw-r--r--examples/widgets/tablet/tabletcanvas.cpp257
-rw-r--r--examples/widgets/tablet/tabletcanvas.h115
-rw-r--r--examples/widgets/tetrix/main.cpp55
-rw-r--r--examples/widgets/tetrix/tetrix.pro13
-rw-r--r--examples/widgets/tetrix/tetrixboard.cpp409
-rw-r--r--examples/widgets/tetrix/tetrixboard.h117
-rw-r--r--examples/widgets/tetrix/tetrixpiece.cpp146
-rw-r--r--examples/widgets/tetrix/tetrixpiece.h76
-rw-r--r--examples/widgets/tetrix/tetrixwindow.cpp116
-rw-r--r--examples/widgets/tetrix/tetrixwindow.h77
-rw-r--r--examples/widgets/tooltips/images/circle.pngbin0 -> 165 bytes-rw-r--r--examples/widgets/tooltips/images/square.pngbin0 -> 94 bytes-rw-r--r--examples/widgets/tooltips/images/triangle.pngbin0 -> 170 bytes-rw-r--r--examples/widgets/tooltips/main.cpp55
-rw-r--r--examples/widgets/tooltips/shapeitem.cpp100
-rw-r--r--examples/widgets/tooltips/shapeitem.h71
-rw-r--r--examples/widgets/tooltips/sortingbox.cpp302
-rw-r--r--examples/widgets/tooltips/sortingbox.h107
-rw-r--r--examples/widgets/tooltips/tooltips.pro12
-rw-r--r--examples/widgets/tooltips/tooltips.qrc7
-rw-r--r--examples/widgets/validators/ledoff.pngbin0 -> 562 bytes-rw-r--r--examples/widgets/validators/ledon.pngbin0 -> 486 bytes-rw-r--r--examples/widgets/validators/ledwidget.cpp63
-rw-r--r--examples/widgets/validators/ledwidget.h65
-rw-r--r--examples/widgets/validators/localeselector.cpp313
-rw-r--r--examples/widgets/validators/localeselector.h61
-rw-r--r--examples/widgets/validators/main.cpp137
-rw-r--r--examples/widgets/validators/validators.pro21
-rw-r--r--examples/widgets/validators/validators.qrc6
-rw-r--r--examples/widgets/validators/validators.ui467
-rw-r--r--examples/widgets/widgets.pro31
-rw-r--r--examples/widgets/wiggly/dialog.cpp67
-rw-r--r--examples/widgets/wiggly/dialog.h57
-rw-r--r--examples/widgets/wiggly/main.cpp53
-rw-r--r--examples/widgets/wiggly/wiggly.pro11
-rw-r--r--examples/widgets/wiggly/wigglywidget.cpp101
-rw-r--r--examples/widgets/wiggly/wigglywidget.h70
-rw-r--r--examples/widgets/windowflags/controllerwindow.cpp221
-rw-r--r--examples/widgets/windowflags/controllerwindow.h105
-rw-r--r--examples/widgets/windowflags/main.cpp52
-rw-r--r--examples/widgets/windowflags/previewwindow.cpp119
-rw-r--r--examples/widgets/windowflags/previewwindow.h68
-rw-r--r--examples/widgets/windowflags/windowflags.pro11
-rw-r--r--examples/xml/README40
-rw-r--r--examples/xml/dombookmarks/dombookmarks.pro18
-rw-r--r--examples/xml/dombookmarks/frank.xbel230
-rw-r--r--examples/xml/dombookmarks/jennifer.xbel93
-rw-r--r--examples/xml/dombookmarks/main.cpp53
-rw-r--r--examples/xml/dombookmarks/mainwindow.cpp146
-rw-r--r--examples/xml/dombookmarks/mainwindow.h76
-rw-r--r--examples/xml/dombookmarks/xbeltree.cpp187
-rw-r--r--examples/xml/dombookmarks/xbeltree.h75
-rw-r--r--examples/xml/rsslisting/main.cpp64
-rw-r--r--examples/xml/rsslisting/rsslisting.cpp239
-rw-r--r--examples/xml/rsslisting/rsslisting.h87
-rw-r--r--examples/xml/rsslisting/rsslisting.pro10
-rw-r--r--examples/xml/saxbookmarks/frank.xbel230
-rw-r--r--examples/xml/saxbookmarks/jennifer.xbel93
-rw-r--r--examples/xml/saxbookmarks/main.cpp53
-rw-r--r--examples/xml/saxbookmarks/mainwindow.cpp161
-rw-r--r--examples/xml/saxbookmarks/mainwindow.h78
-rw-r--r--examples/xml/saxbookmarks/saxbookmarks.pro20
-rw-r--r--examples/xml/saxbookmarks/xbelgenerator.cpp115
-rw-r--r--examples/xml/saxbookmarks/xbelgenerator.h69
-rw-r--r--examples/xml/saxbookmarks/xbelhandler.cpp147
-rw-r--r--examples/xml/saxbookmarks/xbelhandler.h79
-rw-r--r--examples/xml/streambookmarks/frank.xbel230
-rw-r--r--examples/xml/streambookmarks/jennifer.xbel93
-rw-r--r--examples/xml/streambookmarks/main.cpp55
-rw-r--r--examples/xml/streambookmarks/mainwindow.cpp177
-rw-r--r--examples/xml/streambookmarks/mainwindow.h80
-rw-r--r--examples/xml/streambookmarks/streambookmarks.pro14
-rw-r--r--examples/xml/streambookmarks/xbelreader.cpp205
-rw-r--r--examples/xml/streambookmarks/xbelreader.h82
-rw-r--r--examples/xml/streambookmarks/xbelwriter.cpp93
-rw-r--r--examples/xml/streambookmarks/xbelwriter.h65
-rw-r--r--examples/xml/xml.pro12
-rw-r--r--examples/xml/xmlstreamlint/main.cpp128
-rw-r--r--examples/xml/xmlstreamlint/xmlstreamlint.pro10
-rw-r--r--examples/xmlpatterns/README38
-rw-r--r--examples/xmlpatterns/filetree/filetree.cpp372
-rw-r--r--examples/xmlpatterns/filetree/filetree.h103
-rw-r--r--examples/xmlpatterns/filetree/filetree.pro13
-rw-r--r--examples/xmlpatterns/filetree/forms/mainwindow.ui200
-rw-r--r--examples/xmlpatterns/filetree/main.cpp54
-rw-r--r--examples/xmlpatterns/filetree/mainwindow.cpp166
-rw-r--r--examples/xmlpatterns/filetree/mainwindow.h73
-rw-r--r--examples/xmlpatterns/filetree/queries.qrc7
-rw-r--r--examples/xmlpatterns/filetree/queries/listCPPFiles.xq19
-rw-r--r--examples/xmlpatterns/filetree/queries/wholeTree.xq1
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/forms/mainwindow.ui196
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/main.cpp53
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/mainwindow.cpp135
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/mainwindow.h64
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.cpp459
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.h139
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/qobjectxmlmodel.pro13
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/queries.qrc7
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/queries/statisticsInHTML.xq58
-rw-r--r--examples/xmlpatterns/qobjectxmlmodel/queries/wholeTree.xq3
-rw-r--r--examples/xmlpatterns/recipes/files/allRecipes.xq4
-rw-r--r--examples/xmlpatterns/recipes/files/cookbook.xml62
-rw-r--r--examples/xmlpatterns/recipes/files/liquidIngredientsInSoup.xq5
-rw-r--r--examples/xmlpatterns/recipes/files/mushroomSoup.xq5
-rw-r--r--examples/xmlpatterns/recipes/files/preparationLessThan30.xq9
-rw-r--r--examples/xmlpatterns/recipes/files/preparationTimes.xq5
-rw-r--r--examples/xmlpatterns/recipes/forms/querywidget.ui151
-rw-r--r--examples/xmlpatterns/recipes/main.cpp54
-rw-r--r--examples/xmlpatterns/recipes/querymainwindow.cpp124
-rw-r--r--examples/xmlpatterns/recipes/querymainwindow.h72
-rw-r--r--examples/xmlpatterns/recipes/recipes.pro11
-rw-r--r--examples/xmlpatterns/recipes/recipes.qrc11
-rw-r--r--examples/xmlpatterns/shared/xmlsyntaxhighlighter.cpp106
-rw-r--r--examples/xmlpatterns/shared/xmlsyntaxhighlighter.h72
-rw-r--r--examples/xmlpatterns/trafficinfo/main.cpp54
-rw-r--r--examples/xmlpatterns/trafficinfo/mainwindow.cpp181
-rw-r--r--examples/xmlpatterns/trafficinfo/mainwindow.h77
-rw-r--r--examples/xmlpatterns/trafficinfo/station_example.wml31
-rw-r--r--examples/xmlpatterns/trafficinfo/stationdialog.cpp164
-rw-r--r--examples/xmlpatterns/trafficinfo/stationdialog.h70
-rw-r--r--examples/xmlpatterns/trafficinfo/stationdialog.ui104
-rw-r--r--examples/xmlpatterns/trafficinfo/stationquery.cpp94
-rw-r--r--examples/xmlpatterns/trafficinfo/stationquery.h74
-rw-r--r--examples/xmlpatterns/trafficinfo/time_example.wml56
-rw-r--r--examples/xmlpatterns/trafficinfo/timequery.cpp116
-rw-r--r--examples/xmlpatterns/trafficinfo/timequery.h74
-rw-r--r--examples/xmlpatterns/trafficinfo/trafficinfo.pro9
-rw-r--r--examples/xmlpatterns/xmlpatterns.pro14
-rw-r--r--examples/xmlpatterns/xquery/globalVariables/globalVariables.pro9
-rw-r--r--examples/xmlpatterns/xquery/globalVariables/globals.cpp67
-rw-r--r--examples/xmlpatterns/xquery/globalVariables/globals.gccxml33
-rw-r--r--examples/xmlpatterns/xquery/globalVariables/globals.html40
-rw-r--r--examples/xmlpatterns/xquery/globalVariables/reportGlobals.xq110
-rw-r--r--examples/xmlpatterns/xquery/xquery.pro8
1907 files changed, 142207 insertions, 0 deletions
diff --git a/examples/README b/examples/README
new file mode 100644
index 0000000..10e14ce
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,39 @@
+Qt is supplied with a number of example applications and demonstrations that
+have been written to provide developers with examples of the Qt API in use,
+highlight good programming practice, and showcase features found in each of
+Qt's core technologies.
+
+The example and demo launcher can be used to explore the different categories
+available. It provides an overview of each example, lets you view the
+documentation in Qt Assistant, and is able to launch examples and demos.
+
+Documentation for examples can be found in the Tutorials and Examples section
+of the Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/activeqt/README b/examples/activeqt/README
new file mode 100644
index 0000000..24be2de
--- /dev/null
+++ b/examples/activeqt/README
@@ -0,0 +1,39 @@
+Qt is supplied with a number of example applications and demonstrations that
+have been written to provide developers with examples of the Qt API in use,
+highlight good programming practice, and showcase features found in each of
+Qt's core technologies.
+
+The example and demo launcher can be used to explore the different categories
+available. It provides an overview of each example, lets you view the
+documentation in Qt Assistant, and is able to launch examples and demos.
+
+Documentation for examples can be found in the Tutorial and Examples section
+of the Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/activeqt/activeqt.pro b/examples/activeqt/activeqt.pro
new file mode 100644
index 0000000..262e1a1
--- /dev/null
+++ b/examples/activeqt/activeqt.pro
@@ -0,0 +1,20 @@
+TEMPLATE = subdirs
+SUBDIRS += comapp \
+ hierarchy \
+ menus \
+ multiple \
+ simple \
+ webbrowser \
+ wrapper
+
+contains(QT_CONFIG, opengl):SUBDIRS += opengl
+
+# For now only the contain examples with mingw, for the others you need
+# an IDL compiler
+win32-g++|wince*:SUBDIRS = webbrowser
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS activeqt.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt
+INSTALLS += target sources
diff --git a/examples/activeqt/comapp/comapp.pro b/examples/activeqt/comapp/comapp.pro
new file mode 100644
index 0000000..84ce072
--- /dev/null
+++ b/examples/activeqt/comapp/comapp.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+CONFIG += qaxserver
+
+# Input
+SOURCES += main.cpp
+
+RC_FILE = comapp.rc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/comapp
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS comapp.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/comapp
+INSTALLS += target sources
diff --git a/examples/activeqt/comapp/comapp.rc b/examples/activeqt/comapp/comapp.rc
new file mode 100644
index 0000000..24e339a
--- /dev/null
+++ b/examples/activeqt/comapp/comapp.rc
@@ -0,0 +1 @@
+1 TYPELIB "comapp.rc"
diff --git a/examples/activeqt/comapp/main.cpp b/examples/activeqt/comapp/main.cpp
new file mode 100644
index 0000000..95caaa3
--- /dev/null
+++ b/examples/activeqt/comapp/main.cpp
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QAxFactory>
+#include <QTabWidget>
+#include <QTimer>
+
+class Application;
+class DocumentList;
+
+//! [0]
+class Document : public QObject
+{
+ Q_OBJECT
+
+ Q_CLASSINFO("ClassID", "{2b5775cd-72c2-43da-bc3b-b0e8d1e1c4f7}")
+ Q_CLASSINFO("InterfaceID", "{2ce1761e-07a3-415c-bd11-0eab2c7283de}")
+
+ Q_PROPERTY(Application *application READ application)
+ Q_PROPERTY(QString title READ title WRITE setTitle)
+
+public:
+ Document(DocumentList *list);
+ ~Document();
+
+ Application *application() const;
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+private:
+ QWidget *page;
+};
+//! [0]
+
+//! [1]
+class DocumentList : public QObject
+{
+ Q_OBJECT
+
+ Q_CLASSINFO("ClassID", "{496b761d-924b-4554-a18a-8f3704d2a9a6}")
+ Q_CLASSINFO("InterfaceID", "{6c9e30e8-3ff6-4e6a-9edc-d219d074a148}")
+
+ Q_PROPERTY(Application* application READ application)
+ Q_PROPERTY(int count READ count)
+
+public:
+ DocumentList(Application *application);
+
+ int count() const;
+ Application *application() const;
+
+public slots:
+ Document *addDocument();
+ Document *item(int index) const;
+
+private:
+ QList<Document*> list;
+};
+//! [1]
+
+//! [2]
+class Application : public QObject
+{
+ Q_OBJECT
+
+ Q_CLASSINFO("ClassID", "{b50a71db-c4a7-4551-8d14-49983566afee}")
+ Q_CLASSINFO("InterfaceID", "{4a427759-16ef-4ed8-be79-59ffe5789042}")
+ Q_CLASSINFO("RegisterObject", "yes")
+
+ Q_PROPERTY(DocumentList* documents READ documents)
+ Q_PROPERTY(QString id READ id)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
+
+public:
+ Application(QObject *parent = 0);
+ DocumentList *documents() const;
+
+ QString id() const { return objectName(); }
+
+ void setVisible(bool on);
+ bool isVisible() const;
+
+ QTabWidget *window() const { return ui; }
+
+public slots:
+ void quit();
+
+private:
+ DocumentList *docs;
+
+ QTabWidget *ui;
+};
+//! [2]
+
+//! [3]
+Document::Document(DocumentList *list)
+: QObject(list)
+{
+ QTabWidget *tabs = list->application()->window();
+ page = new QWidget(tabs);
+ page->setWindowTitle("Unnamed");
+ tabs->addTab(page, page->windowTitle());
+
+ page->show();
+}
+
+Document::~Document()
+{
+ delete page;
+}
+
+Application *Document::application() const
+{
+ return qobject_cast<DocumentList*>(parent())->application();
+}
+
+QString Document::title() const
+{
+ return page->windowTitle();
+}
+
+void Document::setTitle(const QString &t)
+{
+ page->setWindowTitle(t);
+
+ QTabWidget *tabs = application()->window();
+ int index = tabs->indexOf(page);
+ tabs->setTabText(index, page->windowTitle());
+}
+
+//! [3] //! [4]
+DocumentList::DocumentList(Application *application)
+: QObject(application)
+{
+}
+
+Application *DocumentList::application() const
+{
+ return qobject_cast<Application*>(parent());
+}
+
+int DocumentList::count() const
+{
+ return list.count();
+}
+
+Document *DocumentList::item(int index) const
+{
+ if (index >= list.count())
+ return 0;
+
+ return list.at(index);
+}
+
+Document *DocumentList::addDocument()
+{
+ Document *document = new Document(this);
+ list.append(document);
+
+ return document;
+}
+
+
+//! [4] //! [5]
+Application::Application(QObject *parent)
+: QObject(parent), ui(0)
+{
+ ui = new QTabWidget;
+
+ setObjectName("From QAxFactory");
+ docs = new DocumentList(this);
+}
+
+DocumentList *Application::documents() const
+{
+ return docs;
+}
+
+void Application::setVisible(bool on)
+{
+ ui->setShown(on);
+}
+
+bool Application::isVisible() const
+{
+ return ui->isVisible();
+}
+
+void Application::quit()
+{
+ delete docs;
+ docs = 0;
+
+ delete ui;
+ ui = 0;
+ QTimer::singleShot(0, qApp, SLOT(quit()));
+}
+
+#include "main.moc"
+//! [5] //! [6]
+
+
+QAXFACTORY_BEGIN("{edd3e836-f537-4c6f-be7d-6014c155cc7a}", "{b7da3de8-83bb-4bbe-9ab7-99a05819e201}")
+ QAXCLASS(Application)
+ QAXTYPE(Document)
+ QAXTYPE(DocumentList)
+QAXFACTORY_END()
+
+//! [6] //! [7]
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ app.setQuitOnLastWindowClosed(false);
+
+ // started by COM - don't do anything
+ if (QAxFactory::isServer())
+ return app.exec();
+
+ // started by user
+ Application appobject(0);
+ appobject.setObjectName("From Application");
+
+ QAxFactory::startServer();
+ QAxFactory::registerActiveObject(&appobject);
+
+ appobject.setVisible(true);
+
+ QObject::connect(qApp, SIGNAL(lastWindowClosed()), &appobject, SLOT(quit()));
+
+ return app.exec();
+}
+//! [7]
diff --git a/examples/activeqt/dotnet/walkthrough/Form1.cs b/examples/activeqt/dotnet/walkthrough/Form1.cs
new file mode 100644
index 0000000..9fb572a
--- /dev/null
+++ b/examples/activeqt/dotnet/walkthrough/Form1.cs
@@ -0,0 +1,127 @@
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+
+namespace csharp
+{
+ /// <summary>
+ /// Summary description for Form1.
+ /// </summary>
+ public class Form1 : System.Windows.Forms.Form
+ {
+ private AxwrapperaxLib.AxQPushButton resetButton;
+ private AxmultipleaxLib.AxQAxWidget2 circleWidget;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public Form1()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
+ this.resetButton = new AxwrapperaxLib.AxQPushButton();
+ this.circleWidget = new AxmultipleaxLib.AxQAxWidget2();
+ ((System.ComponentModel.ISupportInitialize)(this.resetButton)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.circleWidget)).BeginInit();
+ this.SuspendLayout();
+ //
+ // resetButton
+ //
+ this.resetButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.resetButton.Enabled = true;
+ this.resetButton.Location = new System.Drawing.Point(160, 296);
+ this.resetButton.Name = "resetButton";
+ this.resetButton.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("resetButton.OcxState")));
+ this.resetButton.Size = new System.Drawing.Size(168, 32);
+ this.resetButton.TabIndex = 1;
+ this.resetButton.clicked += new System.EventHandler(this.resetLineWidth);
+ //
+ // circleWidget
+ //
+ this.circleWidget.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.circleWidget.Enabled = true;
+ this.circleWidget.Location = new System.Drawing.Point(8, 8);
+ this.circleWidget.Name = "circleWidget";
+ this.circleWidget.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("circleWidget.OcxState")));
+ this.circleWidget.Size = new System.Drawing.Size(320, 264);
+ this.circleWidget.TabIndex = 2;
+ this.circleWidget.ClickEvent += new System.EventHandler(this.circleClicked);
+ //
+ // Form1
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(336, 333);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.circleWidget,
+ this.resetButton});
+ this.Name = "Form1";
+ this.Text = "Form1";
+ ((System.ComponentModel.ISupportInitialize)(this.resetButton)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.circleWidget)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.Run(new Form1());
+ }
+
+//! [0]
+ private void circleClicked(object sender, System.EventArgs e)
+ {
+ this.circleWidget.lineWidth++;
+ }
+//! [0]
+
+//! [1]
+ private void resetLineWidth(object sender, System.EventArgs e)
+ {
+ this.circleWidget.lineWidth = 1;
+ this.resetButton.setFocus();
+ }
+//! [1]
+ }
+}
diff --git a/examples/activeqt/dotnet/walkthrough/Form1.resx b/examples/activeqt/dotnet/walkthrough/Form1.resx
new file mode 100644
index 0000000..6353f82
--- /dev/null
+++ b/examples/activeqt/dotnet/walkthrough/Form1.resx
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="resetButton.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw
+ MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT
+ eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAGwMA
+ AAIBAAAAAQAAAAAAAAAAAAAAAAYDAAAAAAAFAAAACGVuYWJsZWQAAAAAEgEAAAACeAAAAAAQAAAAAAAA
+ AAJ5AAAAABAAAAAAAAAABndpZHRoAAAAABAAAACoAAAAB2hlaWdodAAAAAAQAAAAGgAAAA1taW5pbXVt
+ V2lkdGgAAAAAEAAAAAAAAAAObWluaW11bUhlaWdodAAAAAAQAAAAAAAAAA1tYXhpbXVtV2lkdGgAAAAA
+ EAAAf/8AAAAObWF4aW11bUhlaWdodAAAAAAQAAB//wAAAA9iYWNrZ3JvdW5kTW9kZQAAAAAQAAAABAAA
+ ABdwYWxldHRlRm9yZWdyb3VuZENvbG9yAAAAAAr/AAAAAAAAF3BhbGV0dGVCYWNrZ3JvdW5kQ29sb3IA
+ AAAACv/U0MgAAAARYmFja2dyb3VuZE9yaWdpbgAAAAAQAAAAAAAAAAVmb250AAAAAAUAAAAYAE0AUwAg
+ AFMAaABlAGwAbAAgAEQAbABnAFP//wUBADIAAAAACGNhcHRpb24AAAAAA/////8AAAAJaWNvblRleHQA
+ AAAAA/////8AAAAObW91c2VUcmFja2luZwAAAAASAAAAAAxmb2N1c1BvbGljeQAAAAAQAAAAAQAAAA91
+ cGRhdGVzRW5hYmxlZAAAAAASAQAAAAptYXhpbWl6ZWQAAAAAEgAAAAALZnVsbFNjcmVlbgAAAAASAAAA
+ AAxhY2NlcHREcm9wcwAAAAASAAAAABNpbnB1dE1ldGhvZEVuYWJsZWQAAAAAEgAAAAAFdGV4dAAAAAAD
+ AAAADAAmAFIAZQBzAGUAdAAAAAt0b2dnbGVUeXBlAAAAABAAAAAAAAAABWRvd24AAAAAEgAAAAAMdG9n
+ Z2xlU3RhdGUAAAAAEAAAAAAAAAALYXV0b1Jlc2l6ZQAAAAASAAAAAAthdXRvUmVwZWF0AAAAABIAAAAA
+ EGV4Y2x1c2l2ZVRvZ2dsZQAAAAASAAAAAAxhdXRvRGVmYXVsdAAAAAASAQAAAAttZW51QnV0dG9uAAAA
+ ABIAAAAABWZsYXQAAAAAEgAL
+</value>
+ </data>
+ <data name="circleWidget.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw
+ MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFT
+ eXN0ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAALwAA
+ AAIBAAAAAQAAAAAAAAAAAAAAABoAAAAAAAAFAAAACmxpbmVXaWR0aAAAAAAQAAAAAAs=
+</value>
+ </data>
+ <data name="$this.Name">
+ <value>Form1</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/examples/activeqt/dotnet/walkthrough/Form1.vb b/examples/activeqt/dotnet/walkthrough/Form1.vb
new file mode 100644
index 0000000..f5f241b
--- /dev/null
+++ b/examples/activeqt/dotnet/walkthrough/Form1.vb
@@ -0,0 +1,88 @@
+Public Class Form1
+ Inherits System.Windows.Forms.Form
+
+#Region " Windows Form Designer generated code "
+
+ Public Sub New()
+ MyBase.New()
+
+ 'This call is required by the Windows Form Designer.
+ InitializeComponent()
+
+ 'Add any initialization after the InitializeComponent() call
+
+ End Sub
+
+ 'Form overrides dispose to clean up the component list.
+ Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
+ If disposing Then
+ If Not (components Is Nothing) Then
+ components.Dispose()
+ End If
+ End If
+ MyBase.Dispose(disposing)
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ Friend WithEvents circleWidget As AxmultipleaxLib.AxQAxWidget2
+ Friend WithEvents resetButton As AxwrapperaxLib.AxQPushButton
+ <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
+ Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
+ Me.circleWidget = New AxmultipleaxLib.AxQAxWidget2()
+ Me.resetButton = New AxwrapperaxLib.AxQPushButton()
+ CType(Me.circleWidget, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.resetButton, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.SuspendLayout()
+ '
+ 'circleWidget
+ '
+ Me.circleWidget.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
+ Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right)
+ Me.circleWidget.Enabled = True
+ Me.circleWidget.Location = New System.Drawing.Point(8, 8)
+ Me.circleWidget.Name = "circleWidget"
+ Me.circleWidget.OcxState = CType(resources.GetObject("circleWidget.OcxState"), System.Windows.Forms.AxHost.State)
+ Me.circleWidget.Size = New System.Drawing.Size(280, 216)
+ Me.circleWidget.TabIndex = 0
+ '
+ 'resetButton
+ '
+ Me.resetButton.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right)
+ ' VB is case insensitive, but our C++ controls are not.
+ ' Me.resetButton.enabled = True
+ Me.resetButton.Location = New System.Drawing.Point(184, 240)
+ Me.resetButton.Name = "resetButton"
+ Me.resetButton.OcxState = CType(resources.GetObject("resetButton.OcxState"), System.Windows.Forms.AxHost.State)
+ Me.resetButton.Size = New System.Drawing.Size(104, 24)
+ Me.resetButton.TabIndex = 1
+ '
+ 'Form1
+ '
+ Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
+ Me.ClientSize = New System.Drawing.Size(292, 273)
+ Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.resetButton, Me.circleWidget})
+ Me.Name = "Form1"
+ Me.Text = "Form1"
+ CType(Me.circleWidget, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.resetButton, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.ResumeLayout(False)
+
+ End Sub
+
+#End Region
+
+ Private Sub circleWidget_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles circleWidget.ClickEvent
+ Me.circleWidget.lineWidth = Me.circleWidget.lineWidth + 1
+ End Sub
+
+ Private Sub resetButton_clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resetButton.clicked
+ Me.circleWidget.lineWidth = 1
+ Me.resetButton.setFocus()
+ End Sub
+End Class
diff --git a/examples/activeqt/dotnet/walkthrough/csharp.csproj b/examples/activeqt/dotnet/walkthrough/csharp.csproj
new file mode 100644
index 0000000..4c5502b
--- /dev/null
+++ b/examples/activeqt/dotnet/walkthrough/csharp.csproj
@@ -0,0 +1,143 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{F15600FD-7677-4C01-B98A-6776CE500617}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "csharp"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "WinExe"
+ RootNamespace = "csharp"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
+ />
+ <Reference
+ Name = "System.Windows.Forms"
+ AssemblyName = "System.Windows.Forms"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "stdole"
+ Guid = "{00020430-0000-0000-C000-000000000046}"
+ VersionMajor = "2"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "primary"
+ />
+ <Reference
+ Name = "wrapperaxLib"
+ Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "tlbimp"
+ />
+ <Reference
+ Name = "AxwrapperaxLib"
+ Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "aximp"
+ />
+ <Reference
+ Name = "multipleaxLib"
+ Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "tlbimp"
+ />
+ <Reference
+ Name = "AxmultipleaxLib"
+ Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "aximp"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "Form1.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form1.resx"
+ DependentUpon = "Form1.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/examples/activeqt/dotnet/walkthrough/vb.vbproj b/examples/activeqt/dotnet/walkthrough/vb.vbproj
new file mode 100644
index 0000000..eb0a9d6
--- /dev/null
+++ b/examples/activeqt/dotnet/walkthrough/vb.vbproj
@@ -0,0 +1,147 @@
+<VisualStudioProject>
+ <VisualBasic
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{BFF242A6-967C-4F73-BEBE-DED2D9C395C6}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "vb"
+ AssemblyOriginatorKeyFile = ""
+ AssemblyOriginatorKeyMode = "None"
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "WinExe"
+ OptionCompare = "Binary"
+ OptionExplicit = "On"
+ OptionStrict = "Off"
+ RootNamespace = "vb"
+ StartupObject = "vb.Form1"
+ >
+ <Config
+ Name = "Debug"
+ BaseAddress = "285212672"
+ ConfigurationOverrideFile = ""
+ DefineConstants = ""
+ DefineDebug = "true"
+ DefineTrace = "true"
+ DebugSymbols = "true"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ <Config
+ Name = "Release"
+ BaseAddress = "285212672"
+ ConfigurationOverrideFile = ""
+ DefineConstants = ""
+ DefineDebug = "false"
+ DefineTrace = "true"
+ DebugSymbols = "false"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "1"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ />
+ <Reference
+ Name = "System.Windows.Forms"
+ AssemblyName = "System.Windows.Forms"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ />
+ <Reference
+ Name = "stdole"
+ Guid = "{00020430-0000-0000-C000-000000000046}"
+ VersionMajor = "2"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "primary"
+ />
+ <Reference
+ Name = "wrapperaxLib"
+ Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "tlbimp"
+ />
+ <Reference
+ Name = "multipleaxLib"
+ Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "tlbimp"
+ />
+ <Reference
+ Name = "AxwrapperaxLib"
+ Guid = "{3B756301-0075-4E40-8BE8-5A81DE2426B7}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "aximp"
+ />
+ <Reference
+ Name = "AxmultipleaxLib"
+ Guid = "{05828915-AD1C-47AB-AB96-D6AD1E25F0E2}"
+ VersionMajor = "1"
+ VersionMinor = "0"
+ Lcid = "0"
+ WrapperTool = "aximp"
+ />
+ </References>
+ <Imports>
+ <Import Namespace = "Microsoft.VisualBasic" />
+ <Import Namespace = "System" />
+ <Import Namespace = "System.Collections" />
+ <Import Namespace = "System.Data" />
+ <Import Namespace = "System.Drawing" />
+ <Import Namespace = "System.Diagnostics" />
+ <Import Namespace = "System.Windows.Forms" />
+ </Imports>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "Form1.vb"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Form1.resx"
+ DependentUpon = "Form1.vb"
+ BuildAction = "EmbeddedResource"
+ />
+ </Include>
+ </Files>
+ </VisualBasic>
+</VisualStudioProject>
+
diff --git a/examples/activeqt/dotnet/wrapper/app.csproj b/examples/activeqt/dotnet/wrapper/app.csproj
new file mode 100644
index 0000000..dce4bf0
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/app.csproj
@@ -0,0 +1,93 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{334C8F04-E034-4082-9380-43906DDE71AB}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "wrapper"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Exe"
+ RootNamespace = "wrapper"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "D:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "lib"
+ AssemblyName = "lib"
+ HintPath = "lib\lib.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "main.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/examples/activeqt/dotnet/wrapper/lib/lib.vcproj b/examples/activeqt/dotnet/wrapper/lib/lib.vcproj
new file mode 100644
index 0000000..f49c35d
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/lib.vcproj
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding = "Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.00"
+ Name="lib"
+ ProjectGUID="{2E94A303-45A2-47AC-B87A-7C3519E9D6D8}"
+ Keyword="ManagedCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2"
+ ManagedExtensions="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtCore&quot;"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ IgnoreStandardIncludePath="FALSE"
+ MinimalRebuild="FALSE"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="QtCored4.lib"
+ OutputFile="lib.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(QTDIR)/lib"
+ GenerateDebugInformation="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2"
+ ManagedExtensions="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories="&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtCore&quot;"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="QtCore4.lib"
+ OutputFile="$(OutDir)/lib.dll"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(QTDIR)/lib"
+ GenerateDebugInformation="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ </Configuration>
+ </Configurations>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="networker.cpp">
+ </File>
+ <File
+ RelativePath="tools.cpp">
+ </File>
+ <File
+ RelativePath="worker.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="networker.h">
+ </File>
+ <File
+ RelativePath="tools.h">
+ </File>
+ <File
+ RelativePath="worker.h">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputName).h -o moc_$(InputName).cpp"
+ Outputs="moc_$(InputName).cpp"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="$(QTDIR)\bin\moc.exe $(InputName).h -o moc_$(InputName).cpp"
+ Outputs="moc_$(InputName).cpp"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Generated MOC"
+ Filter="">
+ <File
+ RelativePath="moc_worker.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/examples/activeqt/dotnet/wrapper/lib/networker.cpp b/examples/activeqt/dotnet/wrapper/lib/networker.cpp
new file mode 100644
index 0000000..54e862b
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/networker.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include "networker.h"
+#include "worker.h"
+#include "tools.h"
+
+netWorker::netWorker()
+{
+ workerObject = new Worker();
+}
+//! [0] //! [1]
+
+netWorker::~netWorker()
+{
+ delete workerObject;
+}
+//! [1] //! [2]
+
+String *netWorker::get_StatusString()
+{
+ return QStringToString(workerObject->statusString());
+}
+//! [2] //! [3]
+
+void netWorker::set_StatusString(String *string)
+{
+ workerObject->setStatusString(StringToQString(string));
+ __raise statusStringChanged(string);
+}
+//! [3]
diff --git a/examples/activeqt/dotnet/wrapper/lib/networker.h b/examples/activeqt/dotnet/wrapper/lib/networker.h
new file mode 100644
index 0000000..583c6c4
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/networker.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// lib.h
+
+#pragma once
+
+#using <mscorlib.dll>
+using namespace System;
+
+//! [0]
+class Worker;
+
+// .NET class
+public __gc class netWorker
+{
+public:
+ netWorker();
+ ~netWorker();
+
+ __property String *get_StatusString();
+ __property void set_StatusString(String *string);
+
+ __event void statusStringChanged(String *args);
+
+private:
+ Worker *workerObject;
+};
+//! [0]
diff --git a/examples/activeqt/dotnet/wrapper/lib/tools.cpp b/examples/activeqt/dotnet/wrapper/lib/tools.cpp
new file mode 100644
index 0000000..aa67aea
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/tools.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include <QString>
+
+#using <mscorlib.dll>
+#include <vcclr.h>
+
+using namespace System;
+
+String *QStringToString(const QString &qstring)
+{
+ return new String((const wchar_t *)qstring.utf16());
+}
+//! [0] //! [1]
+
+QString StringToQString(String *string)
+{
+ const wchar_t __pin *chars = PtrToStringChars(string);
+ return QString::fromUtf16((const ushort *)chars);
+}
+//! [1]
diff --git a/examples/activeqt/dotnet/wrapper/lib/tools.h b/examples/activeqt/dotnet/wrapper/lib/tools.h
new file mode 100644
index 0000000..8569eca
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/tools.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TOOLS_H
+#define TOOLS_H
+
+#using <mscorlib.dll>
+
+QT_BEGIN_NAMESPACE
+class QString;
+QT_END_NAMESPACE
+
+System::String *QStringToString(const QString &qstring);
+QString StringToQString(System::String *string);
+
+#endif // TOOLS_H
diff --git a/examples/activeqt/dotnet/wrapper/lib/worker.cpp b/examples/activeqt/dotnet/wrapper/lib/worker.cpp
new file mode 100644
index 0000000..695db57
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/worker.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "worker.h"
+#include "tools.h"
+
+Worker::Worker()
+{
+ status = "Idle";
+}
+
+void Worker::setStatusString(const QString &string)
+{
+ status = string;
+ emit statusStringChanged(status);
+}
+
+QString Worker::statusString() const
+{
+ return status;
+}
diff --git a/examples/activeqt/dotnet/wrapper/lib/worker.h b/examples/activeqt/dotnet/wrapper/lib/worker.h
new file mode 100644
index 0000000..8bab9ed
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/lib/worker.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WORKER_H
+#define WORKER_H
+
+#include <QObject>
+
+// native Qt/C++ class
+//! [0]
+class Worker : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString statusString READ statusString WRITE setStatusString)
+public:
+ Worker();
+
+ QString statusString() const;
+
+public slots:
+ void setStatusString(const QString &string);
+
+signals:
+ void statusStringChanged(const QString &string);
+
+private:
+ QString status;
+};
+//! [0]
+
+#endif // WORKER_H
diff --git a/examples/activeqt/dotnet/wrapper/main.cs b/examples/activeqt/dotnet/wrapper/main.cs
new file mode 100644
index 0000000..1d43029
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/main.cs
@@ -0,0 +1,40 @@
+//! [0]
+using System;
+
+namespace WrapperApp
+{
+ class App
+ {
+ void Run()
+ {
+ netWorker worker = new netWorker();
+
+ worker.statusStringChanged += new netWorker.__Delegate_statusStringChanged(onStatusStringChanged);
+
+ System.Console.Out.WriteLine(worker.StatusString);
+
+ System.Console.Out.WriteLine("Working cycle begins...");
+ worker.StatusString = "Working";
+ worker.StatusString = "Lunch Break";
+ worker.StatusString = "Working";
+ worker.StatusString = "Idle";
+ System.Console.Out.WriteLine("Working cycle ends...");
+ }
+
+ private void onStatusStringChanged(string str)
+ {
+ System.Console.Out.WriteLine(str);
+ }
+
+ [STAThread]
+//! [0] //! [1]
+ static void Main(string[] args)
+ {
+ App app = new App();
+ app.Run();
+ }
+//! [1] //! [2]
+ }
+//! [2] //! [3]
+}
+//! [3]
diff --git a/examples/activeqt/dotnet/wrapper/wrapper.sln b/examples/activeqt/dotnet/wrapper/wrapper.sln
new file mode 100644
index 0000000..e25e6bd
--- /dev/null
+++ b/examples/activeqt/dotnet/wrapper/wrapper.sln
@@ -0,0 +1,28 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "app", "app.csproj", "{334C8F04-E034-4082-9380-43906DDE71AB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib", "lib\lib.vcproj", "{2E94A303-45A2-47AC-B87A-7C3519E9D6D8}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ {334C8F04-E034-4082-9380-43906DDE71AB}.0 = {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {334C8F04-E034-4082-9380-43906DDE71AB}.Debug.ActiveCfg = Debug|.NET
+ {334C8F04-E034-4082-9380-43906DDE71AB}.Debug.Build.0 = Debug|.NET
+ {334C8F04-E034-4082-9380-43906DDE71AB}.Release.ActiveCfg = Release|.NET
+ {334C8F04-E034-4082-9380-43906DDE71AB}.Release.Build.0 = Release|.NET
+ {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Debug.ActiveCfg = Debug|Win32
+ {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Debug.Build.0 = Debug|Win32
+ {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Release.ActiveCfg = Release|Win32
+ {2E94A303-45A2-47AC-B87A-7C3519E9D6D8}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/examples/activeqt/hierarchy/hierarchy.inf b/examples/activeqt/hierarchy/hierarchy.inf
new file mode 100644
index 0000000..cb7e90f
--- /dev/null
+++ b/examples/activeqt/hierarchy/hierarchy.inf
@@ -0,0 +1,9 @@
+[version]
+ signature="$CHICAGO$"
+ AdvancedINF=2.0
+ [Add.Code]
+ hierarchyax.dll=hierarchyax.dll
+ [hierarchyax.dll]
+ file-win32-x86=thiscab
+ clsid={d574a747-8016-46db-a07c-b2b4854ee75c}
+ RegisterServer=yes
diff --git a/examples/activeqt/hierarchy/hierarchy.pro b/examples/activeqt/hierarchy/hierarchy.pro
new file mode 100644
index 0000000..abe5f1b
--- /dev/null
+++ b/examples/activeqt/hierarchy/hierarchy.pro
@@ -0,0 +1,16 @@
+TEMPLATE = lib
+TARGET = hierarchyax
+
+CONFIG += qt warn_off qaxserver dll
+contains(CONFIG, static):DEFINES += QT_NODLL
+
+SOURCES = objects.cpp main.cpp
+HEADERS = objects.h
+RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc
+DEF_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.def
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/hierarchy
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS hierarchy.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/hierarchy
+INSTALLS += target sources
diff --git a/examples/activeqt/hierarchy/main.cpp b/examples/activeqt/hierarchy/main.cpp
new file mode 100644
index 0000000..e817635
--- /dev/null
+++ b/examples/activeqt/hierarchy/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include "objects.h"
+#include <QAxFactory>
+
+QAXFACTORY_BEGIN("{9e626211-be62-4d18-9483-9419358fbb03}", "{75c276de-1df5-451f-a004-e4fa1a587df1}")
+ QAXCLASS(QParentWidget)
+ QAXTYPE(QSubWidget)
+QAXFACTORY_END()
+//! [0]
diff --git a/examples/activeqt/hierarchy/objects.cpp b/examples/activeqt/hierarchy/objects.cpp
new file mode 100644
index 0000000..c3928b5
--- /dev/null
+++ b/examples/activeqt/hierarchy/objects.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "objects.h"
+#include <QLayout>
+#include <QPainter>
+
+/* Implementation of QParentWidget */
+//! [0]
+QParentWidget::QParentWidget(QWidget *parent)
+: QWidget(parent)
+{
+ vbox = new QVBoxLayout(this);
+}
+
+//! [0] //! [1]
+void QParentWidget::createSubWidget(const QString &name)
+{
+ QSubWidget *sw = new QSubWidget(this, name);
+ vbox->addWidget(sw);
+ sw->setLabel(name);
+ sw->show();
+}
+
+//! [1] //! [2]
+QSubWidget *QParentWidget::subWidget(const QString &name)
+{
+ return qFindChild<QSubWidget*>(this, name);
+}
+
+//! [2]
+QSize QParentWidget::sizeHint() const
+{
+ return QWidget::sizeHint().expandedTo(QSize(100, 100));
+}
+
+/* Implementation of QSubWidget */
+//! [3]
+QSubWidget::QSubWidget(QWidget *parent, const QString &name)
+: QWidget(parent)
+{
+ setObjectName(name);
+}
+
+void QSubWidget::setLabel(const QString &text)
+{
+ lbl = text;
+ setObjectName(text);
+ update();
+}
+
+QString QSubWidget::label() const
+{
+ return lbl;
+}
+
+QSize QSubWidget::sizeHint() const
+{
+ QFontMetrics fm(font());
+ return QSize(fm.width(lbl), fm.height());
+}
+
+void QSubWidget::paintEvent(QPaintEvent *)
+{
+ QPainter painter(this);
+ painter.setPen(palette().text().color());
+ painter.drawText(rect(), Qt::AlignCenter, lbl);
+//! [3] //! [4]
+}
+//! [4]
diff --git a/examples/activeqt/hierarchy/objects.h b/examples/activeqt/hierarchy/objects.h
new file mode 100644
index 0000000..e719e6d
--- /dev/null
+++ b/examples/activeqt/hierarchy/objects.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef OBJECTS_H
+#define OBJECTS_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QVBoxLayout;
+QT_END_NAMESPACE
+class QSubWidget;
+
+//! [0]
+class QParentWidget : public QWidget
+{
+ Q_OBJECT
+ Q_CLASSINFO("ClassID", "{d574a747-8016-46db-a07c-b2b4854ee75c}");
+ Q_CLASSINFO("InterfaceID", "{4a30719d-d9c2-4659-9d16-67378209f822}");
+ Q_CLASSINFO("EventsID", "{4a30719d-d9c2-4659-9d16-67378209f823}");
+public:
+ QParentWidget(QWidget *parent = 0);
+
+ QSize sizeHint() const;
+
+public slots:
+ void createSubWidget( const QString &name );
+
+ QSubWidget *subWidget( const QString &name );
+
+private:
+ QVBoxLayout *vbox;
+};
+//! [0]
+
+//! [1]
+class QSubWidget : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY( QString label READ label WRITE setLabel )
+
+ Q_CLASSINFO("ClassID", "{850652f4-8f71-4f69-b745-bce241ccdc30}");
+ Q_CLASSINFO("InterfaceID", "{2d76cc2f-3488-417a-83d6-debff88b3c3f}");
+ Q_CLASSINFO("ToSuperClass", "QSubWidget");
+
+public:
+ QSubWidget(QWidget *parent = 0, const QString &name = QString());
+
+ void setLabel( const QString &text );
+ QString label() const;
+
+ QSize sizeHint() const;
+
+protected:
+ void paintEvent( QPaintEvent *e );
+
+private:
+ QString lbl;
+};
+//! [1]
+
+#endif // OBJECTS_H
diff --git a/examples/activeqt/menus/fileopen.xpm b/examples/activeqt/menus/fileopen.xpm
new file mode 100644
index 0000000..880417e
--- /dev/null
+++ b/examples/activeqt/menus/fileopen.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static const char *fileopen[] = {
+" 16 13 5 1",
+". c #040404",
+"# c #808304",
+"a c None",
+"b c #f3f704",
+"c c #f3f7f3",
+"aaaaaaaaa...aaaa",
+"aaaaaaaa.aaa.a.a",
+"aaaaaaaaaaaaa..a",
+"a...aaaaaaaa...a",
+".bcb.......aaaaa",
+".cbcbcbcbc.aaaaa",
+".bcbcbcbcb.aaaaa",
+".cbcb...........",
+".bcb.#########.a",
+".cb.#########.aa",
+".b.#########.aaa",
+"..#########.aaaa",
+"...........aaaaa"
+};
diff --git a/examples/activeqt/menus/filesave.xpm b/examples/activeqt/menus/filesave.xpm
new file mode 100644
index 0000000..bd6870f
--- /dev/null
+++ b/examples/activeqt/menus/filesave.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static const char *filesave[] = {
+" 14 14 4 1",
+". c #040404",
+"# c #808304",
+"a c #bfc2bf",
+"b c None",
+"..............",
+".#.aaaaaaaa.a.",
+".#.aaaaaaaa...",
+".#.aaaaaaaa.#.",
+".#.aaaaaaaa.#.",
+".#.aaaaaaaa.#.",
+".#.aaaaaaaa.#.",
+".##........##.",
+".############.",
+".##.........#.",
+".##......aa.#.",
+".##......aa.#.",
+".##......aa.#.",
+"b............."
+};
diff --git a/examples/activeqt/menus/main.cpp b/examples/activeqt/menus/main.cpp
new file mode 100644
index 0000000..56f8a9f
--- /dev/null
+++ b/examples/activeqt/menus/main.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "menus.h"
+#include <QApplication>
+#include <QAxFactory>
+
+QAXFACTORY_DEFAULT(QMenus,
+ "{4dc3f340-a6f7-44e4-a79b-3e9217695fbd}",
+ "{9ee49617-7d5c-441a-b833-4b068d40d751}",
+ "{13eca64b-ee2a-4f3c-aa04-5d9d975979a7}",
+ "{ce947ee3-0403-4fdc-895a-4fe779394b46}",
+ "{8de435ce-8d2a-46ac-b3b3-cb800d0847c7}");
+
+int main( int argc, char **argv )
+{
+ QApplication a( argc, argv );
+
+ QWidget *window = 0;
+ if ( !QAxFactory::isServer() ) {
+ window = new QMenus();
+ window->show();
+ }
+
+ return a.exec();
+}
diff --git a/examples/activeqt/menus/menus.cpp b/examples/activeqt/menus/menus.cpp
new file mode 100644
index 0000000..27f064e
--- /dev/null
+++ b/examples/activeqt/menus/menus.cpp
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "menus.h"
+#include <QAction>
+#include <QAxFactory>
+#include <QMenuBar>
+#include <QMessageBox>
+#include <QTextEdit>
+#include <QPixmap>
+
+#include "fileopen.xpm"
+#include "filesave.xpm"
+
+QMenus::QMenus(QWidget *parent)
+ : QMainWindow(parent, 0) // QMainWindow's default flag is WType_TopLevel
+{
+ QAction *action;
+
+ QMenu *file = new QMenu(this);
+
+ action = new QAction(QPixmap((const char**)fileopen), "&Open", this);
+ action->setShortcut(tr("CTRL+O"));
+ connect(action, SIGNAL(triggered()), this, SLOT(fileOpen()));
+ file->addAction(action);
+
+ action = new QAction(QPixmap((const char**)filesave),"&Save", this);
+ action->setShortcut(tr("CTRL+S"));
+ connect(action, SIGNAL(triggered()), this, SLOT(fileSave()));
+ file->addAction(action);
+
+ QMenu *edit = new QMenu(this);
+
+ action = new QAction("&Normal", this);
+ action->setShortcut(tr("CTRL+N"));
+ action->setToolTip("Normal");
+ action->setStatusTip("Toggles Normal");
+ action->setCheckable(true);
+ connect(action, SIGNAL(triggered()), this, SLOT(editNormal()));
+ edit->addAction(action);
+
+ action = new QAction("&Bold", this);
+ action->setShortcut(tr("CTRL+B"));
+ action->setCheckable(true);
+ connect(action, SIGNAL(triggered()), this, SLOT(editBold()));
+ edit->addAction(action);
+
+ action = new QAction("&Underline", this);
+ action->setShortcut(tr("CTRL+U"));
+ action->setCheckable(true);
+ connect(action, SIGNAL(triggered()), this, SLOT(editUnderline()));
+ edit->addAction(action);
+
+ QMenu *advanced = new QMenu(this);
+ action = new QAction("&Font...", this);
+ connect(action, SIGNAL(triggered()), this, SLOT(editAdvancedFont()));
+ advanced->addAction(action);
+
+ action = new QAction("&Style...", this);
+ connect(action, SIGNAL(triggered()), this, SLOT(editAdvancedStyle()));
+ advanced->addAction(action);
+
+ edit->addMenu(advanced)->setText("&Advanced");
+
+ edit->addSeparator();
+
+ action = new QAction("Una&vailable", this);
+ action->setShortcut(tr("CTRL+V"));
+ action->setCheckable(true);
+ action->setEnabled(false);
+ connect(action, SIGNAL(triggered()), this, SLOT(editUnderline()));
+ edit->addAction(action);
+
+ QMenu *help = new QMenu(this);
+
+ action = new QAction("&About...", this);
+ action->setShortcut(tr("F1"));
+ connect(action, SIGNAL(triggered()), this, SLOT(helpAbout()));
+ help->addAction(action);
+
+ action = new QAction("&About Qt...", this);
+ connect(action, SIGNAL(triggered()), this, SLOT(helpAboutQt()));
+ help->addAction(action);
+
+ if (!QAxFactory::isServer())
+ menuBar()->addMenu(file)->setText("&File");
+ menuBar()->addMenu(edit)->setText("&Edit");
+ menuBar()->addMenu(help)->setText("&Help");
+
+ editor = new QTextEdit(this);
+ setCentralWidget(editor);
+
+ statusBar();
+}
+
+void QMenus::fileOpen()
+{
+ editor->append("File Open selected.");
+}
+
+void QMenus::fileSave()
+{
+ editor->append("File Save selected.");
+}
+
+void QMenus::editNormal()
+{
+ editor->append("Edit Normal selected.");
+}
+
+void QMenus::editBold()
+{
+ editor->append("Edit Bold selected.");
+}
+
+void QMenus::editUnderline()
+{
+ editor->append("Edit Underline selected.");
+}
+
+void QMenus::editAdvancedFont()
+{
+ editor->append("Edit Advanced Font selected.");
+}
+
+void QMenus::editAdvancedStyle()
+{
+ editor->append("Edit Advanced Style selected.");
+}
+
+void QMenus::helpAbout()
+{
+ QMessageBox::about(this, "About QMenus",
+ "This example implements an in-place ActiveX control with menus and status messages.");
+}
+
+void QMenus::helpAboutQt()
+{
+ QMessageBox::aboutQt(this);
+}
diff --git a/examples/activeqt/menus/menus.h b/examples/activeqt/menus/menus.h
new file mode 100644
index 0000000..c961cd5
--- /dev/null
+++ b/examples/activeqt/menus/menus.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MENUS_H
+#define MENUS_H
+
+#include <QMainWindow>
+
+QT_BEGIN_NAMESPACE
+class QTextEdit;
+QT_END_NAMESPACE
+
+class QMenus : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ QMenus(QWidget *parent = 0);
+
+public slots:
+ void fileOpen();
+ void fileSave();
+
+ void editNormal();
+ void editBold();
+ void editUnderline();
+
+ void editAdvancedFont();
+ void editAdvancedStyle();
+
+ void helpAbout();
+ void helpAboutQt();
+
+private:
+ QTextEdit *editor;
+};
+
+#endif // MENUS_H
diff --git a/examples/activeqt/menus/menus.inf b/examples/activeqt/menus/menus.inf
new file mode 100644
index 0000000..f97efe8
--- /dev/null
+++ b/examples/activeqt/menus/menus.inf
@@ -0,0 +1,9 @@
+[version]
+ signature="$CHICAGO$"
+ AdvancedINF=2.0
+ [Add.Code]
+ menusax.exe=menusax.exe
+ [menusax.exe]
+ file-win32-x86=thiscab
+ clsid={4dc3f340-a6f7-44e4-a79b-3e9217695fbd}
+ RegisterServer=yes
diff --git a/examples/activeqt/menus/menus.pro b/examples/activeqt/menus/menus.pro
new file mode 100644
index 0000000..c962b6b
--- /dev/null
+++ b/examples/activeqt/menus/menus.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+TARGET = menusax
+
+CONFIG += qt warn_off qaxserver
+
+SOURCES = main.cpp menus.cpp
+HEADERS = menus.h
+RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/menus
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS menus.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/menus
+INSTALLS += target sources
diff --git a/examples/activeqt/multiple/ax1.h b/examples/activeqt/multiple/ax1.h
new file mode 100644
index 0000000..a53e4f4
--- /dev/null
+++ b/examples/activeqt/multiple/ax1.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef AX1_H
+#define AX1_H
+
+#include <QWidget>
+#include <QPainter>
+
+//! [0]
+class QAxWidget1 : public QWidget
+{
+ Q_OBJECT
+ Q_CLASSINFO("ClassID", "{1D9928BD-4453-4bdd-903D-E525ED17FDE5}")
+ Q_CLASSINFO("InterfaceID", "{99F6860E-2C5A-42ec-87F2-43396F4BE389}")
+ Q_CLASSINFO("EventsID", "{0A3E9F27-E4F1-45bb-9E47-63099BCCD0E3}")
+
+ Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor)
+public:
+ QAxWidget1(QWidget *parent = 0)
+ : QWidget(parent), fill_color(Qt::red)
+ {
+ }
+
+ QColor fillColor() const
+ {
+ return fill_color;
+ }
+ void setFillColor(const QColor &fc)
+ {
+ fill_color = fc;
+ repaint();
+ }
+
+protected:
+ void paintEvent(QPaintEvent *e)
+ {
+ QPainter paint(this);
+ QRect r = rect();
+ r.adjust(10, 10, -10, -10);
+ paint.fillRect(r, fill_color);
+ }
+
+private:
+ QColor fill_color;
+};
+//! [0]
+
+#endif // AX1_H
diff --git a/examples/activeqt/multiple/ax2.h b/examples/activeqt/multiple/ax2.h
new file mode 100644
index 0000000..b6b50f3
--- /dev/null
+++ b/examples/activeqt/multiple/ax2.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef AX2_H
+#define AX2_H
+
+#include <QWidget>
+#include <QPainter>
+
+//! [0]
+class QAxWidget2 : public QWidget
+{
+ Q_OBJECT
+ Q_CLASSINFO("ClassID", "{58139D56-6BE9-4b17-937D-1B1EDEDD5B71}")
+ Q_CLASSINFO("InterfaceID", "{B66280AB-08CC-4dcc-924F-58E6D7975B7D}")
+ Q_CLASSINFO("EventsID", "{D72BACBA-03C4-4480-B4BB-DE4FE3AA14A0}")
+ Q_CLASSINFO("ToSuperClass", "QAxWidget2")
+ Q_CLASSINFO("StockEvents", "yes")
+ Q_CLASSINFO("Insertable", "yes")
+
+ Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
+public:
+ QAxWidget2(QWidget *parent = 0)
+ : QWidget(parent), line_width( 1 )
+ {
+ }
+
+ int lineWidth() const
+ {
+ return line_width;
+ }
+ void setLineWidth( int lw )
+ {
+ line_width = lw;
+ repaint();
+ }
+
+protected:
+ void paintEvent( QPaintEvent *e )
+ {
+ QPainter paint( this );
+ QPen pen = paint.pen();
+ pen.setWidth( line_width );
+ paint.setPen( pen );
+
+ QRect r = rect();
+ r.adjust( 10, 10, -10, -10 );
+ paint.drawEllipse( r );
+ }
+
+private:
+ int line_width;
+};
+//! [0]
+
+#endif // AX2_H
diff --git a/examples/activeqt/multiple/main.cpp b/examples/activeqt/multiple/main.cpp
new file mode 100644
index 0000000..612292e
--- /dev/null
+++ b/examples/activeqt/multiple/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include "ax1.h"
+#include "ax2.h"
+#include <QAxFactory>
+
+QT_USE_NAMESPACE
+
+QAXFACTORY_BEGIN("{98DE28B6-6CD3-4e08-B9FA-3D1DB43F1D2F}", "{05828915-AD1C-47ab-AB96-D6AD1E25F0E2}")
+ QAXCLASS(QAxWidget1)
+ QAXCLASS(QAxWidget2)
+QAXFACTORY_END()
+//! [0]
diff --git a/examples/activeqt/multiple/multiple.inf b/examples/activeqt/multiple/multiple.inf
new file mode 100644
index 0000000..7f6be76
--- /dev/null
+++ b/examples/activeqt/multiple/multiple.inf
@@ -0,0 +1,9 @@
+[version]
+ signature="$CHICAGO$"
+ AdvancedINF=2.0
+ [Add.Code]
+ multipleax.dll=multipleax.dll
+ [multipleax.dll]
+ file-win32-x86=thiscab
+ clsid={1D9928BD-4453-4bdd-903D-E525ED17FDE5}
+ RegisterServer=yes
diff --git a/examples/activeqt/multiple/multiple.pro b/examples/activeqt/multiple/multiple.pro
new file mode 100644
index 0000000..7b86950
--- /dev/null
+++ b/examples/activeqt/multiple/multiple.pro
@@ -0,0 +1,16 @@
+TEMPLATE = lib
+TARGET = multipleax
+
+CONFIG += qt warn_off qaxserver dll
+contains(CONFIG, static):DEFINES += QT_NODLL
+
+SOURCES = main.cpp
+HEADERS = ax1.h ax2.h
+RC_FILE = multipleax.rc
+DEF_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.def
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/multiple
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS multiple.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/multiple
+INSTALLS += target sources
diff --git a/examples/activeqt/multiple/multipleax.rc b/examples/activeqt/multiple/multipleax.rc
new file mode 100644
index 0000000..1809e0d
--- /dev/null
+++ b/examples/activeqt/multiple/multipleax.rc
@@ -0,0 +1,32 @@
+#include "winver.h"
+
+1 TYPELIB "multipleax.rc"
+1 ICON DISCARDABLE "..\\..\\..\\src\\activeqt\\control\\qaxserver.ico"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x3fL
+ FILEOS 0x00040000L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)"
+ VALUE "FileDescription", "Multiple Example (ActiveQt)"
+ VALUE "FileVersion", "1.0.0.0"
+ VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)."
+ VALUE "InternalName", "multipleax.dll"
+ VALUE "OriginalFilename", "multipleax.dll"
+ VALUE "ProductName", "Multiple Example (ActiveQt)"
+ VALUE "ProductVersion", "1.0.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
diff --git a/examples/activeqt/opengl/glbox.cpp b/examples/activeqt/opengl/glbox.cpp
new file mode 100644
index 0000000..4cb015b
--- /dev/null
+++ b/examples/activeqt/opengl/glbox.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/****************************************************************************
+**
+** This is a simple QGLWidget displaying an openGL wireframe box
+**
+** The OpenGL code is mostly borrowed from Brian Pauls "spin" example
+** in the Mesa distribution
+**
+****************************************************************************/
+
+#include "glbox.h"
+#include <QAxAggregated>
+#include <QUuid>
+//! [0]
+#include <objsafe.h>
+//! [0]
+
+#if defined(Q_CC_MSVC)
+#pragma warning(disable:4305) // init: truncation from const double to float
+#endif
+
+/*!
+ Create a GLBox widget
+*/
+
+GLBox::GLBox( QWidget* parent, const char* name )
+ : QGLWidget( parent )
+{
+ xRot = yRot = zRot = 0.0; // default object rotation
+ scale = 1.25; // default object scale
+ object = 0;
+}
+
+
+/*!
+ Release allocated resources
+*/
+
+GLBox::~GLBox()
+{
+ makeCurrent();
+ glDeleteLists( object, 1 );
+}
+
+
+/*!
+ Paint the box. The actual openGL commands for drawing the box are
+ performed here.
+*/
+
+void GLBox::paintGL()
+{
+ glClear( GL_COLOR_BUFFER_BIT );
+
+ glLoadIdentity();
+ glTranslatef( 0.0, 0.0, -10.0 );
+ glScalef( scale, scale, scale );
+
+ glRotatef( xRot, 1.0, 0.0, 0.0 );
+ glRotatef( yRot, 0.0, 1.0, 0.0 );
+ glRotatef( zRot, 0.0, 0.0, 1.0 );
+
+ glCallList( object );
+}
+
+
+/*!
+ Set up the OpenGL rendering state, and define display list
+*/
+
+void GLBox::initializeGL()
+{
+ qglClearColor(Qt::black); // Let OpenGL clear to black
+ object = makeObject(); // Generate an OpenGL display list
+ glShadeModel( GL_FLAT );
+}
+
+
+
+/*!
+ Set up the OpenGL view port, matrix mode, etc.
+*/
+
+void GLBox::resizeGL( int w, int h )
+{
+ glViewport( 0, 0, (GLint)w, (GLint)h );
+ glMatrixMode( GL_PROJECTION );
+ glLoadIdentity();
+ glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
+ glMatrixMode( GL_MODELVIEW );
+}
+
+
+/*!
+ Generate an OpenGL display list for the object to be shown, i.e. the box
+*/
+
+GLuint GLBox::makeObject()
+{
+ GLuint list;
+
+ list = glGenLists( 1 );
+
+ glNewList( list, GL_COMPILE );
+
+ qglColor(Qt::white); // Shorthand for glColor3f or glIndex
+
+ glLineWidth( 2.0 );
+
+ glBegin( GL_LINE_LOOP );
+ glVertex3f( 1.0, 0.5, -0.4 );
+ glVertex3f( 1.0, -0.5, -0.4 );
+ glVertex3f( -1.0, -0.5, -0.4 );
+ glVertex3f( -1.0, 0.5, -0.4 );
+ glEnd();
+
+ glBegin( GL_LINE_LOOP );
+ glVertex3f( 1.0, 0.5, 0.4 );
+ glVertex3f( 1.0, -0.5, 0.4 );
+ glVertex3f( -1.0, -0.5, 0.4 );
+ glVertex3f( -1.0, 0.5, 0.4 );
+ glEnd();
+
+ glBegin( GL_LINES );
+ glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 );
+ glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( 1.0, -0.5, 0.4 );
+ glVertex3f( -1.0, -0.5, -0.4 ); glVertex3f( -1.0, -0.5, 0.4 );
+ glVertex3f( -1.0, 0.5, -0.4 ); glVertex3f( -1.0, 0.5, 0.4 );
+ glEnd();
+
+ glEndList();
+
+ return list;
+}
+
+
+/*!
+ Set the rotation angle of the object to \e degrees around the X axis.
+*/
+
+void GLBox::setXRotation( int degrees )
+{
+ xRot = (GLfloat)(degrees % 360);
+ updateGL();
+}
+
+
+/*!
+ Set the rotation angle of the object to \e degrees around the Y axis.
+*/
+
+void GLBox::setYRotation( int degrees )
+{
+ yRot = (GLfloat)(degrees % 360);
+ updateGL();
+}
+
+
+/*!
+ Set the rotation angle of the object to \e degrees around the Z axis.
+*/
+
+void GLBox::setZRotation( int degrees )
+{
+ zRot = (GLfloat)(degrees % 360);
+ updateGL();
+}
+
+//! [1]
+class ObjectSafetyImpl : public QAxAggregated,
+ public IObjectSafety
+{
+public:
+//! [1] //! [2]
+ ObjectSafetyImpl() {}
+
+ long queryInterface( const QUuid &iid, void **iface )
+ {
+ *iface = 0;
+ if ( iid == IID_IObjectSafety )
+ *iface = (IObjectSafety*)this;
+ else
+ return E_NOINTERFACE;
+
+ AddRef();
+ return S_OK;
+ }
+
+//! [2] //! [3]
+ QAXAGG_IUNKNOWN;
+
+//! [3] //! [4]
+ HRESULT WINAPI GetInterfaceSafetyOptions( REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions )
+ {
+ *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACESAFE_FOR_UNTRUSTED_CALLER;
+ *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACESAFE_FOR_UNTRUSTED_CALLER;
+ return S_OK;
+ }
+ HRESULT WINAPI SetInterfaceSafetyOptions( REFIID riid, DWORD pdwSupportedOptions, DWORD pdwEnabledOptions )
+ {
+ return S_OK;
+ }
+};
+//! [4] //! [5]
+
+QAxAggregated *GLBox::createAggregate()
+{
+ return new ObjectSafetyImpl();
+}
+//! [5]
diff --git a/examples/activeqt/opengl/glbox.h b/examples/activeqt/opengl/glbox.h
new file mode 100644
index 0000000..3ebf818
--- /dev/null
+++ b/examples/activeqt/opengl/glbox.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/****************************************************************************
+**
+** This is a simple QGLWidget displaying an openGL wireframe box
+**
+****************************************************************************/
+
+#ifndef GLBOX_H
+#define GLBOX_H
+
+#include <QtOpenGL>
+//! [0]
+#include <QAxBindable>
+
+class GLBox : public QGLWidget,
+ public QAxBindable
+{
+ Q_OBJECT
+//! [0] //! [1]
+
+public:
+
+ GLBox( QWidget* parent, const char* name = 0 );
+ ~GLBox();
+
+ QAxAggregated *createAggregate();
+
+public slots:
+
+ void setXRotation( int degrees );
+//! [1]
+ void setYRotation( int degrees );
+ void setZRotation( int degrees );
+
+protected:
+
+ void initializeGL();
+ void paintGL();
+ void resizeGL( int w, int h );
+
+ virtual GLuint makeObject();
+
+private:
+
+ GLuint object;
+ GLfloat xRot, yRot, zRot, scale;
+
+};
+
+#endif // GLBOX_H
diff --git a/examples/activeqt/opengl/globjwin.cpp b/examples/activeqt/opengl/globjwin.cpp
new file mode 100644
index 0000000..3ac5d78
--- /dev/null
+++ b/examples/activeqt/opengl/globjwin.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "globjwin.h"
+#include "glbox.h"
+#include <QPushButton>
+#include <QSlider>
+#include <QLayout>
+#include <QFrame>
+#include <QMenuBar>
+#include <QMenu>
+#include <QApplication>
+
+
+GLObjectWindow::GLObjectWindow(QWidget* parent)
+ : QWidget(parent)
+{
+
+ // Create a menu
+ QMenu *file = new QMenu( this );
+ file->addAction( "Exit", qApp, SLOT(quit())/*, CTRL+Key_Q*/);
+
+ // Create a menu bar
+ QMenuBar *m = new QMenuBar( this );
+ m->addMenu(file)->setText("&File");
+
+ // Create a nice frame to put around the OpenGL widget
+ QFrame* f = new QFrame(this);
+ f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
+ f->setLineWidth( 2 );
+
+ // Create our OpenGL widget
+ GLBox* c = new GLBox( f, "glbox");
+
+ // Create the three sliders; one for each rotation axis
+ QSlider* x = new QSlider(Qt::Vertical, this);
+ x->setMaximum(360);
+ x->setPageStep(60);
+ x->setTickPosition( QSlider::TicksLeft );
+ QObject::connect( x, SIGNAL(valueChanged(int)),c,SLOT(setXRotation(int)) );
+
+ QSlider* y = new QSlider(Qt::Vertical, this);
+ y->setMaximum(360);
+ y->setPageStep(60);
+ y->setTickPosition( QSlider::TicksLeft );
+ QObject::connect( y, SIGNAL(valueChanged(int)),c,SLOT(setYRotation(int)) );
+
+ QSlider* z = new QSlider(Qt::Vertical, this);
+ z->setMaximum(360);
+ z->setPageStep(60);
+ z->setTickPosition( QSlider::TicksLeft );
+ QObject::connect( z, SIGNAL(valueChanged(int)),c,SLOT(setZRotation(int)) );
+
+ // Now that we have all the widgets, put them into a nice layout
+
+ // Top level layout, puts the sliders to the left of the frame/GL widget
+ QHBoxLayout* hlayout = new QHBoxLayout(this);
+
+ // Put the sliders on top of each other
+ QVBoxLayout* vlayout = new QVBoxLayout();
+ vlayout->addWidget( x );
+ vlayout->addWidget( y );
+ vlayout->addWidget( z );
+
+ // Put the GL widget inside the frame
+ QHBoxLayout* flayout = new QHBoxLayout(f);
+ flayout->setMargin(0);
+ flayout->addWidget( c, 1 );
+
+ hlayout->setMenuBar( m );
+ hlayout->addLayout( vlayout );
+ hlayout->addWidget( f, 1 );
+}
diff --git a/examples/activeqt/opengl/globjwin.h b/examples/activeqt/opengl/globjwin.h
new file mode 100644
index 0000000..d707aa6
--- /dev/null
+++ b/examples/activeqt/opengl/globjwin.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/****************************************************************************
+**
+** The GLObjectWindow contains a GLBox and three sliders connected to
+** the GLBox's rotation slots.
+**
+****************************************************************************/
+
+#ifndef GLOBJWIN_H
+#define GLOBJWIN_H
+
+#include <qwidget.h>
+
+class GLObjectWindow : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GLObjectWindow(QWidget *parent = 0);
+};
+
+#endif
diff --git a/examples/activeqt/opengl/main.cpp b/examples/activeqt/opengl/main.cpp
new file mode 100644
index 0000000..469bdfb
--- /dev/null
+++ b/examples/activeqt/opengl/main.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//
+// Qt OpenGL example: Box
+//
+// A small example showing how a GLWidget can be used just as any Qt widget
+//
+// File: main.cpp
+//
+// The main() function
+//
+
+#include "globjwin.h"
+#include "glbox.h"
+#include <QApplication>
+#include <QtOpenGL>
+//! [0]
+#include <QAxFactory>
+
+QAXFACTORY_DEFAULT( GLBox,
+ "{5fd9c22e-ed45-43fa-ba13-1530bb6b03e0}",
+ "{33b051af-bb25-47cf-a390-5cfd2987d26a}",
+ "{8c996c29-eafa-46ac-a6f9-901951e765b5}",
+ "{2c3c183a-eeda-41a4-896e-3d9c12c3577d}",
+ "{83e16271-6480-45d5-aaf1-3f40b7661ae4}"
+ )
+
+//! [0] //! [1]
+/*
+ The main program is here.
+*/
+
+int main( int argc, char **argv )
+{
+ QApplication::setColorSpec( QApplication::CustomColor );
+ QApplication a(argc,argv);
+
+ if ( !QGLFormat::hasOpenGL() ) {
+ qWarning( "This system has no OpenGL support. Exiting." );
+ return -1;
+ }
+
+ if ( !QAxFactory::isServer() ) {
+ GLObjectWindow w;
+ w.resize( 400, 350 );
+ w.show();
+ return a.exec();
+//! [1] //! [2]
+ }
+ return a.exec();
+//! [2] //! [3]
+}
+//! [3]
diff --git a/examples/activeqt/opengl/opengl.inf b/examples/activeqt/opengl/opengl.inf
new file mode 100644
index 0000000..4a79e67
--- /dev/null
+++ b/examples/activeqt/opengl/opengl.inf
@@ -0,0 +1,9 @@
+[version]
+ signature="$CHICAGO$"
+ AdvancedINF=2.0
+ [Add.Code]
+ openglax.exe=openglax.exe
+ [openglax.exe]
+ file-win32-x86=thiscab
+ clsid={5fd9c22e-ed45-43fa-ba13-1530bb6b03e0}
+ RegisterServer=yes
diff --git a/examples/activeqt/opengl/opengl.pro b/examples/activeqt/opengl/opengl.pro
new file mode 100644
index 0000000..8eb81be
--- /dev/null
+++ b/examples/activeqt/opengl/opengl.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+TARGET = openglax
+
+CONFIG += qt warn_off qaxserver
+
+QT += opengl
+
+HEADERS = glbox.h \
+ globjwin.h
+SOURCES = glbox.cpp \
+ globjwin.cpp \
+ main.cpp
+RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/opengl
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS opengl.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/opengl
+INSTALLS += target sources
diff --git a/examples/activeqt/qutlook/addressview.cpp b/examples/activeqt/qutlook/addressview.cpp
new file mode 100644
index 0000000..281fe6a
--- /dev/null
+++ b/examples/activeqt/qutlook/addressview.cpp
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include "addressview.h"
+#include "msoutl.h"
+#include <QtGui>
+
+class AddressBookModel : public QAbstractListModel
+{
+public:
+ AddressBookModel(AddressView *parent);
+ ~AddressBookModel();
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QVariant data(const QModelIndex &index, int role) const;
+
+ void changeItem(const QModelIndex &index, const QString &firstName, const QString &lastName, const QString &address, const QString &email);
+ void addItem(const QString &firstName, const QString &lastName, const QString &address, const QString &email);
+ void update();
+
+private:
+ Outlook::Application outlook;
+ Outlook::Items * contactItems;
+
+ mutable QHash<QModelIndex, QStringList> cache;
+};
+//! [0] //! [1]
+
+AddressBookModel::AddressBookModel(AddressView *parent)
+: QAbstractListModel(parent)
+{
+ if (!outlook.isNull()) {
+ Outlook::NameSpace session(outlook.Session());
+ session.Logon();
+ Outlook::MAPIFolder *folder = session.GetDefaultFolder(Outlook::olFolderContacts);
+ contactItems = new Outlook::Items(folder->Items());
+ connect(contactItems, SIGNAL(ItemAdd(IDispatch*)), parent, SLOT(updateOutlook()));
+ connect(contactItems, SIGNAL(ItemChange(IDispatch*)), parent, SLOT(updateOutlook()));
+ connect(contactItems, SIGNAL(ItemRemove()), parent, SLOT(updateOutlook()));
+
+ delete folder;
+ }
+}
+
+//! [1] //! [2]
+AddressBookModel::~AddressBookModel()
+{
+ delete contactItems;
+
+ if (!outlook.isNull())
+ Outlook::NameSpace(outlook.Session()).Logoff();
+}
+
+//! [2] //! [3]
+int AddressBookModel::rowCount(const QModelIndex &) const
+{
+ return contactItems ? contactItems->Count() : 0;
+}
+
+int AddressBookModel::columnCount(const QModelIndex &parent) const
+{
+ return 4;
+}
+
+//! [3] //! [4]
+QVariant AddressBookModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ switch (section) {
+ case 0:
+ return tr("First Name");
+ case 1:
+ return tr("Last Name");
+ case 2:
+ return tr("Address");
+ case 3:
+ return tr("Email");
+ default:
+ break;
+ }
+
+ return QVariant();
+}
+
+//! [4] //! [5]
+QVariant AddressBookModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid() || role != Qt::DisplayRole)
+ return QVariant();
+
+ QStringList data;
+ if (cache.contains(index)) {
+ data = cache.value(index);
+ } else {
+ Outlook::ContactItem contact(contactItems->Item(index.row() + 1));
+ data << contact.FirstName() << contact.LastName() << contact.HomeAddress() << contact.Email1Address();
+ cache.insert(index, data);
+ }
+
+ if (index.column() < data.count())
+ return data.at(index.column());
+
+ return QVariant();
+}
+
+//! [5] //! [6]
+void AddressBookModel::changeItem(const QModelIndex &index, const QString &firstName, const QString &lastName, const QString &address, const QString &email)
+{
+ Outlook::ContactItem item(contactItems->Item(index.row() + 1));
+
+ item.SetFirstName(firstName);
+ item.SetLastName(lastName);
+ item.SetHomeAddress(address);
+ item.SetEmail1Address(email);
+
+ item.Save();
+
+ cache.take(index);
+}
+
+//! [6] //! [7]
+void AddressBookModel::addItem(const QString &firstName, const QString &lastName, const QString &address, const QString &email)
+{
+ Outlook::ContactItem item(outlook.CreateItem(Outlook::olContactItem));
+ if (!item.isNull()) {
+ item.SetFirstName(firstName);
+ item.SetLastName(lastName);
+ item.SetHomeAddress(address);
+ item.SetEmail1Address(email);
+
+ item.Save();
+ }
+}
+
+//! [7] //! [8]
+void AddressBookModel::update()
+{
+ cache.clear();
+
+ emit reset();
+}
+
+
+//! [8] //! [9]
+AddressView::AddressView(QWidget *parent)
+: QWidget(parent)
+{
+ QGridLayout *mainGrid = new QGridLayout(this);
+
+ QLabel *liFirstName = new QLabel("First &Name", this);
+ liFirstName->resize(liFirstName->sizeHint());
+ mainGrid->addWidget(liFirstName, 0, 0);
+
+ QLabel *liLastName = new QLabel("&Last Name", this);
+ liLastName->resize(liLastName->sizeHint());
+ mainGrid->addWidget(liLastName, 0, 1);
+
+ QLabel *liAddress = new QLabel("Add&ress", this);
+ liAddress->resize(liAddress->sizeHint());
+ mainGrid->addWidget(liAddress, 0, 2);
+
+ QLabel *liEMail = new QLabel("&E-Mail", this);
+ liEMail->resize(liEMail->sizeHint());
+ mainGrid->addWidget(liEMail, 0, 3);
+
+ add = new QPushButton("A&dd", this);
+ add->resize(add->sizeHint());
+ mainGrid->addWidget(add, 0, 4);
+ connect(add, SIGNAL(clicked()), this, SLOT(addEntry()));
+
+ iFirstName = new QLineEdit(this);
+ iFirstName->resize(iFirstName->sizeHint());
+ mainGrid->addWidget(iFirstName, 1, 0);
+ liFirstName->setBuddy(iFirstName);
+
+ iLastName = new QLineEdit(this);
+ iLastName->resize(iLastName->sizeHint());
+ mainGrid->addWidget(iLastName, 1, 1);
+ liLastName->setBuddy(iLastName);
+
+ iAddress = new QLineEdit(this);
+ iAddress->resize(iAddress->sizeHint());
+ mainGrid->addWidget(iAddress, 1, 2);
+ liAddress->setBuddy(iAddress);
+
+ iEMail = new QLineEdit(this);
+ iEMail->resize(iEMail->sizeHint());
+ mainGrid->addWidget(iEMail, 1, 3);
+ liEMail->setBuddy(iEMail);
+
+ change = new QPushButton("&Change", this);
+ change->resize(change->sizeHint());
+ mainGrid->addWidget(change, 1, 4);
+ connect(change, SIGNAL(clicked()), this, SLOT(changeEntry()));
+
+ treeView = new QTreeView(this);
+ treeView->setSelectionMode(QTreeView::SingleSelection);
+ treeView->setRootIsDecorated(false);
+
+ model = new AddressBookModel(this);
+ treeView->setModel(model);
+
+ connect(treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(itemSelected(QModelIndex)));
+
+ mainGrid->addWidget(treeView, 2, 0, 1, 5);
+}
+
+void AddressView::updateOutlook()
+{
+ model->update();
+}
+
+void AddressView::addEntry()
+{
+ if (!iFirstName->text().isEmpty() || !iLastName->text().isEmpty() ||
+ !iAddress->text().isEmpty() || !iEMail->text().isEmpty()) {
+ model->addItem(iFirstName->text(), iFirstName->text(), iAddress->text(), iEMail->text());
+ }
+
+ iFirstName->setText("");
+ iLastName->setText("");
+ iAddress->setText("");
+ iEMail->setText("");
+}
+
+void AddressView::changeEntry()
+{
+ QModelIndex current = treeView->currentIndex();
+
+ if (current.isValid())
+ model->changeItem(current, iFirstName->text(), iLastName->text(), iAddress->text(), iEMail->text());
+}
+
+//! [9] //! [10]
+void AddressView::itemSelected(const QModelIndex &index)
+{
+ if (!index.isValid())
+ return;
+
+ QAbstractItemModel *model = treeView->model();
+ iFirstName->setText(model->data(model->index(index.row(), 0)).toString());
+ iLastName->setText(model->data(model->index(index.row(), 1)).toString());
+ iAddress->setText(model->data(model->index(index.row(), 2)).toString());
+ iEMail->setText(model->data(model->index(index.row(), 3)).toString());
+}
+//! [10]
diff --git a/examples/activeqt/qutlook/addressview.h b/examples/activeqt/qutlook/addressview.h
new file mode 100644
index 0000000..5363cc1
--- /dev/null
+++ b/examples/activeqt/qutlook/addressview.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ADDRESSVIEW_H
+#define ADDRESSVIEW_H
+
+#include <QWidget>
+
+class AddressBookModel;
+QT_BEGIN_NAMESPACE
+class QLineEdit;
+class QModelIndex;
+class QPushButton;
+class QTreeView;
+QT_END_NAMESPACE
+
+//! [0]
+class AddressView : public QWidget
+{
+ Q_OBJECT
+
+public:
+ AddressView(QWidget *parent = 0);
+
+protected slots:
+ void addEntry();
+ void changeEntry();
+ void itemSelected(const QModelIndex &index);
+
+ void updateOutlook();
+
+protected:
+ AddressBookModel *model;
+
+ QTreeView *treeView;
+ QPushButton *add, *change;
+ QLineEdit *iFirstName, *iLastName, *iAddress, *iEMail;
+};
+//! [0]
+
+#endif // ADDRESSVIEW_H
diff --git a/examples/activeqt/qutlook/fileopen.xpm b/examples/activeqt/qutlook/fileopen.xpm
new file mode 100644
index 0000000..880417e
--- /dev/null
+++ b/examples/activeqt/qutlook/fileopen.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static const char *fileopen[] = {
+" 16 13 5 1",
+". c #040404",
+"# c #808304",
+"a c None",
+"b c #f3f704",
+"c c #f3f7f3",
+"aaaaaaaaa...aaaa",
+"aaaaaaaa.aaa.a.a",
+"aaaaaaaaaaaaa..a",
+"a...aaaaaaaa...a",
+".bcb.......aaaaa",
+".cbcbcbcbc.aaaaa",
+".bcbcbcbcb.aaaaa",
+".cbcb...........",
+".bcb.#########.a",
+".cb.#########.aa",
+".b.#########.aaa",
+"..#########.aaaa",
+"...........aaaaa"
+};
diff --git a/examples/activeqt/qutlook/fileprint.xpm b/examples/activeqt/qutlook/fileprint.xpm
new file mode 100644
index 0000000..6ada912
--- /dev/null
+++ b/examples/activeqt/qutlook/fileprint.xpm
@@ -0,0 +1,24 @@
+/* XPM */
+static const char *fileprint[] = {
+" 16 14 6 1",
+". c #000000",
+"# c #848284",
+"a c #c6c3c6",
+"b c #ffff00",
+"c c #ffffff",
+"d c None",
+"ddddd.........dd",
+"dddd.cccccccc.dd",
+"dddd.c.....c.ddd",
+"ddd.cccccccc.ddd",
+"ddd.c.....c....d",
+"dd.cccccccc.a.a.",
+"d..........a.a..",
+".aaaaaaaaaa.a.a.",
+".............aa.",
+".aaaaaa###aa.a.d",
+".aaaaaabbbaa...d",
+".............a.d",
+"d.aaaaaaaaa.a.dd",
+"dd...........ddd"
+};
diff --git a/examples/activeqt/qutlook/filesave.xpm b/examples/activeqt/qutlook/filesave.xpm
new file mode 100644
index 0000000..bd6870f
--- /dev/null
+++ b/examples/activeqt/qutlook/filesave.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static const char *filesave[] = {
+" 14 14 4 1",
+". c #040404",
+"# c #808304",
+"a c #bfc2bf",
+"b c None",
+"..............",
+".#.aaaaaaaa.a.",
+".#.aaaaaaaa...",
+".#.aaaaaaaa.#.",
+".#.aaaaaaaa.#.",
+".#.aaaaaaaa.#.",
+".#.aaaaaaaa.#.",
+".##........##.",
+".############.",
+".##.........#.",
+".##......aa.#.",
+".##......aa.#.",
+".##......aa.#.",
+"b............."
+};
diff --git a/examples/activeqt/qutlook/main.cpp b/examples/activeqt/qutlook/main.cpp
new file mode 100644
index 0000000..b015d8a
--- /dev/null
+++ b/examples/activeqt/qutlook/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include "addressview.h"
+#include <QApplication>
+
+int main(int argc, char ** argv)
+{
+ QApplication a(argc, argv);
+
+ AddressView view;
+ view.setWindowTitle("Qt Example - Looking at Outlook");
+ view.show();
+
+ return a.exec();
+}
+//! [0]
diff --git a/examples/activeqt/qutlook/qutlook.pro b/examples/activeqt/qutlook/qutlook.pro
new file mode 100644
index 0000000..c1154e0
--- /dev/null
+++ b/examples/activeqt/qutlook/qutlook.pro
@@ -0,0 +1,23 @@
+#! [0] #! [1]
+TEMPLATE = app
+TARGET = qutlook
+CONFIG += qaxcontainer
+
+TYPELIBS = $$system(dumpcpp -getfile {00062FFF-0000-0000-C000-000000000046})
+#! [0]
+
+isEmpty(TYPELIBS) {
+ message("Microsoft Outlook type library not found!")
+ REQUIRES += Outlook
+} else {
+#! [1] #! [2]
+ HEADERS = addressview.h
+ SOURCES = addressview.cpp main.cpp
+}
+#! [2]
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/qutlook
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS qutlook.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/qutlook
+INSTALLS += target sources
diff --git a/examples/activeqt/simple/main.cpp b/examples/activeqt/simple/main.cpp
new file mode 100644
index 0000000..7f939e4
--- /dev/null
+++ b/examples/activeqt/simple/main.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QAxBindable>
+#include <QAxFactory>
+#include <QApplication>
+#include <QLayout>
+#include <QSlider>
+#include <QLCDNumber>
+#include <QLineEdit>
+#include <QMessageBox>
+
+//! [0]
+class QSimpleAX : public QWidget, public QAxBindable
+{
+ Q_OBJECT
+ Q_PROPERTY( QString text READ text WRITE setText )
+ Q_PROPERTY( int value READ value WRITE setValue )
+public:
+ QSimpleAX(QWidget *parent = 0)
+ : QWidget(parent)
+ {
+ QVBoxLayout *vbox = new QVBoxLayout( this );
+
+ slider = new QSlider( Qt::Horizontal, this );
+ LCD = new QLCDNumber( 3, this );
+ edit = new QLineEdit( this );
+
+ connect( slider, SIGNAL( valueChanged( int ) ), this, SLOT( setValue(int) ) );
+ connect( edit, SIGNAL(textChanged(const QString&)), this, SLOT(setText(const QString&)) );
+
+ vbox->addWidget( slider );
+ vbox->addWidget( LCD );
+ vbox->addWidget( edit );
+ }
+
+ QString text() const
+ {
+ return edit->text();
+ }
+ int value() const
+ {
+ return slider->value();
+ }
+
+signals:
+ void someSignal();
+ void valueChanged(int);
+ void textChanged(const QString&);
+
+public slots:
+ void setText( const QString &string )
+ {
+ if ( !requestPropertyChange( "text" ) )
+ return;
+
+ edit->blockSignals( true );
+ edit->setText( string );
+ edit->blockSignals( false );
+ emit someSignal();
+ emit textChanged( string );
+
+ propertyChanged( "text" );
+ }
+ void about()
+ {
+ QMessageBox::information( this, "About QSimpleAX", "This is a Qt widget, and this slot has been\n"
+ "called through ActiveX/OLE automation!" );
+ }
+ void setValue( int i )
+ {
+ if ( !requestPropertyChange( "value" ) )
+ return;
+ slider->blockSignals( true );
+ slider->setValue( i );
+ slider->blockSignals( false );
+ LCD->display( i );
+ emit valueChanged( i );
+
+ propertyChanged( "value" );
+ }
+
+private:
+ QSlider *slider;
+ QLCDNumber *LCD;
+ QLineEdit *edit;
+};
+
+//! [0]
+#include "main.moc"
+
+//! [1]
+QAXFACTORY_DEFAULT(QSimpleAX,
+ "{DF16845C-92CD-4AAB-A982-EB9840E74669}",
+ "{616F620B-91C5-4410-A74E-6B81C76FFFE0}",
+ "{E1816BBA-BF5D-4A31-9855-D6BA432055FF}",
+ "{EC08F8FC-2754-47AB-8EFE-56A54057F34E}",
+ "{A095BA0C-224F-4933-A458-2DD7F6B85D8F}")
+//! [1]
diff --git a/examples/activeqt/simple/simple.inf b/examples/activeqt/simple/simple.inf
new file mode 100644
index 0000000..3657e9f
--- /dev/null
+++ b/examples/activeqt/simple/simple.inf
@@ -0,0 +1,11 @@
+//! [0]
+[version]
+ signature="$CHICAGO$"
+ AdvancedINF=2.0
+ [Add.Code]
+ simpleax.exe=simpleax.exe
+ [simpleax.exe]
+ file-win32-x86=thiscab
+ clsid={DF16845C-92CD-4AAB-A982-EB9840E74669}
+ RegisterServer=yes
+//! [0]
diff --git a/examples/activeqt/simple/simple.pro b/examples/activeqt/simple/simple.pro
new file mode 100644
index 0000000..d0f2019
--- /dev/null
+++ b/examples/activeqt/simple/simple.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+TARGET = simpleax
+
+CONFIG += qt warn_off qaxserver
+
+SOURCES = main.cpp
+RC_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.rc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/simple
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS simple.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/simple
+INSTALLS += target sources
diff --git a/examples/activeqt/webbrowser/main.cpp b/examples/activeqt/webbrowser/main.cpp
new file mode 100644
index 0000000..fe93eab
--- /dev/null
+++ b/examples/activeqt/webbrowser/main.cpp
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QMessageBox>
+#include <QProgressBar>
+#include <QStatusBar>
+#include <QMainWindow>
+#include <QAbstractEventDispatcher>
+
+#if defined(Q_OS_WINCE)
+#include "ui_wincemainwindow.h"
+#include <windows.h>
+#else
+#include "ui_mainwindow.h"
+#endif
+
+//! [0]
+class MainWindow : public QMainWindow, public Ui::MainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow();
+
+public slots:
+ void on_WebBrowser_TitleChange(const QString &title);
+ void on_WebBrowser_ProgressChange(int a, int b);
+ void on_WebBrowser_CommandStateChange(int cmd, bool on);
+ void on_WebBrowser_BeforeNavigate();
+ void on_WebBrowser_NavigateComplete(QString);
+
+ void on_actionGo_triggered();
+ void on_actionNewWindow_triggered();
+ void on_actionAbout_triggered();
+ void on_actionAboutQt_triggered();
+ void on_actionFileClose_triggered();
+
+private:
+ QProgressBar *pb;
+};
+//! [0] //! [1]
+
+MainWindow::MainWindow()
+{
+ setupUi(this);
+
+ connect(addressEdit, SIGNAL(returnPressed()), actionGo, SLOT(trigger()));
+ connect(actionBack, SIGNAL(triggered()), WebBrowser, SLOT(GoBack()));
+ connect(actionForward, SIGNAL(triggered()), WebBrowser, SLOT(GoForward()));
+ connect(actionStop, SIGNAL(triggered()), WebBrowser, SLOT(Stop()));
+ connect(actionRefresh, SIGNAL(triggered()), WebBrowser, SLOT(Refresh()));
+ connect(actionHome, SIGNAL(triggered()), WebBrowser, SLOT(GoHome()));
+ connect(actionSearch, SIGNAL(triggered()), WebBrowser, SLOT(GoSearch()));
+
+ pb = new QProgressBar(statusBar());
+ pb->setTextVisible(false);
+ pb->hide();
+ statusBar()->addPermanentWidget(pb);
+
+ WebBrowser->dynamicCall("GoHome()");
+}
+
+//! [1] //! [2]
+void MainWindow::on_WebBrowser_TitleChange(const QString &title)
+{
+ setWindowTitle("Qt WebBrowser - " + title);
+}
+
+void MainWindow::on_WebBrowser_ProgressChange(int a, int b)
+{
+ if (a <= 0 || b <= 0) {
+ pb->hide();
+ return;
+ }
+ pb->show();
+ pb->setRange(0, b);
+ pb->setValue(a);
+}
+
+void MainWindow::on_WebBrowser_CommandStateChange(int cmd, bool on)
+{
+ switch (cmd) {
+ case 1:
+ actionForward->setEnabled(on);
+ break;
+ case 2:
+ actionBack->setEnabled(on);
+ break;
+ }
+}
+
+void MainWindow::on_WebBrowser_BeforeNavigate()
+{
+ actionStop->setEnabled(true);
+}
+
+void MainWindow::on_WebBrowser_NavigateComplete(QString)
+{
+ actionStop->setEnabled(false);
+}
+
+//! [2] //! [3]
+void MainWindow::on_actionGo_triggered()
+{
+ WebBrowser->dynamicCall("Navigate(const QString&)", addressEdit->text());
+}
+
+void MainWindow::on_actionNewWindow_triggered()
+{
+ MainWindow *window = new MainWindow;
+ window->show();
+ if (addressEdit->text().isEmpty())
+ return;
+ window->addressEdit->setText(addressEdit->text());
+ window->actionStop->setEnabled(true);
+ window->on_actionGo_triggered();
+}
+
+void MainWindow::on_actionAbout_triggered()
+{
+ QMessageBox::about(this, tr("About WebBrowser"),
+ tr("This Example has been created using the ActiveQt integration into Qt Designer.\n"
+ "It demonstrates the use of QAxWidget to embed the Internet Explorer ActiveX\n"
+ "control into a Qt application."));
+}
+
+void MainWindow::on_actionAboutQt_triggered()
+{
+ QMessageBox::aboutQt(this, tr("About Qt"));
+}
+
+void MainWindow::on_actionFileClose_triggered()
+{
+ close();
+}
+
+#include "main.moc"
+
+//! [3] //! [4]
+int main(int argc, char ** argv)
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+#if defined(Q_OS_WINCE)
+ w.showMaximized();
+#else
+ w.show();
+#endif
+ return a.exec();
+}
+//! [4]
diff --git a/examples/activeqt/webbrowser/mainwindow.ui b/examples/activeqt/webbrowser/mainwindow.ui
new file mode 100644
index 0000000..12a0a32
--- /dev/null
+++ b/examples/activeqt/webbrowser/mainwindow.ui
@@ -0,0 +1,306 @@
+<ui version="4.0" stdsetdef="1" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="objectName" >
+ <string notr="true" >MainWindow</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>812</width>
+ <height>605</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Qt WebBrowser</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QHBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" >unnamed</string>
+ </property>
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QFrame" name="Frame3" >
+ <property name="objectName" >
+ <string notr="true" >Frame3</string>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" >unnamed</string>
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="WebAxWidget" name="WebBrowser" >
+ <property name="objectName" >
+ <string notr="true" >WebBrowser</string>
+ </property>
+ <property name="focusPolicy" >
+ <enum>Qt::StrongFocus</enum>
+ </property>
+ <property name="control" >
+ <string>{8856F961-340A-11D0-A96B-00C04FD705A2}</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QToolBar" name="tbNavigate" >
+ <property name="objectName" >
+ <string notr="true" >tbNavigate</string>
+ </property>
+ <property name="windowTitle" >
+ <string>Navigation</string>
+ </property>
+ <addaction name="actionBack" />
+ <addaction name="actionForward" />
+ <addaction name="actionStop" />
+ <addaction name="actionRefresh" />
+ <addaction name="actionHome" />
+ <addaction name="separator" />
+ <addaction name="actionSearch" />
+ </widget>
+ <widget class="QToolBar" name="tbAddress" >
+ <property name="objectName" >
+ <string notr="true" >tbAddress</string>
+ </property>
+ <property name="windowTitle" >
+ <string>Address</string>
+ </property>
+ <widget class="QLabel" name="lblAddress" >
+ <property name="objectName" >
+ <string notr="true" >lblAddress</string>
+ </property>
+ <property name="text" >
+ <string>Address</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="addressEdit" >
+ <property name="objectName" >
+ <string notr="true" >addressEdit</string>
+ </property>
+ </widget>
+ <addaction name="actionGo" />
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="objectName" >
+ <string notr="true" >menubar</string>
+ </property>
+ <widget class="QMenu" name="PopupMenu" >
+ <property name="objectName" >
+ <string notr="true" >PopupMenu</string>
+ </property>
+ <property name="title" >
+ <string>&amp;File</string>
+ </property>
+ <widget class="QMenu" name="FileNewGroup_2" >
+ <property name="objectName" >
+ <string notr="true" >FileNewGroup_2</string>
+ </property>
+ <property name="title" >
+ <string>New</string>
+ </property>
+ <addaction name="actionNewWindow" />
+ </widget>
+ <addaction name="FileNewGroup" />
+ <addaction name="FileNewGroup_2" />
+ <addaction name="separator" />
+ <addaction name="actionFileClose" />
+ </widget>
+ <widget class="QMenu" name="unnamed" >
+ <property name="objectName" >
+ <string notr="true" >unnamed</string>
+ </property>
+ <property name="title" >
+ <string>&amp;Help</string>
+ </property>
+ <addaction name="actionAbout" />
+ <addaction name="actionAboutQt" />
+ </widget>
+ <addaction name="PopupMenu" />
+ <addaction name="unnamed" />
+ </widget>
+ <action name="actionGo" >
+ <property name="objectName" >
+ <string>actionGo</string>
+ </property>
+ <property name="icon" >
+ <iconset>image0</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Go</string>
+ </property>
+ </action>
+ <action name="actionBack" >
+ <property name="objectName" >
+ <string>actionBack</string>
+ </property>
+ <property name="icon" >
+ <iconset>image1</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Back</string>
+ </property>
+ <property name="shortcut" >
+ <string>Backspace</string>
+ </property>
+ </action>
+ <action name="actionForward" >
+ <property name="objectName" >
+ <string>actionForward</string>
+ </property>
+ <property name="icon" >
+ <iconset>image2</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Forward</string>
+ </property>
+ </action>
+ <action name="actionStop" >
+ <property name="objectName" >
+ <string>actionStop</string>
+ </property>
+ <property name="icon" >
+ <iconset>image3</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Stop</string>
+ </property>
+ </action>
+ <action name="actionRefresh" >
+ <property name="objectName" >
+ <string>actionRefresh</string>
+ </property>
+ <property name="icon" >
+ <iconset>image4</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Refresh</string>
+ </property>
+ </action>
+ <action name="actionHome" >
+ <property name="objectName" >
+ <string>actionHome</string>
+ </property>
+ <property name="icon" >
+ <iconset>image5</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Home</string>
+ </property>
+ </action>
+ <action name="actionFileClose" >
+ <property name="objectName" >
+ <string>actionFileClose</string>
+ </property>
+ <property name="iconText" >
+ <string>Close</string>
+ </property>
+ <property name="text" >
+ <string>C&amp;lose</string>
+ </property>
+ </action>
+ <action name="actionSearch" >
+ <property name="objectName" >
+ <string>actionSearch</string>
+ </property>
+ <property name="icon" >
+ <iconset>image6</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Search</string>
+ </property>
+ </action>
+ <action name="actionAbout" >
+ <property name="objectName" >
+ <string>actionAbout</string>
+ </property>
+ <property name="iconText" >
+ <string>About</string>
+ </property>
+ </action>
+ <action name="actionAboutQt" >
+ <property name="objectName" >
+ <string>actionAboutQt</string>
+ </property>
+ <property name="iconText" >
+ <string>About Qt</string>
+ </property>
+ </action>
+ <actiongroup name="FileNewGroup" >
+ <action name="actionNewWindow" >
+ <property name="objectName" >
+ <string>actionNewWindow</string>
+ </property>
+ <property name="iconText" >
+ <string>Window</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <property name="objectName" >
+ <string>FileNewGroup</string>
+ </property>
+ </actiongroup>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>WebAxWidget</class>
+ <extends>QAxWidget</extends>
+ <header>webaxwidget.h</header>
+ </customwidget>
+ </customwidgets>
+ <connections>
+ <connection>
+ <sender>addressEdit</sender>
+ <signal>returnPressed()</signal>
+ <receiver>actionGo</receiver>
+ <slot>trigger()</slot>
+ </connection>
+ </connections>
+ <layoutdefault spacing="6" margin="11" />
+ <images>
+ <image name="image0" >
+ <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563</data>
+ </image>
+ <image name="image1" >
+ <data format="XPM.GZ" length="4494" >789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906</data>
+ </image>
+ <image name="image2" >
+ <data format="XPM.GZ" length="4494" >789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868</data>
+ </image>
+ <image name="image3" >
+ <data format="XPM.GZ" length="802" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974</data>
+ </image>
+ <image name="image4" >
+ <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853</data>
+ </image>
+ <image name="image5" >
+ <data format="XPM.GZ" length="5598" >789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf</data>
+ </image>
+ <image name="image6" >
+ <data format="XPM.GZ" length="3742" >789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635</data>
+ </image>
+ </images>
+</ui>
diff --git a/examples/activeqt/webbrowser/webaxwidget.h b/examples/activeqt/webbrowser/webaxwidget.h
new file mode 100644
index 0000000..0e82311
--- /dev/null
+++ b/examples/activeqt/webbrowser/webaxwidget.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WEBAXWIDGET_H
+#define WEBAXWIDGET_H
+
+#include <ActiveQt/QAxWidget>
+#include "windows.h"
+
+class WebAxWidget : public QAxWidget
+{
+public:
+
+ WebAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0)
+ : QAxWidget(parent, f)
+ {
+ }
+protected:
+ virtual bool translateKeyEvent(int message, int keycode) const
+ {
+ if (message >= WM_KEYFIRST && message <= WM_KEYLAST)
+ return true;
+ else
+ return QAxWidget::translateKeyEvent(message, keycode);
+ }
+
+};
+
+#endif // WEBAXWIDGET_H
diff --git a/examples/activeqt/webbrowser/webbrowser.pro b/examples/activeqt/webbrowser/webbrowser.pro
new file mode 100644
index 0000000..992d871
--- /dev/null
+++ b/examples/activeqt/webbrowser/webbrowser.pro
@@ -0,0 +1,17 @@
+TEMPLATE = app
+
+CONFIG += qaxcontainer
+
+QTDIR_build:REQUIRES = shared
+
+HEADERS = webaxwidget.h
+SOURCES = main.cpp
+FORMS = mainwindow.ui
+wince*: FORMS = wincemainwindow.ui
+
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/webbrowser
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS webbrowser.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/webbrowser
+INSTALLS += target sources
diff --git a/examples/activeqt/webbrowser/wincemainwindow.ui b/examples/activeqt/webbrowser/wincemainwindow.ui
new file mode 100644
index 0000000..98a9ddb
--- /dev/null
+++ b/examples/activeqt/webbrowser/wincemainwindow.ui
@@ -0,0 +1,299 @@
+<ui version="4.0" stdsetdef="1" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="objectName" >
+ <string notr="true" >MainWindow</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>812</width>
+ <height>605</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Qt WebBrowser</string>
+ </property>
+ <widget class="QWidget" name="centralWidget">
+ <layout class="QHBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" >unnamed</string>
+ </property>
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QFrame" name="Frame3" >
+ <property name="objectName" >
+ <string notr="true" >Frame3</string>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" >unnamed</string>
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QAxWidget" name="WebBrowser" >
+ <property name="objectName" >
+ <string notr="true" >WebBrowser</string>
+ </property>
+ <property name="focusPolicy" >
+ <enum>Qt::StrongFocus</enum>
+ </property>
+ <property name="control" >
+ <string>{F5AFC7EF-1571-48B6-A69C-F1833F4C3A44}</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QToolBar" name="tbNavigate" >
+ <property name="objectName" >
+ <string notr="true" >tbNavigate</string>
+ </property>
+ <property name="windowTitle" >
+ <string>Navigation</string>
+ </property>
+ <addaction name="actionBack" />
+ <addaction name="actionForward" />
+ <addaction name="actionStop" />
+ <addaction name="actionRefresh" />
+ <addaction name="actionHome" />
+ <addaction name="separator" />
+ <addaction name="actionSearch" />
+ </widget>
+ <widget class="QToolBar" name="tbAddress" >
+ <property name="objectName" >
+ <string notr="true" >tbAddress</string>
+ </property>
+ <property name="windowTitle" >
+ <string>Address</string>
+ </property>
+ <widget class="QLabel" name="lblAddress" >
+ <property name="objectName" >
+ <string notr="true" >lblAddress</string>
+ </property>
+ <property name="text" >
+ <string>Address</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="addressEdit" >
+ <property name="objectName" >
+ <string notr="true" >addressEdit</string>
+ </property>
+ </widget>
+ <addaction name="actionGo" />
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="objectName" >
+ <string notr="true" >menubar</string>
+ </property>
+ <widget class="QMenu" name="PopupMenu" >
+ <property name="objectName" >
+ <string notr="true" >PopupMenu</string>
+ </property>
+ <property name="title" >
+ <string>&amp;File</string>
+ </property>
+ <widget class="QMenu" name="FileNewGroup_2" >
+ <property name="objectName" >
+ <string notr="true" >FileNewGroup_2</string>
+ </property>
+ <property name="title" >
+ <string>New</string>
+ </property>
+ <addaction name="actionNewWindow" />
+ </widget>
+ <addaction name="FileNewGroup" />
+ <addaction name="FileNewGroup_2" />
+ <addaction name="separator" />
+ <addaction name="actionFileClose" />
+ </widget>
+ <widget class="QMenu" name="unnamed" >
+ <property name="objectName" >
+ <string notr="true" >unnamed</string>
+ </property>
+ <property name="title" >
+ <string>&amp;Help</string>
+ </property>
+ <addaction name="actionAbout" />
+ <addaction name="actionAboutQt" />
+ </widget>
+ <addaction name="PopupMenu" />
+ <addaction name="unnamed" />
+ </widget>
+ <action name="actionGo" >
+ <property name="objectName" >
+ <string>actionGo</string>
+ </property>
+ <property name="icon" >
+ <iconset>image0</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Go</string>
+ </property>
+ </action>
+ <action name="actionBack" >
+ <property name="objectName" >
+ <string>actionBack</string>
+ </property>
+ <property name="icon" >
+ <iconset>image1</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Back</string>
+ </property>
+ <property name="shortcut" >
+ <string>Backspace</string>
+ </property>
+ </action>
+ <action name="actionForward" >
+ <property name="objectName" >
+ <string>actionForward</string>
+ </property>
+ <property name="icon" >
+ <iconset>image2</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Forward</string>
+ </property>
+ </action>
+ <action name="actionStop" >
+ <property name="objectName" >
+ <string>actionStop</string>
+ </property>
+ <property name="icon" >
+ <iconset>image3</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Stop</string>
+ </property>
+ </action>
+ <action name="actionRefresh" >
+ <property name="objectName" >
+ <string>actionRefresh</string>
+ </property>
+ <property name="icon" >
+ <iconset>image4</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Refresh</string>
+ </property>
+ </action>
+ <action name="actionHome" >
+ <property name="objectName" >
+ <string>actionHome</string>
+ </property>
+ <property name="icon" >
+ <iconset>image5</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Home</string>
+ </property>
+ </action>
+ <action name="actionFileClose" >
+ <property name="objectName" >
+ <string>actionFileClose</string>
+ </property>
+ <property name="iconText" >
+ <string>Close</string>
+ </property>
+ <property name="text" >
+ <string>C&amp;lose</string>
+ </property>
+ </action>
+ <action name="actionSearch" >
+ <property name="objectName" >
+ <string>actionSearch</string>
+ </property>
+ <property name="icon" >
+ <iconset>image6</iconset>
+ </property>
+ <property name="iconText" >
+ <string>Search</string>
+ </property>
+ </action>
+ <action name="actionAbout" >
+ <property name="objectName" >
+ <string>actionAbout</string>
+ </property>
+ <property name="iconText" >
+ <string>About</string>
+ </property>
+ </action>
+ <action name="actionAboutQt" >
+ <property name="objectName" >
+ <string>actionAboutQt</string>
+ </property>
+ <property name="iconText" >
+ <string>About Qt</string>
+ </property>
+ </action>
+ <actiongroup name="FileNewGroup" >
+ <action name="actionNewWindow" >
+ <property name="objectName" >
+ <string>actionNewWindow</string>
+ </property>
+ <property name="iconText" >
+ <string>Window</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <property name="objectName" >
+ <string>FileNewGroup</string>
+ </property>
+ </actiongroup>
+ </widget>
+ <connections>
+ <connection>
+ <sender>addressEdit</sender>
+ <signal>returnPressed()</signal>
+ <receiver>actionGo</receiver>
+ <slot>trigger()</slot>
+ </connection>
+ </connections>
+ <layoutdefault spacing="6" margin="11" />
+ <images>
+ <image name="image0" >
+ <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54103b11c8563600020b03105719c4b530b08072f50880513560a09c080338d5209420294a4451a38c90426621ab5146d10de524a2aa417505445122861a547722bb0c971a3d2aa921c2ae446c6a9431fc85a9064551220e354009653dec00294e712a1ac4e97078a9a9b5e6020013b3f563</data>
+ </image>
+ <image name="image1" >
+ <data format="XPM.GZ" length="4494" >789ce596497332470c86effe15947573a5f4c1cc30cc542a07ef60bc808dd7540e3d9b6df006186c93ca7f8fba2535ce57be98dc9292313c487a2575f7ccf063a376d53baa6dfc589bbe9ad7fbbc96df99496da3983d3e7efcfec76f7faead87418dfe1a51500bd67f595befbfd6f2daf1f35369014e08a05e6fd4ab96e31e73d0282bc7a7cae23ff3ccfe8170ca6cee9843f51f3b4ec8cff9efccdebf2d2cf9b06bb9417a25c74f98bdff99390a84fb8e49af70f39891b2e40bfbf8b6b0917e87968346a8f5a6cc51c07ab02f2cf1983237552f709c86691e3bbd5be5821998a32067bd1765d13f67563d530a4b3df8b01c523d8ec74059faed086bfc82390e851b8ed3c86485e34365a9bfc5ece3df8433e10bcb5140f5dd3cf0e099f32f99e350cecb5858f2b1c1dc52fda663d334a277c0ecfd5d61c9373973120967969b548fd71b079e797d8e985b21eb63aecceb85e7c299f4ffaa2ce7739359ebc195631387c6ad1f5e302791ccbba72cf173e15cfa2d2cc7619cf1fa63c9dccaa4ff4bcfdc7fa82cfdf7999348f6bf299c4bfd4c59ea0f99535dafca71d60a65ffebca52ff8c3989e47cce98351fb785759e7bcbad65bf0be624ca9a8e87caac0fb1702ef191b2cc9731a7b9ec4f87d934659e27e142f8c671e6eb9d0ae7b2be07cc6924ccf999698a7e4f58f572e64cebb9f393444994e68e4365d9ff7be15caef70766ad678cb0f8f18359ebe109b3af27f199fadd794cf254eb196599774758e77d5496f5dd64a67959af122ef87c639b59eb81d34ba97fe3f4215196f3922acbbc28acf527cc792c7a857029ecf63bcded05efb8a52cf3cc9833ed2f66563dac0b8b1ebe3317ea77f73352173db8f6ccf54a66df0f30fb7c777d9bc214d2cf88d9cf73cfece3ddf3296b66da7fe199d7a32b5cc8feef31fbfe8f99bdde96b0faddf3272bac390665b99e90d9e7ef33972de9d73d7ff3d873255c49fc1b73257ee4f8d2eb5d336b3e8e8535ff86d9e7bbf35f2cf51366ef77cfeb6299df62563f3c0a8b1fdcf3d3569778773f756e66f7fcac967e175f797ffff5dfd9ff4103010d6698a35955030b2cb1c25bbcc3fbd5344861882352b8c5077c5c45836678c267ca7fc1314ebeaf81537cc599eb608e6ff88e1f2b682c705314b6486182dbb8f31d0ddca529f644619ff2db641d3cf82a8bfa9d62d7da670d3cc4233c760a63eaa08d2734478fac8f87ffc833788a6738c073bc20ebe3255eb1069d863e5e3b851bacfb7c6b0d0c30c488f24a3a2d4ddaf1986a3d600b13179be280ef597809e876e206000c69d8ec0e590f32c8a18012b7a0825b9799e018eee0de4e0b4318c103ff2ea2985b78c47d28a487ce276b634cca40356d1655801c3bf044af2136e0195ef8b711be4045ab50ff42e16bdbb6463d8e610253fe3d4855ec3ed80abd9f62397ef9c9e6cee835249bc31bbc731ff0010beacbcdbfaca29f2836a3e839fd1f3acb5cb6fd6e13b6605b34766097d6664cdf0d7faad9813dd827df08daf4de812ddaa7061c4017baf43ea6daef70c8fb0247704c932dc897b94e67da09553a811ef4a94a0f4ee10c069435216b630ae7a43b800b7fc6164ea543ea73ea75663b22a50e5cc215ec50956beaf606ead08080147b64c76403d20ebdc6142268528d3655ee3a1db6f88b535ee015b42081d4205ee1f4f335878501ea7644331dc81acecdb7ef63b86b32eae59956cff63237f92af7319c9a82669c989256bd0b6fa6fabe86bbfe0ecdadb9a399ce61b49a86355adfbedd45736756bc27b30afd161a9a9179585de33bf69fd2f8ebd7b5bf014644b906</data>
+ </image>
+ <image name="image2" >
+ <data format="XPM.GZ" length="4494" >789ce5965b4f23471085dff915d6d6db2aaac5e3b92aca037703cbc55c8c21ca43cf8c8d0dd85c6c307694ff9eeaaed3bd68771f968d14298a0a109fabebd4e99a9ef17cfad8e81d1f343e7e5a99cecc6c5435aaa1796a7cac9fc7e3c5ef7ffcf6e7ca8756d4909f661c35a20fbfac7ce8cc1a55e3f07ed2b7409702b4badaccfb996563020f5c7ecbf340b9a31c3591dff7ac7943e002cc8e73cf74acdcc27a8a2d37a5be4e1d9f04567f9fc105f25dcfea9726caad62a07c1158f58f94e3087e868ea57fa5fa0be590bfb11c3525affd4e03ebfa25b8507fbcaa1c47ca66e459fdf10c6c30af4dcfda8f5f9513dfffce71e1f5a956967adddfaeb25f4f7b60e8d199e596f42f6bc787ca213f554e5be06dc7a28ffdee282791cedb5c83d19fd795a55ecf4b3fb0ee07ebd312fae796e3283665e238524e2265de031bcc774d396d61be25b8c4fe1f02abfeab67f49f2867decfbd6393b6a03f03438f3bca19fa51cb33fc6f80fd7eae2c27e257e7cb4de5b4045f78d679f24960ddcfb172e6f73357ce63e88fc115ce43e558fcabbeb905fb7e47cae24ff5daca41af007bbd81e5b425f53aff6160d52f95f318f37d01a39ee7ca05f4790a469e0e1c97590bfa1b81f53c3e2bfbf5ecf697b532efe754398f31af437085eb65948b18e723f70cbf9e2bcc633db0f65b533609fcbafb372bf318fdcfc015e65b281731ee0ff6acf70767ca5e8f7be01abcab5cfa7e89e53cce2ba3fd1681b5df8172013f44e00acfbf4a39e8ef287b7dbe02234feefce795d727a36c12ccf75239d4b7c1bede9def42fcc0ef7960d5cbc05ebf543635aed752b94aa1ff02ee83ddf3b6a87c3d3f2b9b047a4fcaa17e0cf6f5eef928ab13f5476960d5eb7ac6f5dd07d7e04839e83d29d7be9ffbfe31b50dc723cfa87f08acf947e51a7ad457ee6760773ecaa4f47e36036bfd96673c3fb6c13578a01cf41f9505d5af3b2f655dc28fa93da33e550ef523e5e06f08861eb9e7b94cdfe7ddf753d50feb6f94437e00f67edcf3aa4e831ed8afe73bb05fefe655f7c37edcfd62bb81ddfb82935776cfeb41c87766ff2cfe7f1a4c6cb8e48ae91f68d4dce7015ff390473fad71c3b77cc7639ef03d3ffcb48f013ff293a84c79c6d54f693c8bc28b28589539bff2e2ed647e586389184bacf13a6ff0e6d71a32f92dde96bfdf9dbccc6387dba2d086caae4c668ff7bf68f0673ee0433ee263eef0099ff2199f8b62d0e32e5f704fea2fe5b70d3f57729556b91b349a1c718b634e64faa9fc7fc919e772220a91213254ca273b884bf72b4a54f1846ad925e93b1af56940d734a4110fe4efb5c40dddda907311734c7752d10b3a1ae289c634a17b7dafe331e995b3b124fbdfd25d85471763596fab7aa2a4f53d444653ded3773bb96e8faeae1de2ea8dff9da0b0ebfcd858e3357aa667bb1f68b4a5e7d256853559e8f56d64aefe85e6f44a0b5aea3bac5c2bebf74b8775fb6bfbb858771e7a6f1df09c36f89a36698bb6f53d5c4ef08ee4e6a2dd269b9d488729ed4a171b7bd40ece3228cce5d305edd3673ed7773139bd133a14d5233a96cff7a9237142a77446e7125dba900e70681564f5a6acdc1285ae9e0feaf150d675e8d2d59dd315ad52931fec2973d1a5489c6698e29c5a508829797bd629a52665bcf9fdd32ed95c1d50217b5c18b67390f34befb8e78873a9b6b39ad285216328a2de3bef5b32a59db5ccec42a6b565aaf7dffba6e663d3972b211ea86b065f3cbccbc7b53890399a21a55f677f5863e4f670c337df667f58e3d6dc99dbef3dd5ff6bdf73ff82c65fbfaefc0d4fb5b868</data>
+ </image>
+ <image name="image3" >
+ <data format="XPM.GZ" length="802" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325500210543251d2e25658564056503300071f540dc3430007371012a492a830156496538c094848922c9c2259134c099304914e3604c8424aa5e6449b0044216ca824ba2da8b4512218b4d122e8b55520fee5974072164511da487ea490c7f22cba249e20d3efc018f3fcae0d2702eb5d2106992b5d65c00b9a48974</data>
+ </image>
+ <image name="image4" >
+ <data format="XPM.GZ" length="1241" >789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232365200210543251d2e253d856405bffcbc54105b19c8563600020b03103711c4b530b08072f50880513524ab518681443435ca984ae08ae06a94114a10ac443435ca3043904d4c4453a38ca604ae11590d9a0ab80bd0d46078914c35c4d885a608871a547f61f81d5d117a1862018930e5b8d5c0950c741a1b1e6a6aadb90086a9d853</data>
+ </image>
+ <image name="image5" >
+ <data format="XPM.GZ" length="5598" >789ca5985973db480ec7dff3295cc15b6a0b2351a428d6d63ef83e255bbe647b6a1fd02465dd872d9f53f3dd076c005dc926ce6a32eed8553f37fadf7fa0c1a69cdfbe6cdc9cb537befcf6e97145ab61be910fe861e34bf1349dbefdfedffffcf1e97323dae07f51bdbe117dfed7a7cfddd546bed199cfca0ae888016afeab62e8796ef110ee545caf05be16ae5bfc6ee096e7b6e756983f51b6f53b81257ecfb8eee7e9b162f66af1c78125fe48987f23f3fb81657e691cd5bddecc7316d555efd058f7eb2867aa771058f4de8c55cffb6dd4a34cf5b68d357e681c6515634db81a7e3ef59c35cccf5560bf9ef6953389c77660af074f15c751e05c38a6d81f2ef9f3a848f4e9d658f2c36b635dbfa54cc2383556bd33e12492fc70df38f1f3f8ae4cc2745a711285fda7caa4f95e06967a2d8c63f27a8fc2a60fa4acfa980a371b898f0767dc6cf8fdbc9f84c27e4de124d2fabe186b3dee8c75ff1365dbef2db0ccef0987fd2f2a6632fd576552fd2b63d57b08ecd7d39d70b321fd0560acfb6d1a4b7e3050764de7d79f08a70de937ea7b7689e68f4de1e0776e2c7ab8abecb47eb170aa7ee822b0e89f1b4b7fd24dc529abe9794f02cbf99e2b3badc7a5b1ee97089b3e0e8d253f3c364e253e5576120ff7c63a9f7966d2e771d358e75bca4ef3bb0e2cf9758db5fe47c6b21eeb81bd3f07c2ad58ebd130d67e6a194b3cf97e62b2fa24c67a1f5d2aab3f8781a53e17c6eaa7082cfa3de156acf9d5034b7e3563f1eb96c6eaf7c0b815fbf8d2739e3aedefb1b1de9723618b77a49cebf946c6e20f5f8d251e753e8b5bb9e74c980a4afc7a7fbf66b1ed8fb7c67a9ec7c2ad5cfd74038bdfa6b1f6cbd458fd2e84b358efbb0363f5b71358fccd8c33596f9c4bfddcc458fac78d8cf5797b3296f5f82c4c49e6f5c9bf9fb23ce41307967e3935d6f36c0b67b1ce3f188b5f3757367f5363b98fdc38b0cc0f8cf5f90bf3ea97028bfe50981289777d63edcf81b1c4439897f3c52d615738cfe0df371c1deb7db265acf98d8d253f7a50d67a60c758cfcbf4cc7f2fb0f8bf1736bfae30d6f35f1a4b3ce6c6e2df95ca85f6f7dc58f3db0e5c783e14e6ebc533e87e963fbe0873f9fd3cc97c91693fd028b0d4e3c558f3eb0b9b5f972bab3fe78c353f3056bfabc0e2371636bfe4cf9b29d1e76b69acfdb863accfd33cb0dc2fa7c6e2179e03cb79ae940b7dffbf1b6bfd1363f53b12367f581a6b3d1bca56df6e60a9bfc6e765def4ecef6bc7eafaf9e8d558fbb7a15ce87d7263acf7ffbdb1e40f33e1e0cf29ebfea8eb6d7ff29f17f8f4137dfe51d8fa0117ca65ee3fbfe3bd705116b2de9f775e3af50313e1a229f1f0682cf1b052e6e1d9dfbf1cddd4fd2363cdcfef5fb05b7d1f0c944bed4f67ac9f5f27c265bf4c3d9f07eefb787f1f96695eaa1e0a174d7d7f81b1ee4f81a5fe75e552d9bf1fca7e617e9e8d556f33b0c4fbcf5ffdb44c956bc6a2d75dfd6c2020fd3ce2ff69a0c31c0b2cff91461fef71804374bfaa81231ce3044b9ce2ecd734380fc2392e70890ff888bfa6f184cff8c24e5ef10ddf71f3a37c3ed6c015afdec26dfeb983bbb887fb78f0f734380fe031c7437f3247788c27d8fe713e1f6a1076f014cfb08be7ac7481977885d75c951fe4f3630dcea3c3eb7b9cc70d6b9ce12d9fee26de610debeb69b0fb578cb89a0d8c399711e794609373d9c39455f2b53466d8c20c17809c45cc7a3c00f011081cffccff379fef35388f1d0428a0c401f459e58c3d45700f0003cee71d8678fc730d7430e2557d3c8331f7568c37308129cc7006733e9d262c6008cb6ff3f94ea3c72bc678ca3f1fb80a637884154c71c974c55d72c91a4feca4fdf553f8ad46554d8e9ee30a9eb1efab31611f2ff0ca346427bb9c11e114debe7e7ebed328318702e7f0ce9dbee47a1c724655b745b0c94ea6b0c55519f059b98f73d19a6cc30eecc21eecfb7100877004c770026de8e070bdfe805338832e9cc3055cc2955f7b0d3de8f0cfebb5356ee016eea0c6a30e11342086049a907aadcd35355a90111250f5e5288706bfdb4bea572a78b49e06ddd3a0d2807a2502110d6944639ad09466ebf9e8ae684e0bf5b1a4075ab28f11ffa1df678dc7f57cb0c68a9ee899355e7c2ddbf40a31bdb1c63bcdfe86c6803669cb9f4555c76b38a76dcee57d5d1f5c8f1d5af0b9745581bb029a5c8f3eedd21eed73b70ebe56fa91061dd061f05139e9d1116b1cfb9aee55c4fcf6330d5cd289d778a6b65fdd831dea702e256b9cf2b974a84367d4fd580347744e17744957acc13e7cfc095d538f356ed8cd2ddd518dea147da4c1956890ffcf295ed5e4c83b4a59f182b9455935e3b801ab791c7fa4e188d7a4bcbee66353feaef9df8852ca2f3e9ee3ef73840f359cabfec22979f4ddbd1bf018ba118f318f899bf298b9b95bb8e537cffe9ffffef4171c39a0bf</data>
+ </image>
+ <image name="image6" >
+ <data format="XPM.GZ" length="3742" >789c8d96c9521c490c86ef3c458775734cc8ddd5b5c6c41c303b180cc60b66620eaacc2c9aa5599b7562de7da45fc5180c8e98fa39f091522e4a49c9bbb783bdedcdc1db77735733991d864198c8e5e06dbc9e4eeffffceb8fbfe7de64d9407f466531c8defc36f76667360883adb3d364c013051ae2039f8147266359068f4dc6740a2e4db05f05d726f0253898c017c6a3cc04ffafce79aa3af0143c36c17e055caa0aacbf06aeb2203e5f09ae4d185f75ce472de6e7737063c2fcb57356b702fed673e32c473d4bcf3760198f02e69325706b022f3a676df0f567e05035d1ed273dc79883e7c1d1045e70ae2456d84fd9738a589f0b703261bc72ae25e17ee4b0e7d8f3b5733374e603e32c37c11ff36970db12f193f7e07c1c6bec87c6e0c604ff0e1c4db03f36cec7e3a6f4fd2e38e779eee7bd05e7e350fa7e4fc0455ee6b84fb9eab913bfdf1c5ce5758efba54fffb1e75302d726f8af3817a5f8f922584cf06fc0211f951ebfd0b30afe07ce4510dfdf1e38e665e9f9f1e01c32cf1fda06a73c2f7c7eac5f8c8b61eef582f315b909dc82f1c17e07dc1459e5f1c77d953abb787e0ab832611cf957366dd9c707f556762a3fcf8673ddd6d8afdc1957b909fe98af2a65d4c787c08d09e3c8bfaad504f378de83a309e35fc049d9d747bda19c7dbe8f602d88d6fd11af3a33c1ffde398e02ec69178c0b04bb7fa12be03e08e7ab4b895e2f74ec1ca2e73f6d811b2d37df1feaa9969082f71ff4a73a98c01f9cdb3678fde27eea58f7f9cdc8bfba33c11efda2199ac01bcead048fd72678a4e9e3f6a86f6d172acc87fc69f290f9386f3d72f478a1bf348509fea8b7a66c9b80fec1a8b7a66a53f47cc2fe9b5ae77346fe35ad09e761703081d12f9b68c2fc57ce6d0c1e6fe463934ce0efc63234c11ffd5b4a13c66f9cb53d79fded832bcd27f47f5aeb59055e744eb1df3fe2251aeee4e7453f9264c27aa847b44f7f4f909fda3efb7ae30c5c84b65f1fef435b9a608ff7a4ad4c981ffb6b6b13d8fda5edfb37eff4dcb65e2f787f5a7cb0f7fd0413ecf13eb49d09f6783ff07cf97d8ec0a3f8d8df516f483faf07c45b1f27e9f30ff989e9fdbe11ff1034fd3c9eebe068c238fa9f6677f2fb27ac1f475dd3f97da25fc6c204be755673ef3f8db3360c1f1f824b13c651df2877c44fd0df511efe5ea39f44318151cf9a4e2ab0af870d63fee4dc55fdfe109f880ff3fb788a8ff98df733762630fa471aa6febda2839e5b3f0fe1bef4f18bc9fb01fa7dca4ce0bb9e5b671ef69c3cff18f99cc626d853cf551f3fe453ca531bbdde979cbb2c793e207f536102a39fa5ca0446bf4279f97b89feaabb5181511f38bedf2ffa47373461bdcfe0dc8471d46387860fc6fbaad155c11ef7a5d953747ede69cf2a30fe3fd06c5121fe88572726f8a37f68720ffbfdadf7ac02fb7e82098c7e85ebf2fde37dea92098cf7acc367bc33fbff7a6ecfc4c22d078eaac41d1ff0e4d7f66a7df84293e71ecfec858f9ee8d1fef8a9c733fb139ef2299ff1395ff0255fc167c233befee1f1cc3ef10ddff21ddff303cfabe77bd584177891971e3d7ed8db4e7b2df30aaff29a7aac3ff9ebe4a9bdf2067fe04ddee28ffafb36eff027de558fcfbaab2ffc95bf3db5578b3dfecefb3ce411673c56ceb9e0b23f47a5fbac7fb26f889988742f2a129e504b81a246e0c8ec293cb7a7441d0b1dd0840ee9883486744253bea4533a7bd5fe9c2ed4feb29fff4aff32a36b8dd5e92fe6bfa15bddcf1dddd303cd93c6911668aa2b5cbc363f3c16799f9630fbb2d20aadd21aadeb3d547a8617f6f0d8a00fb4495bfadb47daa61dfa84f977e933c597f64f6e6c9fbed057fa467bf49df669c8bb34a2eca53d8d35576ef88e722aa8a48a6a6a448320a20fd36bf3eb7f407c2c89efb5500f6422877224c77222533915e6b397fbd117f54ccee54275295732936bb9915bb9937b797869ff34e7649ecfe4bd2ce81a8bbc2a4bb2fc5a3dfe2c59915559fb75fdfe8f7affe7f7b97f011cdd9635</data>
+ </image>
+ </images>
+</ui>
diff --git a/examples/activeqt/wrapper/main.cpp b/examples/activeqt/wrapper/main.cpp
new file mode 100644
index 0000000..a403084
--- /dev/null
+++ b/examples/activeqt/wrapper/main.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QAxFactory>
+#include <QCheckBox>
+#include <QRadioButton>
+#include <QPushButton>
+#include <QToolButton>
+#include <QPixmap>
+
+/* XPM */
+static const char *fileopen[] = {
+" 16 13 5 1",
+". c #040404",
+"# c #808304",
+"a c None",
+"b c #f3f704",
+"c c #f3f7f3",
+"aaaaaaaaa...aaaa",
+"aaaaaaaa.aaa.a.a",
+"aaaaaaaaaaaaa..a",
+"a...aaaaaaaa...a",
+".bcb.......aaaaa",
+".cbcbcbcbc.aaaaa",
+".bcbcbcbcb.aaaaa",
+".cbcb...........",
+".bcb.#########.a",
+".cb.#########.aa",
+".b.#########.aaa",
+"..#########.aaaa",
+"...........aaaaa"
+};
+
+
+//! [0]
+class ActiveQtFactory : public QAxFactory
+{
+public:
+ ActiveQtFactory( const QUuid &lib, const QUuid &app )
+ : QAxFactory( lib, app )
+ {}
+ QStringList featureList() const
+ {
+ QStringList list;
+ list << "QCheckBox";
+ list << "QRadioButton";
+ list << "QPushButton";
+ list << "QToolButton";
+ return list;
+ }
+ QObject *createObject(const QString &key)
+ {
+ if ( key == "QCheckBox" )
+ return new QCheckBox(0);
+ if ( key == "QRadioButton" )
+ return new QRadioButton(0);
+ if ( key == "QPushButton" )
+ return new QPushButton(0 );
+ if ( key == "QToolButton" ) {
+ QToolButton *tb = new QToolButton(0);
+// tb->setIcon( QPixmap(fileopen) );
+ return tb;
+ }
+
+ return 0;
+ }
+ const QMetaObject *metaObject( const QString &key ) const
+ {
+ if ( key == "QCheckBox" )
+ return &QCheckBox::staticMetaObject;
+ if ( key == "QRadioButton" )
+ return &QRadioButton::staticMetaObject;
+ if ( key == "QPushButton" )
+ return &QPushButton::staticMetaObject;
+ if ( key == "QToolButton" )
+ return &QToolButton::staticMetaObject;
+
+ return 0;
+ }
+ QUuid classID( const QString &key ) const
+ {
+ if ( key == "QCheckBox" )
+ return "{6E795DE9-872D-43CF-A831-496EF9D86C68}";
+ if ( key == "QRadioButton" )
+ return "{AFCF78C8-446C-409A-93B3-BA2959039189}";
+ if ( key == "QPushButton" )
+ return "{2B262458-A4B6-468B-B7D4-CF5FEE0A7092}";
+ if ( key == "QToolButton" )
+ return "{7c0ffe7a-60c3-4666-bde2-5cf2b54390a1}";
+
+ return QUuid();
+ }
+ QUuid interfaceID( const QString &key ) const
+ {
+ if ( key == "QCheckBox" )
+ return "{4FD39DD7-2DE0-43C1-A8C2-27C51A052810}";
+ if ( key == "QRadioButton" )
+ return "{7CC8AE30-206C-48A3-A009-B0A088026C2F}";
+ if ( key == "QPushButton" )
+ return "{06831CC9-59B6-436A-9578-6D53E5AD03D3}";
+ if ( key == "QToolButton" )
+ return "{6726080f-d63d-4950-a366-9bf33e5cdf84}";
+
+ return QUuid();
+ }
+ QUuid eventsID( const QString &key ) const
+ {
+ if ( key == "QCheckBox" )
+ return "{FDB6FFBE-56A3-4E90-8F4D-198488418B3A}";
+ if ( key == "QRadioButton" )
+ return "{73EE4860-684C-4A66-BF63-9B9EFFA0CBE5}";
+ if ( key == "QPushButton" )
+ return "{3CC3F17F-EA59-4B58-BBD3-842D467131DD}";
+ if ( key == "QToolButton" )
+ return "{f4d421fd-4ead-4fd9-8a25-440766939639}";
+
+ return QUuid();
+ }
+};
+//! [0] //! [1]
+
+QAXFACTORY_EXPORT( ActiveQtFactory, "{3B756301-0075-4E40-8BE8-5A81DE2426B7}", "{AB068077-4924-406a-BBAF-42D91C8727DD}" )
+//! [1]
diff --git a/examples/activeqt/wrapper/wrapper.inf b/examples/activeqt/wrapper/wrapper.inf
new file mode 100644
index 0000000..fc17a3d
--- /dev/null
+++ b/examples/activeqt/wrapper/wrapper.inf
@@ -0,0 +1,9 @@
+[version]
+ signature="$CHICAGO$"
+ AdvancedINF=2.0
+ [Add.Code]
+ wrapperax.dll=wrapperax.dll
+ [wrapperax.dll]
+ file-win32-x86=thiscab
+ clsid={23F5012A-7333-43D3-BCA8-836AABC61B4A}
+ RegisterServer=yes
diff --git a/examples/activeqt/wrapper/wrapper.pro b/examples/activeqt/wrapper/wrapper.pro
new file mode 100644
index 0000000..4eb6baf
--- /dev/null
+++ b/examples/activeqt/wrapper/wrapper.pro
@@ -0,0 +1,15 @@
+TEMPLATE = lib
+TARGET = wrapperax
+
+CONFIG += qt warn_off qaxserver dll
+contains(CONFIG, static):DEFINES += QT_NODLL
+
+SOURCES = main.cpp
+RC_FILE = wrapperax.rc
+DEF_FILE = $$QT_SOURCE_TREE/src/activeqt/control/qaxserver.def
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/activeqt/wrapper
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS wrapper.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/activeqt/wrapper
+INSTALLS += target sources
diff --git a/examples/activeqt/wrapper/wrapperax.rc b/examples/activeqt/wrapper/wrapperax.rc
new file mode 100644
index 0000000..453688d
--- /dev/null
+++ b/examples/activeqt/wrapper/wrapperax.rc
@@ -0,0 +1,32 @@
+#include "winver.h"
+
+1 TYPELIB "wrapperax.rc"
+1 ICON DISCARDABLE "..\\..\\..\\src\\activeqt\\control\\qaxserver.ico"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x3fL
+ FILEOS 0x00040000L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)"
+ VALUE "FileDescription", "Wrapper Example (ActiveQt)"
+ VALUE "FileVersion", "1.0.0.0"
+ VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)."
+ VALUE "InternalName", "wrapperax.dll"
+ VALUE "OriginalFilename", "wrapperax.dll"
+ VALUE "ProductName", "Wrapper Example (ActiveQt)"
+ VALUE "ProductVersion", "1.0.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
diff --git a/examples/assistant/README b/examples/assistant/README
new file mode 100644
index 0000000..85f5a43
--- /dev/null
+++ b/examples/assistant/README
@@ -0,0 +1,38 @@
+Support for interactive help is provided by the Qt Assistant application.
+Developers can take advantages of the facilities it offers to display
+specially-prepared documentation to users of their applications.
+
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/assistant/assistant.pro b/examples/assistant/assistant.pro
new file mode 100644
index 0000000..1477178
--- /dev/null
+++ b/examples/assistant/assistant.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS = simpletextviewer
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/assistant
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS assistant.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/assistant
+INSTALLS += target sources
diff --git a/examples/assistant/simpletextviewer/documentation/about.txt b/examples/assistant/simpletextviewer/documentation/about.txt
new file mode 100644
index 0000000..eeab35f
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/about.txt
@@ -0,0 +1,9 @@
+The Simple Text Viewer enables the user to select and view existing
+files.
+
+HTML files is displayed using rich text, while other files are
+presented as plain text. The application provides a file dialog
+allowing the user to search for files using wildcard matching. The
+search is performed within in the specified directory, and the user is
+given an option to browse the existing file system to find the
+relevant directory.
diff --git a/examples/assistant/simpletextviewer/documentation/browse.html b/examples/assistant/simpletextviewer/documentation/browse.html
new file mode 100644
index 0000000..987abf3
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/browse.html
@@ -0,0 +1,34 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Browse</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>Browse</h2></center></p>
+
+ <p>
+ The file dialog let you browse the current file system to
+ specify the directory in which the file you want to open
+ resides.
+ Note that only the specified directory will be searched, any
+ subdirectories will simply be ignored.
+ </p>
+
+ <br />
+ <br />
+ <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%">
+ <tr valign="top" bgcolor="#f0f0f0">
+ <td><center><img src="images/browse.png" /></center></td>
+ </tr>
+ </table>
+
+ <br />
+ <br />
+ <p>
+ See also: <a href="filedialog.html">File Dialog</a>, <a href="wildcardmatching.html">Wildcard Matching</a>,
+ <a href="findfile.html">Find File</a>
+ </p>
+ </body>
+</html>
+
diff --git a/examples/assistant/simpletextviewer/documentation/filedialog.html b/examples/assistant/simpletextviewer/documentation/filedialog.html
new file mode 100644
index 0000000..afa65ed
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/filedialog.html
@@ -0,0 +1,48 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>File Dialog</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>File Dialog</h2></center></p>
+
+ <p>
+ In the file dialog you can name a particular file name, or
+ search for files using wildcard matching, i.e. specify a
+ file name containing wildcards. In addition you must specify
+ the directory in which the file you search for resides.
+ </p>
+
+ <br />
+ <br />
+ <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%">
+ <tr valign="top" bgcolor="#f0f0f0">
+ <td><center><img src="images/filedialog.png" /></center></td>
+ </tr>
+ </table>
+
+ <br />
+ <br />
+ <p>
+ By default the dialog will search for all files (*) in the
+ current directory (the directory the application is run from).
+ </p>
+
+ <p>
+ When editing the file name and directory parameters, an
+ overview of the matching files are displayed in the
+ dialog. The overview is updated whenever the parameters
+ change.
+ </p>
+
+ <br />
+ <br />
+ <p>
+ See also: <a href="browse.html">Browse</a>, <a href="wildcardmatching.html">Wildcard Matching</a>,
+ <a href="findfile.html">Find File</a>
+ </p>
+ </body>
+</html>
+
+
diff --git a/examples/assistant/simpletextviewer/documentation/findfile.html b/examples/assistant/simpletextviewer/documentation/findfile.html
new file mode 100644
index 0000000..32e0147
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/findfile.html
@@ -0,0 +1,32 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Find File</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>Find File</h2></center></p>
+
+ <p>
+ To open and view a file in the Simple Text Viewer, select the
+ 'Open...' option in the 'File' menu. The application will then
+ provide you with a file dialog that you can use to search for
+ any existing file.
+ </p>
+
+ <br />
+ <br />
+ <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%">
+ <tr valign="top" bgcolor="#f0f0f0">
+ <td><center><img src="images/fadedfilemenu.png" /></center></td>
+ </tr>
+ </table>
+
+ <br />
+ <br />
+ <p>
+ See also: <a href="openfile.html">Open File</a>, <a href="filedialog.html">File Dialog</a>
+ </p>
+ </body>
+</html>
+
diff --git a/examples/assistant/simpletextviewer/documentation/images/browse.png b/examples/assistant/simpletextviewer/documentation/images/browse.png
new file mode 100644
index 0000000..86db6b1
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/browse.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.png b/examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.png
new file mode 100644
index 0000000..fde0e43
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/fadedfilemenu.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/images/filedialog.png b/examples/assistant/simpletextviewer/documentation/images/filedialog.png
new file mode 100644
index 0000000..883a33a
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/filedialog.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/images/handbook.png b/examples/assistant/simpletextviewer/documentation/images/handbook.png
new file mode 100644
index 0000000..3bd2b92
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/handbook.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/images/mainwindow.png b/examples/assistant/simpletextviewer/documentation/images/mainwindow.png
new file mode 100644
index 0000000..c28d5e9
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/mainwindow.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/images/open.png b/examples/assistant/simpletextviewer/documentation/images/open.png
new file mode 100644
index 0000000..1e5bba3
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/open.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/images/wildcard.png b/examples/assistant/simpletextviewer/documentation/images/wildcard.png
new file mode 100644
index 0000000..6e83a56
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/images/wildcard.png
Binary files differ
diff --git a/examples/assistant/simpletextviewer/documentation/index.html b/examples/assistant/simpletextviewer/documentation/index.html
new file mode 100644
index 0000000..5a7b1d5
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/index.html
@@ -0,0 +1,41 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Manual</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>Simple Text Viewer</h2></center></p>
+
+ <p>
+ The Simple Text Viewer enables the user to select and view
+ existing files.
+ </p>
+
+ <p><center>
+ <img src="images/mainwindow.png" />
+ </center></p>
+
+ <p>
+ HTML files is displayed using rich text, while
+ other files are presented as plain text. The application
+ provides a file dialog allowing the user to search for files
+ using wildcard matching. The search is performed within in the
+ specified directory, and the user is given an option to browse
+ the existing file system to find the relevant directory.
+ </p>
+
+ <ul>
+ <li><a href="findfile.html">Find File</a></li>
+ <ul>
+ <li><a href="filedialog.html">File Dialog</a></li>
+ <li><a href="wildcardmatching.html">WildCard Matching</a></li>
+ <li><a href="browse.html">Browse</a></li>
+ </ul>
+ <li><a href="openfile.html">Open File</a></li>
+ </ul>
+ </body>
+</html>
+
+
+
diff --git a/examples/assistant/simpletextviewer/documentation/intro.html b/examples/assistant/simpletextviewer/documentation/intro.html
new file mode 100644
index 0000000..2e2aa40
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/intro.html
@@ -0,0 +1,28 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Manual</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>Simple Text Viewer</h2></center></p>
+
+ <p>
+ The Simple Text Viewer enables the user to select and view
+ existing files.
+ </p>
+
+ <p><center>
+ <img src="images/mainwindow.png" />
+ </center></p>
+
+ <p>
+ The application provides its own custom documentation that is
+ available through the <b>Help</b> menu in the main window's menubar
+ and through the <b>Help</b> button in the application's find file
+ dialog.
+ </p>
+
+ </body>
+</html>
+
diff --git a/examples/assistant/simpletextviewer/documentation/openfile.html b/examples/assistant/simpletextviewer/documentation/openfile.html
new file mode 100644
index 0000000..e172de9
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/openfile.html
@@ -0,0 +1,36 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Open File</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>Open File</h2></center></p>
+
+ <p>
+ Once the file you want to view appears in the dialog's
+ display, you can open it in two different ways.
+ </p>
+
+ <p>
+ By pressing the 'Open' button the currently selected file will
+ be opened. By default, the first file in the list of matching
+ files is selected. Another way of opening a file is to simply
+ double click the displayed file name.
+ </p>
+
+ <br />
+ <br />
+ <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%">
+ <tr valign="top" bgcolor="#f0f0f0">
+ <td><center><img src="images/open.png" /></center></td>
+ </tr>
+ </table>
+
+ <br />
+ <br />
+ <p>
+ See also: <a href="findfile.html">Find File</a>
+ </p>
+ </body>
+</html>
diff --git a/examples/assistant/simpletextviewer/documentation/simpletextviewer.adp b/examples/assistant/simpletextviewer/documentation/simpletextviewer.adp
new file mode 100644
index 0000000..660df4f
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/simpletextviewer.adp
@@ -0,0 +1,40 @@
+<!DOCTYPE DCF>
+
+<assistantconfig version="3.2.0">
+
+<profile>
+ <property name="name">simpletextviewer</property>
+ <property name="title">Simple Text Viewer</property>
+ <property name="applicationicon">images/handbook.png</property>
+ <property name="startpage">index.html</property>
+ <property name="aboutmenutext">About Simple Text Viewer</property>
+ <property name="abouturl">about.txt</property>
+ <property name="assistantdocs">.</property>
+</profile>
+
+<DCF ref="index.html" icon="images/handbook.png" title="Simple Text Viewer">
+ <section ref="./findfile.html" title="Find File">
+ <keyword ref="./index.html">Display</keyword>
+ <keyword ref="./index.html">Rich text</keyword>
+ <keyword ref="./index.html">Plain text</keyword>
+ <keyword ref="./findfile.html">Find</keyword>
+ <keyword ref="./findfile.html">File menu</keyword>
+ <keyword ref="./filedialog.html">File name</keyword>
+ <keyword ref="./filedialog.html">File dialog</keyword>
+ <keyword ref="./wildcardmatching.html">File globbing</keyword>
+ <keyword ref="./wildcardmatching.html">Wildcard matching</keyword>
+ <keyword ref="./wildcardmatching.html">Wildcard syntax</keyword>
+ <keyword ref="./browse.html">Browse</keyword>
+ <keyword ref="./browse.html">Directory</keyword>
+ <keyword ref="./openfile.html">Open</keyword>
+ <keyword ref="./openfile.html">Select</keyword>
+
+ <section ref="./filedialog.html" title="File Dialog" />
+ <section ref="./wildcardmatching.html" title="Wildcard Matching" />
+ <section ref="./browse.html" title="Browse" />
+ </section>
+ <section ref="./openfile.html" title="Open File" />
+</DCF>
+
+</assistantconfig>
+
diff --git a/examples/assistant/simpletextviewer/documentation/wildcardmatching.html b/examples/assistant/simpletextviewer/documentation/wildcardmatching.html
new file mode 100644
index 0000000..eb1839a
--- /dev/null
+++ b/examples/assistant/simpletextviewer/documentation/wildcardmatching.html
@@ -0,0 +1,57 @@
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>Wildcard Matching</title>
+ </head>
+ <body style="font-size:12pt;font-family:helvetica">
+
+ <p><center><h2>Wildcard Matching</h2></center></p>
+
+ <p>
+ Most command shells such as bash or cmd.exe support "file
+ globbing", the ability to identify a group of files by using
+ wildcards.
+
+ <br />
+ <br />
+ <table align="center" cellpadding="2" cellspacing="1" border="0" width="100%">
+ <tr valign="top" bgcolor="#f0f0f0">
+ <td><center><img src="images/wildcard.png" /></center></td>
+ </tr>
+ </table>
+
+ <br />
+ <br />
+ <p>
+ Wildcard matching provides four features:
+ </p>
+
+ <ul>
+ <li>Any character represents itself apart from those
+ mentioned below. Thus 'c' matches the character 'c'.
+ </li>
+ <li>The '?' character matches any single character.</li>
+ <li>The '*' matches zero or more of any characters.</li>
+ <li>Sets of characters can be represented in square brackets.
+ Within the character class, like outside, backslash
+ has no special meaning.
+ </li>
+ </ul>
+
+ <p>
+ For example we could identify HTML files with
+ <code>*.html</code>. This will match zero or more characters
+ followed by a dot followed by 'h', 't', 'm' and 'l'.
+ </p>
+
+ <br />
+ <br />
+ <p>
+ See also: <a href="browse.html">Browse</a>, <a href="filedialog.html">File Dialog</a>,
+ <a href="findfile.html">Find File</a>
+ </p>
+ </body>
+</html>
+
+
+
diff --git a/examples/assistant/simpletextviewer/findfiledialog.cpp b/examples/assistant/simpletextviewer/findfiledialog.cpp
new file mode 100644
index 0000000..f73657e
--- /dev/null
+++ b/examples/assistant/simpletextviewer/findfiledialog.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "findfiledialog.h"
+
+//! [0]
+FindFileDialog::FindFileDialog(QTextEdit *editor, QAssistantClient *assistant,
+ QWidget *parent)
+ : QDialog(parent)
+{
+ currentAssistantClient = assistant;
+ currentEditor = editor;
+//! [0]
+
+ createButtons();
+ createComboBoxes();
+ createFilesTree();
+ createLabels();
+ createLayout();
+
+ directoryComboBox->addItem(QDir::toNativeSeparators(QDir::currentPath()));
+ fileNameComboBox->addItem("*");
+ findFiles();
+
+ setWindowTitle(tr("Find File"));
+//! [1]
+}
+//! [1]
+
+void FindFileDialog::browse()
+{
+ QString currentDirectory = directoryComboBox->currentText();
+ QString newDirectory = QFileDialog::getExistingDirectory(this,
+ tr("Select Directory"), currentDirectory);
+ if (!newDirectory.isEmpty()) {
+ directoryComboBox->addItem(QDir::toNativeSeparators(newDirectory));
+ directoryComboBox->setCurrentIndex(directoryComboBox->count() - 1);
+ update();
+ }
+}
+
+//! [2]
+void FindFileDialog::help()
+{
+ currentAssistantClient->showPage(QLibraryInfo::location(QLibraryInfo::ExamplesPath) +
+ QDir::separator() + "assistant/simpletextviewer/documentation/filedialog.html");
+}
+//! [2]
+
+void FindFileDialog::openFile(QTreeWidgetItem *item)
+{
+ if (!item) {
+ item = foundFilesTree->currentItem();
+ if (!item)
+ return;
+ }
+
+ QString fileName = item->text(0);
+ QString path = directoryComboBox->currentText() + QDir::separator();
+
+ QFile file(path + fileName);
+ if (file.open(QIODevice::ReadOnly)) {
+ QString data(file.readAll());
+
+ if (fileName.endsWith(".html"))
+ currentEditor->setHtml(data);
+ else
+ currentEditor->setPlainText(data);
+ }
+ close();
+}
+
+void FindFileDialog::update()
+{
+ findFiles();
+ buttonBox->button(QDialogButtonBox::Open)->setEnabled(
+ foundFilesTree->topLevelItemCount() > 0);
+}
+
+void FindFileDialog::findFiles()
+{
+ QRegExp filePattern(fileNameComboBox->currentText() + "*");
+ filePattern.setPatternSyntax(QRegExp::Wildcard);
+
+ QDir directory(directoryComboBox->currentText());
+
+ QStringList allFiles = directory.entryList(QDir::Files | QDir::NoSymLinks);
+ QStringList matchingFiles;
+
+ foreach (QString file, allFiles) {
+ if (filePattern.exactMatch(file))
+ matchingFiles << file;
+ }
+ showFiles(matchingFiles);
+}
+
+void FindFileDialog::showFiles(const QStringList &files)
+{
+ foundFilesTree->clear();
+
+ for (int i = 0; i < files.count(); ++i) {
+ QTreeWidgetItem *item = new QTreeWidgetItem(foundFilesTree);
+ item->setText(0, files[i]);
+ }
+
+ if (files.count() > 0)
+ foundFilesTree->setCurrentItem(foundFilesTree->topLevelItem(0));
+}
+
+void FindFileDialog::createButtons()
+{
+ browseButton = new QToolButton;
+ browseButton->setText(tr("..."));
+ connect(browseButton, SIGNAL(clicked()), this, SLOT(browse()));
+
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Open
+ | QDialogButtonBox::Cancel
+ | QDialogButtonBox::Help);
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(openFile()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
+}
+
+void FindFileDialog::createComboBoxes()
+{
+ directoryComboBox = new QComboBox;
+ fileNameComboBox = new QComboBox;
+
+ fileNameComboBox->setEditable(true);
+ fileNameComboBox->setSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Preferred);
+
+ directoryComboBox->setMinimumContentsLength(30);
+ directoryComboBox->setSizeAdjustPolicy(
+ QComboBox::AdjustToMinimumContentsLength);
+ directoryComboBox->setSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Preferred);
+
+ connect(fileNameComboBox, SIGNAL(editTextChanged(const QString &)),
+ this, SLOT(update()));
+ connect(directoryComboBox, SIGNAL(currentIndexChanged(const QString &)),
+ this, SLOT(update()));
+}
+
+void FindFileDialog::createFilesTree()
+{
+ foundFilesTree = new QTreeWidget;
+ foundFilesTree->setColumnCount(1);
+ foundFilesTree->setHeaderLabels(QStringList(tr("Matching Files")));
+ foundFilesTree->setRootIsDecorated(false);
+ foundFilesTree->setSelectionMode(QAbstractItemView::SingleSelection);
+
+ connect(foundFilesTree, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
+ this, SLOT(openFile(QTreeWidgetItem *)));
+}
+
+void FindFileDialog::createLabels()
+{
+ directoryLabel = new QLabel(tr("Search in:"));
+ fileNameLabel = new QLabel(tr("File name (including wildcards):"));
+}
+
+void FindFileDialog::createLayout()
+{
+ QHBoxLayout *fileLayout = new QHBoxLayout;
+ fileLayout->addWidget(fileNameLabel);
+ fileLayout->addWidget(fileNameComboBox);
+
+ QHBoxLayout *directoryLayout = new QHBoxLayout;
+ directoryLayout->addWidget(directoryLabel);
+ directoryLayout->addWidget(directoryComboBox);
+ directoryLayout->addWidget(browseButton);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addLayout(fileLayout);
+ mainLayout->addLayout(directoryLayout);
+ mainLayout->addWidget(foundFilesTree);
+ mainLayout->addStretch();
+ mainLayout->addWidget(buttonBox);
+ setLayout(mainLayout);
+}
diff --git a/examples/assistant/simpletextviewer/findfiledialog.h b/examples/assistant/simpletextviewer/findfiledialog.h
new file mode 100644
index 0000000..0c89fda
--- /dev/null
+++ b/examples/assistant/simpletextviewer/findfiledialog.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FINDFILEDIALOG_H
+#define FINDFILEDIALOG_H
+
+#include <QAssistantClient>
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QDialogButtonBox;
+class QLabel;
+class QTextEdit;
+class QToolButton;
+class QTreeWidget;
+class QTreeWidgetItem;
+QT_END_NAMESPACE
+
+//! [0]
+class FindFileDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ FindFileDialog(QTextEdit *editor, QAssistantClient *assistant,
+ QWidget *parent = 0);
+
+private slots:
+ void browse();
+ void help();
+ void openFile(QTreeWidgetItem *item = 0);
+ void update();
+
+private:
+ void findFiles();
+ void showFiles(const QStringList &files);
+
+ void createButtons();
+ void createComboBoxes();
+ void createFilesTree();
+ void createLabels();
+ void createLayout();
+
+ QAssistantClient *currentAssistantClient;
+ QTextEdit *currentEditor;
+ QTreeWidget *foundFilesTree;
+
+ QComboBox *directoryComboBox;
+ QComboBox *fileNameComboBox;
+
+ QLabel *directoryLabel;
+ QLabel *fileNameLabel;
+
+ QDialogButtonBox *buttonBox;
+
+ QToolButton *browseButton;
+};
+//! [0]
+
+#endif
diff --git a/examples/assistant/simpletextviewer/main.cpp b/examples/assistant/simpletextviewer/main.cpp
new file mode 100644
index 0000000..1d51376
--- /dev/null
+++ b/examples/assistant/simpletextviewer/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ MainWindow window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/assistant/simpletextviewer/mainwindow.cpp b/examples/assistant/simpletextviewer/mainwindow.cpp
new file mode 100644
index 0000000..cc2f3c0
--- /dev/null
+++ b/examples/assistant/simpletextviewer/mainwindow.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+#include "findfiledialog.h"
+
+//! [0]
+MainWindow::MainWindow()
+{
+ textViewer = new QTextEdit;
+ textViewer->setReadOnly(true);
+ QFile file("documentation/intro.html");
+ if (file.open(QIODevice::ReadOnly))
+ textViewer->setHtml(file.readAll());
+
+ setCentralWidget(textViewer);
+
+ createActions();
+ createMenus();
+
+ initializeAssistant();
+
+ setWindowTitle(tr("Simple Text Viewer"));
+ resize(750, 400);
+}
+//! [0]
+
+//! [1]
+void MainWindow::closeEvent(QCloseEvent *)
+{
+ if (assistantClient)
+ assistantClient->closeAssistant();
+}
+//! [1]
+
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About Simple Text Viewer"),
+ tr("This example demonstrates how to use\n" \
+ "Qt Assistant as help system for your\n" \
+ "own application."));
+}
+
+//! [2]
+void MainWindow::assistant()
+{
+ assistantClient->showPage(QLibraryInfo::location(QLibraryInfo::ExamplesPath) +
+ QDir::separator() +
+ "assistant/simpletextviewer/documentation/index.html");
+}
+//! [2]
+
+//! [3]
+void MainWindow::open()
+{
+ FindFileDialog dialog(textViewer, assistantClient);
+ dialog.exec();
+}
+//! [3]
+
+void MainWindow::createActions()
+{
+ assistantAct = new QAction(tr("Help Contents"), this);
+ assistantAct->setShortcut(tr("F1"));
+ connect(assistantAct, SIGNAL(triggered()), this, SLOT(assistant()));
+
+ openAct = new QAction(tr("&Open..."), this);
+ openAct->setShortcut(tr("Ctrl+O"));
+ connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
+
+ clearAct = new QAction(tr("&Clear"), this);
+ clearAct->setShortcut(tr("Ctrl+C"));
+ connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear()));
+
+ exitAct = new QAction(tr("E&xit"), this);
+ exitAct->setShortcut(tr("Ctrl+Q"));
+ connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
+
+ aboutAct = new QAction(tr("&About"), this);
+ connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+
+ aboutQtAct = new QAction(tr("About &Qt"), this);
+ connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+}
+
+void MainWindow::createMenus()
+{
+ fileMenu = new QMenu(tr("&File"), this);
+ fileMenu->addAction(openAct);
+ fileMenu->addAction(clearAct);
+ fileMenu->addSeparator();
+ fileMenu->addAction(exitAct);
+
+ helpMenu = new QMenu(tr("&Help"), this);
+ helpMenu->addAction(assistantAct);
+ helpMenu->addSeparator();
+ helpMenu->addAction(aboutAct);
+ helpMenu->addAction(aboutQtAct);
+
+
+ menuBar()->addMenu(fileMenu);
+ menuBar()->addMenu(helpMenu);
+}
+
+//! [4]
+void MainWindow::initializeAssistant()
+{
+ assistantClient = new QAssistantClient(QLibraryInfo::location(QLibraryInfo::BinariesPath), this);
+
+ QStringList arguments;
+ arguments << "-profile" << QString("documentation") + QDir::separator() + QString("simpletextviewer.adp");
+ assistantClient->setArguments(arguments);
+}
+//! [4]
diff --git a/examples/assistant/simpletextviewer/mainwindow.h b/examples/assistant/simpletextviewer/mainwindow.h
new file mode 100644
index 0000000..b56d201
--- /dev/null
+++ b/examples/assistant/simpletextviewer/mainwindow.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QAssistantClient>
+#include <QMainWindow>
+#include <QTextEdit>
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+private slots:
+ void about();
+//! [0]
+ void assistant();
+//! [0]
+ void open();
+
+protected:
+//! [1]
+ void closeEvent(QCloseEvent *event);
+//! [1]
+
+private:
+ void createActions();
+ void createMenus();
+//! [2]
+ void initializeAssistant();
+//! [2]
+
+//! [3]
+ QAssistantClient *assistantClient;
+//! [3]
+ QTextEdit *textViewer;
+
+ QMenu *fileMenu;
+ QMenu *helpMenu;
+
+ QAction *assistantAct;
+ QAction *clearAct;
+ QAction *openAct;
+ QAction *exitAct;
+ QAction *aboutAct;
+ QAction *aboutQtAct;
+};
+
+#endif
diff --git a/examples/assistant/simpletextviewer/simpletextviewer.pro b/examples/assistant/simpletextviewer/simpletextviewer.pro
new file mode 100644
index 0000000..4b66edb
--- /dev/null
+++ b/examples/assistant/simpletextviewer/simpletextviewer.pro
@@ -0,0 +1,16 @@
+CONFIG += assistant
+
+QT += network
+
+HEADERS = mainwindow.h \
+ findfiledialog.h
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ findfiledialog.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer
+sources.files = $$SOURCES $$HEADERS $$RESOURCES documentation *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/assistant/simpletextviewer
+INSTALLS += target sources
+
diff --git a/examples/dbus/complexpingpong/complexping.cpp b/examples/dbus/complexpingpong/complexping.cpp
new file mode 100644
index 0000000..18fa66d
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexping.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdio.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QFile>
+#include <QtCore/QDebug>
+#include <QtCore/QProcess>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+#include "complexping.h"
+
+void Ping::start(const QString &name, const QString &oldValue, const QString &newValue)
+{
+ Q_UNUSED(oldValue);
+
+ if (name != SERVICE_NAME || newValue.isEmpty())
+ return;
+
+ // open stdin for reading
+ qstdin.open(stdin, QIODevice::ReadOnly);
+
+ // find our remote
+ iface = new QDBusInterface(SERVICE_NAME, "/", "com.trolltech.QtDBus.ComplexPong.Pong",
+ QDBusConnection::sessionBus(), this);
+ if (!iface->isValid()) {
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ QCoreApplication::instance()->quit();
+ }
+
+ connect(iface, SIGNAL(aboutToQuit()), QCoreApplication::instance(), SLOT(quit()));
+
+ while (true) {
+ printf("Ask your question: ");
+
+ QString line = QString::fromLocal8Bit(qstdin.readLine()).trimmed();
+ if (line.isEmpty()) {
+ iface->call("quit");
+ return;
+ } else if (line == "value") {
+ QVariant reply = iface->property("value");
+ if (!reply.isNull())
+ printf("value = %s\n", qPrintable(reply.toString()));
+ } else if (line.startsWith("value=")) {
+ iface->setProperty("value", line.mid(6));
+ } else {
+ QDBusReply<QDBusVariant> reply = iface->call("query", line);
+ if (reply.isValid())
+ printf("Reply was: %s\n", qPrintable(reply.value().variant().toString()));
+ }
+
+ if (iface->lastError().isValid())
+ fprintf(stderr, "Call failed: %s\n", qPrintable(iface->lastError().message()));
+ }
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ Ping ping;
+ ping.connect(QDBusConnection::sessionBus().interface(),
+ SIGNAL(serviceOwnerChanged(QString,QString,QString)),
+ SLOT(start(QString,QString,QString)));
+
+ QProcess pong;
+ pong.start("./complexpong");
+
+ app.exec();
+}
diff --git a/examples/dbus/complexpingpong/complexping.h b/examples/dbus/complexpingpong/complexping.h
new file mode 100644
index 0000000..4c2a473
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexping.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COMPLEXPING_H
+#define COMPLEXPING_H
+
+#include <QtCore/QObject>
+#include <QtCore/QFile>
+#include <QtDBus/QDBusInterface>
+
+class Ping: public QObject
+{
+ Q_OBJECT
+public slots:
+ void start(const QString &, const QString &, const QString &);
+public:
+ QFile qstdin;
+ QDBusInterface *iface;
+};
+
+#endif
diff --git a/examples/dbus/complexpingpong/complexping.pro b/examples/dbus/complexpingpong/complexping.pro
new file mode 100644
index 0000000..4b37b03
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexping.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += complexping.h ping-common.h
+SOURCES += complexping.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/complexpingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/complexpingpong
+INSTALLS += target sources
diff --git a/examples/dbus/complexpingpong/complexpingpong.pro b/examples/dbus/complexpingpong/complexpingpong.pro
new file mode 100644
index 0000000..cd618d5
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpingpong.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+win32:CONFIG += console
+SUBDIRS = complexping.pro complexpong.pro
diff --git a/examples/dbus/complexpingpong/complexpong.cpp b/examples/dbus/complexpingpong/complexpong.cpp
new file mode 100644
index 0000000..283e440
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpong.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTimer>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+#include "complexpong.h"
+
+// the property
+QString Pong::value() const
+{
+ return m_value;
+}
+
+void Pong::setValue(const QString &newValue)
+{
+ m_value = newValue;
+}
+
+void Pong::quit()
+{
+ QTimer::singleShot(0, QCoreApplication::instance(), SLOT(quit()));
+}
+
+QDBusVariant Pong::query(const QString &query)
+{
+ QString q = query.toLower();
+ if (q == "hello")
+ return QDBusVariant("World");
+ if (q == "ping")
+ return QDBusVariant("Pong");
+ if (q.indexOf("the answer to life, the universe and everything") != -1)
+ return QDBusVariant(42);
+ if (q.indexOf("unladen swallow") != -1) {
+ if (q.indexOf("european") != -1)
+ return QDBusVariant(11.0);
+ return QDBusVariant(QByteArray("african or european?"));
+ }
+
+ return QDBusVariant("Sorry, I don't know the answer");
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ QObject obj;
+ Pong *pong = new Pong(&obj);
+ pong->connect(&app, SIGNAL(aboutToQuit()), SIGNAL(aboutToQuit()));
+ pong->setProperty("value", "initial value");
+ QDBusConnection::sessionBus().registerObject("/", &obj);
+
+ if (!QDBusConnection::sessionBus().registerService(SERVICE_NAME)) {
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ exit(1);
+ }
+
+ app.exec();
+ return 0;
+}
+
diff --git a/examples/dbus/complexpingpong/complexpong.h b/examples/dbus/complexpingpong/complexpong.h
new file mode 100644
index 0000000..5682e99
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpong.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COMPLEXPONG_H
+#define COMPLEXPONG_H
+
+#include <QtCore/QObject>
+#include <QtDBus/QDBusAbstractAdaptor>
+#include <QtDBus/QDBusVariant>
+
+class Pong: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.ComplexPong.Pong")
+ Q_PROPERTY(QString value READ value WRITE setValue)
+public:
+ QString m_value;
+ QString value() const;
+ void setValue(const QString &newValue);
+
+ Pong(QObject *obj) : QDBusAbstractAdaptor(obj)
+ { }
+signals:
+ void aboutToQuit();
+public slots:
+ QDBusVariant query(const QString &query);
+ Q_NOREPLY void quit();
+};
+
+#endif
diff --git a/examples/dbus/complexpingpong/complexpong.pro b/examples/dbus/complexpingpong/complexpong.pro
new file mode 100644
index 0000000..e62fb85
--- /dev/null
+++ b/examples/dbus/complexpingpong/complexpong.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += complexpong.h
+SOURCES += complexpong.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/complexpingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/complexpingpong
+INSTALLS += target sources
diff --git a/examples/dbus/complexpingpong/ping-common.h b/examples/dbus/complexpingpong/ping-common.h
new file mode 100644
index 0000000..06228a9
--- /dev/null
+++ b/examples/dbus/complexpingpong/ping-common.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define SERVICE_NAME "com.trolltech.QtDBus.PingExample"
diff --git a/examples/dbus/dbus-chat/chat.cpp b/examples/dbus/dbus-chat/chat.cpp
new file mode 100644
index 0000000..1dbc764
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "chat.h"
+#include <QtGui/QApplication>
+#include <QtGui/QMessageBox>
+
+#include "chat_adaptor.h"
+#include "chat_interface.h"
+
+ChatMainWindow::ChatMainWindow()
+ : m_nickname(QLatin1String("nickname"))
+{
+ setupUi(this);
+ sendButton->setEnabled(false);
+
+ connect(messageLineEdit, SIGNAL(textChanged(QString)),
+ this, SLOT(textChangedSlot(QString)));
+ connect(sendButton, SIGNAL(clicked(bool)), this, SLOT(sendClickedSlot()));
+ connect(actionChangeNickname, SIGNAL(triggered(bool)), this, SLOT(changeNickname()));
+ connect(actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(aboutQt()));
+ connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(exiting()));
+
+ // add our D-Bus interface and connect to D-Bus
+ new ChatAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/", this);
+
+ com::trolltech::chat *iface;
+ iface = new com::trolltech::chat(QString(), QString(), QDBusConnection::sessionBus(), this);
+ //connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString)));
+ QDBusConnection::sessionBus().connect(QString(), QString(), "com.trolltech.chat", "message", this, SLOT(messageSlot(QString,QString)));
+ connect(iface, SIGNAL(action(QString,QString)), this, SLOT(actionSlot(QString,QString)));
+
+ NicknameDialog dialog;
+ dialog.cancelButton->setVisible(false);
+ dialog.exec();
+ m_nickname = dialog.nickname->text().trimmed();
+ emit action(m_nickname, QLatin1String("joins the chat"));
+}
+
+ChatMainWindow::~ChatMainWindow()
+{
+}
+
+void ChatMainWindow::rebuildHistory()
+{
+ QString history = m_messages.join( QLatin1String("\n" ) );
+ chatHistory->setPlainText(history);
+}
+
+void ChatMainWindow::messageSlot(const QString &nickname, const QString &text)
+{
+ QString msg( QLatin1String("<%1> %2") );
+ msg = msg.arg(nickname, text);
+ m_messages.append(msg);
+
+ if (m_messages.count() > 100)
+ m_messages.removeFirst();
+ rebuildHistory();
+}
+
+void ChatMainWindow::actionSlot(const QString &nickname, const QString &text)
+{
+ QString msg( QLatin1String("* %1 %2") );
+ msg = msg.arg(nickname, text);
+ m_messages.append(msg);
+
+ if (m_messages.count() > 100)
+ m_messages.removeFirst();
+ rebuildHistory();
+}
+
+void ChatMainWindow::textChangedSlot(const QString &newText)
+{
+ sendButton->setEnabled(!newText.isEmpty());
+}
+
+void ChatMainWindow::sendClickedSlot()
+{
+ //emit message(m_nickname, messageLineEdit->text());
+ QDBusMessage msg = QDBusMessage::createSignal("/", "com.trolltech.chat", "message");
+ msg << m_nickname << messageLineEdit->text();
+ QDBusConnection::sessionBus().send(msg);
+ messageLineEdit->setText(QString());
+}
+
+void ChatMainWindow::changeNickname()
+{
+ NicknameDialog dialog(this);
+ if (dialog.exec() == QDialog::Accepted) {
+ QString old = m_nickname;
+ m_nickname = dialog.nickname->text().trimmed();
+ emit action(old, QString("is now known as %1").arg(m_nickname));
+ }
+}
+
+void ChatMainWindow::aboutQt()
+{
+ QMessageBox::aboutQt(this);
+}
+
+void ChatMainWindow::exiting()
+{
+ emit action(m_nickname, QLatin1String("leaves the chat"));
+}
+
+NicknameDialog::NicknameDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+}
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ qWarning("Cannot connect to the D-Bus session bus.\n"
+ "Please check your system settings and try again.\n");
+ return 1;
+ }
+
+ ChatMainWindow chat;
+ chat.show();
+ return app.exec();
+}
diff --git a/examples/dbus/dbus-chat/chat.h b/examples/dbus/dbus-chat/chat.h
new file mode 100644
index 0000000..48b549e
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CHAT_H
+#define CHAT_H
+
+#include <QtCore/QStringList>
+#include <QtDBus/QtDBus>
+#include "ui_chatmainwindow.h"
+#include "ui_chatsetnickname.h"
+
+class ChatMainWindow: public QMainWindow, Ui::ChatMainWindow
+{
+ Q_OBJECT
+ QString m_nickname;
+ QStringList m_messages;
+public:
+ ChatMainWindow();
+ ~ChatMainWindow();
+
+ void rebuildHistory();
+
+signals:
+ void message(const QString &nickname, const QString &text);
+ void action(const QString &nickname, const QString &text);
+
+private slots:
+ void messageSlot(const QString &nickname, const QString &text);
+ void actionSlot(const QString &nickname, const QString &text);
+ void textChangedSlot(const QString &newText);
+ void sendClickedSlot();
+ void changeNickname();
+ void aboutQt();
+ void exiting();
+};
+
+class NicknameDialog: public QDialog, public Ui::NicknameDialog
+{
+ Q_OBJECT
+public:
+ NicknameDialog(QWidget *parent = 0);
+};
+
+#endif
diff --git a/examples/dbus/dbus-chat/chat_adaptor.cpp b/examples/dbus/dbus-chat/chat_adaptor.cpp
new file mode 100644
index 0000000..4292a58
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_adaptor.cpp
@@ -0,0 +1,35 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -i chat_adaptor.h -a :chat_adaptor.cpp com.trolltech.chat.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#include "chat_adaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class ChatAdaptor
+ */
+
+ChatAdaptor::ChatAdaptor(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
+{
+ // constructor
+ setAutoRelaySignals(true);
+}
+
+ChatAdaptor::~ChatAdaptor()
+{
+ // destructor
+}
+
diff --git a/examples/dbus/dbus-chat/chat_adaptor.h b/examples/dbus/dbus-chat/chat_adaptor.h
new file mode 100644
index 0000000..9d8e7a6
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_adaptor.h
@@ -0,0 +1,57 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -a chat_adaptor.h: com.trolltech.chat.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CHAT_ADAPTOR_H_142741156243605
+#define CHAT_ADAPTOR_H_142741156243605
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+
+QT_BEGIN_NAMESPACE
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+QT_END_NAMESPACE
+
+/*
+ * Adaptor class for interface com.trolltech.chat
+ */
+class ChatAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.chat")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.trolltech.chat\" >\n"
+" <signal name=\"message\" >\n"
+" <arg direction=\"out\" type=\"s\" name=\"nickname\" />\n"
+" <arg direction=\"out\" type=\"s\" name=\"text\" />\n"
+" </signal>\n"
+" <signal name=\"action\" >\n"
+" <arg direction=\"out\" type=\"s\" name=\"nickname\" />\n"
+" <arg direction=\"out\" type=\"s\" name=\"text\" />\n"
+" </signal>\n"
+" </interface>\n"
+ "")
+public:
+ ChatAdaptor(QObject *parent);
+ virtual ~ChatAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+Q_SIGNALS: // SIGNALS
+ void action(const QString &nickname, const QString &text);
+ void message(const QString &nickname, const QString &text);
+};
+
+#endif
diff --git a/examples/dbus/dbus-chat/chat_interface.cpp b/examples/dbus/dbus-chat/chat_interface.cpp
new file mode 100644
index 0000000..5e2d2a7
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_interface.cpp
@@ -0,0 +1,25 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -i chat_interface.h -p :chat_interface.cpp chat/com.trolltech.chat.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "chat_interface.h"
+/*
+ * Implementation of interface class ComTrolltechChatInterface
+ */
+
+ComTrolltechChatInterface::ComTrolltechChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+ComTrolltechChatInterface::~ComTrolltechChatInterface()
+{
+}
+
diff --git a/examples/dbus/dbus-chat/chat_interface.h b/examples/dbus/dbus-chat/chat_interface.h
new file mode 100644
index 0000000..75140cc
--- /dev/null
+++ b/examples/dbus/dbus-chat/chat_interface.h
@@ -0,0 +1,49 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -p chat_interface.h: com.trolltech.chat.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef CHAT_INTERFACE_H_143021156243606
+#define CHAT_INTERFACE_H_143021156243606
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface com.trolltech.chat
+ */
+class ComTrolltechChatInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "com.trolltech.chat"; }
+
+public:
+ ComTrolltechChatInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~ComTrolltechChatInterface();
+
+public Q_SLOTS: // METHODS
+Q_SIGNALS: // SIGNALS
+ void action(const QString &nickname, const QString &text);
+ void message(const QString &nickname, const QString &text);
+};
+
+namespace com {
+ namespace trolltech {
+ typedef ::ComTrolltechChatInterface chat;
+ }
+}
+#endif
diff --git a/examples/dbus/dbus-chat/chatmainwindow.ui b/examples/dbus/dbus-chat/chatmainwindow.ui
new file mode 100644
index 0000000..0616dcb
--- /dev/null
+++ b/examples/dbus/dbus-chat/chatmainwindow.ui
@@ -0,0 +1,185 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>ChatMainWindow</class>
+ <widget class="QMainWindow" name="ChatMainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>QtDBus Chat</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QTextBrowser" name="chatHistory" >
+ <property name="acceptDrops" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" >
+ <string>Messages sent and received from other users</string>
+ </property>
+ <property name="acceptRichText" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Message:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>messageLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="messageLineEdit" />
+ </item>
+ <item>
+ <widget class="QPushButton" name="sendButton" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" >
+ <string>Sends a message to other people</string>
+ </property>
+ <property name="whatsThis" >
+ <string/>
+ </property>
+ <property name="text" >
+ <string>Send</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>31</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuQuit" >
+ <property name="title" >
+ <string>Help</string>
+ </property>
+ <addaction name="actionAboutQt" />
+ </widget>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>File</string>
+ </property>
+ <addaction name="actionChangeNickname" />
+ <addaction name="separator" />
+ <addaction name="actionQuit" />
+ </widget>
+ <addaction name="menuFile" />
+ <addaction name="menuQuit" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionQuit" >
+ <property name="text" >
+ <string>Quit</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ <action name="actionAboutQt" >
+ <property name="text" >
+ <string>About Qt...</string>
+ </property>
+ </action>
+ <action name="actionChangeNickname" >
+ <property name="text" >
+ <string>Change nickname...</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <tabstops>
+ <tabstop>chatHistory</tabstop>
+ <tabstop>messageLineEdit</tabstop>
+ <tabstop>sendButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>messageLineEdit</sender>
+ <signal>returnPressed()</signal>
+ <receiver>sendButton</receiver>
+ <slot>animateClick()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>299</x>
+ <y>554</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>744</x>
+ <y>551</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>actionQuit</sender>
+ <signal>triggered(bool)</signal>
+ <receiver>ChatMainWindow</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>-1</x>
+ <y>-1</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>399</x>
+ <y>299</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/dbus/dbus-chat/chatsetnickname.ui b/examples/dbus/dbus-chat/chatsetnickname.ui
new file mode 100644
index 0000000..fb9894e
--- /dev/null
+++ b/examples/dbus/dbus-chat/chatsetnickname.ui
@@ -0,0 +1,149 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>NicknameDialog</class>
+ <widget class="QDialog" name="NicknameDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>396</width>
+ <height>105</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Set nickname</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>New nickname:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="nickname" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>131</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>NicknameDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>278</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>96</x>
+ <y>254</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>NicknameDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>369</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>179</x>
+ <y>282</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/dbus/dbus-chat/com.trolltech.chat.xml b/examples/dbus/dbus-chat/com.trolltech.chat.xml
new file mode 100644
index 0000000..618c8c4
--- /dev/null
+++ b/examples/dbus/dbus-chat/com.trolltech.chat.xml
@@ -0,0 +1,15 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="com.trolltech.chat">
+ <signal name="message">
+ <arg name="nickname" type="s" direction="out"/>
+ <arg name="text" type="s" direction="out"/>
+ </signal>
+ <signal name="action">
+ <arg name="nickname" type="s" direction="out"/>
+ <arg name="text" type="s" direction="out"/>
+ </signal>
+ </interface>
+</node>
+
diff --git a/examples/dbus/dbus-chat/dbus-chat.pro b/examples/dbus/dbus-chat/dbus-chat.pro
new file mode 100644
index 0000000..a094048
--- /dev/null
+++ b/examples/dbus/dbus-chat/dbus-chat.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += qdbus
+
+# Input
+HEADERS += chat.h chat_adaptor.h chat_interface.h
+SOURCES += chat.cpp chat_adaptor.cpp chat_interface.cpp
+FORMS += chatmainwindow.ui chatsetnickname.ui
+
+#DBUS_ADAPTORS += com.trolltech.chat.xml
+#DBUS_INTERFACES += com.trolltech.chat.xml
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/chat
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/chat
+INSTALLS += target sources
diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro
new file mode 100644
index 0000000..36bdc1a
--- /dev/null
+++ b/examples/dbus/dbus.pro
@@ -0,0 +1,12 @@
+TEMPLATE = subdirs
+SUBDIRS = listnames \
+ pingpong \
+ complexpingpong \
+ dbus-chat \
+ remotecontrolledcar
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus
+sources.files = *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus
+INSTALLS += sources
diff --git a/examples/dbus/listnames/listnames.cpp b/examples/dbus/listnames/listnames.cpp
new file mode 100644
index 0000000..dca32e6
--- /dev/null
+++ b/examples/dbus/listnames/listnames.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+#include <QtCore/QStringList>
+#include <QtDBus/QtDBus>
+
+void method1()
+{
+ qDebug() << "Method 1:";
+
+ QDBusReply<QStringList> reply = QDBusConnection::sessionBus().interface()->registeredServiceNames();
+ if (!reply.isValid()) {
+ qDebug() << "Error:" << reply.error().message();
+ exit(1);
+ }
+ foreach (QString name, reply.value())
+ qDebug() << name;
+}
+
+void method2()
+{
+ qDebug() << "Method 2:";
+
+ QDBusConnection bus = QDBusConnection::sessionBus();
+ QDBusInterface dbus_iface("org.freedesktop.DBus", "/org/freedesktop/DBus",
+ "org.freedesktop.DBus", bus);
+ qDebug() << dbus_iface.call("ListNames").arguments().at(0);
+}
+
+void method3()
+{
+ qDebug() << "Method 3:";
+ qDebug() << QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ method1();
+ method2();
+ method3();
+
+ return 0;
+}
diff --git a/examples/dbus/listnames/listnames.pro b/examples/dbus/listnames/listnames.pro
new file mode 100644
index 0000000..e2096a7
--- /dev/null
+++ b/examples/dbus/listnames/listnames.pro
@@ -0,0 +1,17 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+win32:CONFIG += console
+
+# Input
+SOURCES += listnames.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/listnames
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/listnames
+INSTALLS += target sources
+
diff --git a/examples/dbus/pingpong/ping-common.h b/examples/dbus/pingpong/ping-common.h
new file mode 100644
index 0000000..06228a9
--- /dev/null
+++ b/examples/dbus/pingpong/ping-common.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define SERVICE_NAME "com.trolltech.QtDBus.PingExample"
diff --git a/examples/dbus/pingpong/ping.cpp b/examples/dbus/pingpong/ping.cpp
new file mode 100644
index 0000000..d773be4
--- /dev/null
+++ b/examples/dbus/pingpong/ping.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdio.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ QDBusInterface iface(SERVICE_NAME, "/", "", QDBusConnection::sessionBus());
+ if (iface.isValid()) {
+ QDBusReply<QString> reply = iface.call("ping", argc > 1 ? argv[1] : "");
+ if (reply.isValid()) {
+ printf("Reply was: %s\n", qPrintable(reply.value()));
+ return 0;
+ }
+
+ fprintf(stderr, "Call failed: %s\n", qPrintable(reply.error().message()));
+ return 1;
+ }
+
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ return 1;
+}
diff --git a/examples/dbus/pingpong/ping.pro b/examples/dbus/pingpong/ping.pro
new file mode 100644
index 0000000..5e5f07a
--- /dev/null
+++ b/examples/dbus/pingpong/ping.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET = ping
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += ping-common.h
+SOURCES += ping.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong
+INSTALLS += target sources
diff --git a/examples/dbus/pingpong/pingpong.pro b/examples/dbus/pingpong/pingpong.pro
new file mode 100644
index 0000000..07fca74
--- /dev/null
+++ b/examples/dbus/pingpong/pingpong.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+win32:CONFIG += console
+SUBDIRS = ping.pro pong.pro
diff --git a/examples/dbus/pingpong/pong.cpp b/examples/dbus/pingpong/pong.cpp
new file mode 100644
index 0000000..fc7800c
--- /dev/null
+++ b/examples/dbus/pingpong/pong.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTimer>
+#include <QtDBus/QtDBus>
+
+#include "ping-common.h"
+#include "pong.h"
+
+QString Pong::ping(const QString &arg)
+{
+ QMetaObject::invokeMethod(QCoreApplication::instance(), "quit");
+ return QString("ping(\"%1\") got called").arg(arg);
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ if (!QDBusConnection::sessionBus().registerService(SERVICE_NAME)) {
+ fprintf(stderr, "%s\n",
+ qPrintable(QDBusConnection::sessionBus().lastError().message()));
+ exit(1);
+ }
+
+ Pong pong;
+ QDBusConnection::sessionBus().registerObject("/", &pong, QDBusConnection::ExportAllSlots);
+
+ app.exec();
+ return 0;
+}
diff --git a/examples/dbus/pingpong/pong.h b/examples/dbus/pingpong/pong.h
new file mode 100644
index 0000000..4bc45d8
--- /dev/null
+++ b/examples/dbus/pingpong/pong.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PONG_H
+#define PONG_H
+
+#include <QtCore/QObject>
+
+class Pong: public QObject
+{
+ Q_OBJECT
+public slots:
+ Q_SCRIPTABLE QString ping(const QString &arg);
+};
+
+#endif
diff --git a/examples/dbus/pingpong/pong.pro b/examples/dbus/pingpong/pong.pro
new file mode 100644
index 0000000..f377a71
--- /dev/null
+++ b/examples/dbus/pingpong/pong.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET = pong
+DEPENDPATH += .
+INCLUDEPATH += .
+QT -= gui
+CONFIG += qdbus
+
+# Input
+HEADERS += ping-common.h pong.h
+SOURCES += pong.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong
+INSTALLS += target sources
diff --git a/examples/dbus/remotecontrolledcar/car/car.cpp b/examples/dbus/remotecontrolledcar/car/car.cpp
new file mode 100644
index 0000000..5f3bef9
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "car.h"
+#include <QtGui/QtGui>
+#include <math.h>
+
+static const double Pi = 3.14159265358979323846264338327950288419717;
+
+QRectF Car::boundingRect() const
+{
+ return QRectF(-35, -81, 70, 115);
+}
+
+Car::Car() : color(Qt::green), wheelsAngle(0), speed(0)
+{
+ startTimer(1000 / 33);
+ setFlag(QGraphicsItem::ItemIsMovable, true);
+ setFlag(QGraphicsItem::ItemIsFocusable, true);
+}
+
+void Car::accelerate()
+{
+ if (speed < 10)
+ ++speed;
+}
+
+void Car::decelerate()
+{
+ if (speed > -10)
+ --speed;
+}
+
+void Car::turnLeft()
+{
+ if (wheelsAngle > -30)
+ wheelsAngle -= 5;
+}
+
+void Car::turnRight()
+{
+ if (wheelsAngle < 30)
+ wheelsAngle += 5;
+}
+
+void Car::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->setBrush(Qt::gray);
+ painter->drawRect(-20, -58, 40, 2); // front axel
+ painter->drawRect(-20, 7, 40, 2); // rear axel
+
+ painter->setBrush(color);
+ painter->drawRect(-25, -79, 50, 10); // front wing
+
+ painter->drawEllipse(-25, -48, 50, 20); // side pods
+ painter->drawRect(-25, -38, 50, 35); // side pods
+ painter->drawRect(-5, 9, 10, 10); // back pod
+
+ painter->drawEllipse(-10, -81, 20, 100); // main body
+
+ painter->drawRect(-17, 19, 34, 15); // rear wing
+
+ painter->setBrush(Qt::black);
+ painter->drawPie(-5, -51, 10, 15, 0, 180 * 16);
+ painter->drawRect(-5, -44, 10, 10); // cocpit
+
+ painter->save();
+ painter->translate(-20, -58);
+ painter->rotate(wheelsAngle);
+ painter->drawRect(-10, -7, 10, 15); // front left
+ painter->restore();
+
+ painter->save();
+ painter->translate(20, -58);
+ painter->rotate(wheelsAngle);
+ painter->drawRect(0, -7, 10, 15); // front left
+ painter->restore();
+
+ painter->drawRect(-30, 0, 12, 17); // rear left
+ painter->drawRect(19, 0, 12, 17); // rear right
+}
+
+void Car::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+
+ const qreal axelDistance = 54;
+ qreal wheelsAngleRads = (wheelsAngle * Pi) / 180;
+ qreal turnDistance = ::cos(wheelsAngleRads) * axelDistance * 2;
+ qreal turnRateRads = wheelsAngleRads / turnDistance; // rough estimate
+ qreal turnRate = (turnRateRads * 180) / Pi;
+ qreal rotation = speed * turnRate;
+
+ rotate(rotation);
+ translate(0, -speed);
+ update();
+}
diff --git a/examples/dbus/remotecontrolledcar/car/car.h b/examples/dbus/remotecontrolledcar/car/car.h
new file mode 100644
index 0000000..609bc03
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CAR_H
+#define CAR_H
+
+#include <QGraphicsItem>
+#include <QObject>
+#include <QBrush>
+
+class Car : public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+
+public:
+ Car();
+ QRectF boundingRect() const;
+
+public Q_SLOTS:
+ void accelerate();
+ void decelerate();
+ void turnLeft();
+ void turnRight();
+
+Q_SIGNALS:
+ void crashed();
+
+protected:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void timerEvent(QTimerEvent *event);
+
+private:
+ QBrush color;
+ qreal wheelsAngle; // used when applying rotation
+ qreal speed; // delta movement along the body axis
+};
+
+#endif // CAR_H
diff --git a/examples/dbus/remotecontrolledcar/car/car.pro b/examples/dbus/remotecontrolledcar/car/car.pro
new file mode 100644
index 0000000..d4a97fa
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.pro
@@ -0,0 +1,20 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Mon Aug 28 19:50:14 2006
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += qdbus
+
+# Input
+# DBUS_ADAPTORS += car.xml
+HEADERS += car.h car_adaptor_p.h
+SOURCES += car.cpp main.cpp car_adaptor.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/car
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xml
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/car
+INSTALLS += target sources
diff --git a/examples/dbus/remotecontrolledcar/car/car.xml b/examples/dbus/remotecontrolledcar/car/car.xml
new file mode 100644
index 0000000..641c698
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car.xml
@@ -0,0 +1,11 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/com/trollech/examples/car">
+ <interface name="com.trolltech.Examples.CarInterface">
+ <method name="accelerate"/>
+ <method name="decelerate"/>
+ <method name="turnLeft"/>
+ <method name="turnRight"/>
+ <signal name="crashed"/>
+ </interface>
+</node> \ No newline at end of file
diff --git a/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp b/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp
new file mode 100644
index 0000000..f0c9aa0
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car_adaptor.cpp
@@ -0,0 +1,59 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -c CarAdaptor -a car_adaptor_p.h:car_adaptor.cpp car.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#include "car_adaptor_p.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class CarAdaptor
+ */
+
+CarAdaptor::CarAdaptor(QObject *parent)
+ : QDBusAbstractAdaptor(parent)
+{
+ // constructor
+ setAutoRelaySignals(true);
+}
+
+CarAdaptor::~CarAdaptor()
+{
+ // destructor
+}
+
+void CarAdaptor::accelerate()
+{
+ // handle method call com.trolltech.Examples.CarInterface.accelerate
+ QMetaObject::invokeMethod(parent(), "accelerate");
+}
+
+void CarAdaptor::decelerate()
+{
+ // handle method call com.trolltech.Examples.CarInterface.decelerate
+ QMetaObject::invokeMethod(parent(), "decelerate");
+}
+
+void CarAdaptor::turnLeft()
+{
+ // handle method call com.trolltech.Examples.CarInterface.turnLeft
+ QMetaObject::invokeMethod(parent(), "turnLeft");
+}
+
+void CarAdaptor::turnRight()
+{
+ // handle method call com.trolltech.Examples.CarInterface.turnRight
+ QMetaObject::invokeMethod(parent(), "turnRight");
+}
+
diff --git a/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h b/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h
new file mode 100644
index 0000000..39782f5
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/car_adaptor_p.h
@@ -0,0 +1,57 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -c CarAdaptor -a car_adaptor_p.h:car_adaptor.cpp car.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CAR_ADAPTOR_P_H_1157030132
+#define CAR_ADAPTOR_P_H_1157030132
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+
+QT_BEGIN_NAMESPACE
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+QT_END_NAMESPACE
+
+/*
+ * Adaptor class for interface com.trolltech.Examples.CarInterface
+ */
+class CarAdaptor: public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.Examples.CarInterface")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.trolltech.Examples.CarInterface\" >\n"
+" <method name=\"accelerate\" />\n"
+" <method name=\"decelerate\" />\n"
+" <method name=\"turnLeft\" />\n"
+" <method name=\"turnRight\" />\n"
+" <signal name=\"crashed\" />\n"
+" </interface>\n"
+ "")
+public:
+ CarAdaptor(QObject *parent);
+ virtual ~CarAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+ void accelerate();
+ void decelerate();
+ void turnLeft();
+ void turnRight();
+Q_SIGNALS: // SIGNALS
+ void crashed();
+};
+
+#endif
diff --git a/examples/dbus/remotecontrolledcar/car/main.cpp b/examples/dbus/remotecontrolledcar/car/main.cpp
new file mode 100644
index 0000000..13a191a
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/car/main.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "car.h"
+#include "car_adaptor_p.h"
+#include <QtGui/QApplication>
+#include <QtGui/QGraphicsView>
+#include <QtGui/QGraphicsScene>
+#include <QtDBus/QDBusConnection>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QGraphicsScene scene;
+ scene.setSceneRect(-500, -500, 1000, 1000);
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+
+ Car *car = new Car();
+ scene.addItem(car);
+
+ QGraphicsView view(&scene);
+ view.setRenderHint(QPainter::Antialiasing);
+ view.setBackgroundBrush(Qt::darkGray);
+ view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Qt DBus Controlled Car"));
+ view.resize(400, 300);
+ view.show();
+
+ new CarAdaptor(car);
+ QDBusConnection connection = QDBusConnection::sessionBus();
+ connection.registerObject("/Car", car);
+ connection.registerService("com.trolltech.CarExample");
+
+ return app.exec();
+}
diff --git a/examples/dbus/remotecontrolledcar/controller/car.xml b/examples/dbus/remotecontrolledcar/controller/car.xml
new file mode 100644
index 0000000..641c698
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/car.xml
@@ -0,0 +1,11 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/com/trollech/examples/car">
+ <interface name="com.trolltech.Examples.CarInterface">
+ <method name="accelerate"/>
+ <method name="decelerate"/>
+ <method name="turnLeft"/>
+ <method name="turnRight"/>
+ <signal name="crashed"/>
+ </interface>
+</node> \ No newline at end of file
diff --git a/examples/dbus/remotecontrolledcar/controller/car_interface.cpp b/examples/dbus/remotecontrolledcar/controller/car_interface.cpp
new file mode 100644
index 0000000..daa9467
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/car_interface.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -c CarInterface -p car_interface_p.h:car_interface.cpp car.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "car_interface_p.h"
+
+/*
+ * Implementation of interface class CarInterface
+ */
+
+CarInterface::CarInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+CarInterface::~CarInterface()
+{
+}
+
diff --git a/examples/dbus/remotecontrolledcar/controller/car_interface_p.h b/examples/dbus/remotecontrolledcar/controller/car_interface_p.h
new file mode 100644
index 0000000..3373312
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/car_interface_p.h
@@ -0,0 +1,74 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -c CarInterface -p car_interface_p.h:car_interface.cpp car.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef CAR_INTERFACE_P_H_1156853585
+#define CAR_INTERFACE_P_H_1156853585
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface com.trolltech.Examples.CarInterface
+ */
+class CarInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "com.trolltech.Examples.CarInterface"; }
+
+public:
+ CarInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~CarInterface();
+
+public Q_SLOTS: // METHODS
+ inline QDBusReply<void> accelerate()
+ {
+ QList<QVariant> argumentList;
+ return callWithArgumentList(QDBus::Block, QLatin1String("accelerate"), argumentList);
+ }
+
+ inline QDBusReply<void> decelerate()
+ {
+ QList<QVariant> argumentList;
+ return callWithArgumentList(QDBus::Block, QLatin1String("decelerate"), argumentList);
+ }
+
+ inline QDBusReply<void> turnLeft()
+ {
+ QList<QVariant> argumentList;
+ return callWithArgumentList(QDBus::Block, QLatin1String("turnLeft"), argumentList);
+ }
+
+ inline QDBusReply<void> turnRight()
+ {
+ QList<QVariant> argumentList;
+ return callWithArgumentList(QDBus::Block, QLatin1String("turnRight"), argumentList);
+ }
+
+Q_SIGNALS: // SIGNALS
+ void crashed();
+};
+
+namespace com {
+ namespace trolltech {
+ namespace Examples {
+ typedef ::CarInterface CarInterface;
+ }
+ }
+}
+#endif
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.cpp b/examples/dbus/remotecontrolledcar/controller/controller.cpp
new file mode 100644
index 0000000..7d27bd3
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "controller.h"
+#include "car_interface_p.h"
+
+Controller::Controller(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+ car = new CarInterface("com.trolltech.CarExample", "/Car",
+ QDBusConnection::sessionBus(), this);
+ startTimer(1000);
+}
+
+void Controller::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+ if (car->isValid())
+ ui.label->setText("connected");
+ else
+ ui.label->setText("disconnected");
+}
+
+void Controller::on_accelerate_clicked()
+{
+ car->accelerate();
+}
+
+void Controller::on_decelerate_clicked()
+{
+ car->decelerate();
+}
+
+void Controller::on_left_clicked()
+{
+ car->turnLeft();
+}
+
+void Controller::on_right_clicked()
+{
+ car->turnRight();
+}
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.h b/examples/dbus/remotecontrolledcar/controller/controller.h
new file mode 100644
index 0000000..200ef3c
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONTROLLER_H
+#define CONTROLLER_H
+
+#include "ui_controller.h"
+
+class CarInterface;
+
+class Controller : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Controller(QWidget *parent = 0);
+
+protected:
+ void timerEvent(QTimerEvent *event);
+
+private slots:
+ void on_accelerate_clicked();
+ void on_decelerate_clicked();
+ void on_left_clicked();
+ void on_right_clicked();
+
+private:
+ Ui::Controller ui;
+ CarInterface *car;
+};
+
+#endif
+
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro
new file mode 100644
index 0000000..3015127
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.pro
@@ -0,0 +1,21 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Aug 29 12:28:05 2006
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += qdbus
+
+# Input
+# DBUS_INTERFACES += car.xml
+FORMS += controller.ui
+HEADERS += car_interface_p.h controller.h
+SOURCES += main.cpp car_interface.cpp controller.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/controller
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.xml
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/controller
+INSTALLS += target sources
diff --git a/examples/dbus/remotecontrolledcar/controller/controller.ui b/examples/dbus/remotecontrolledcar/controller/controller.ui
new file mode 100644
index 0000000..379015b
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/controller.ui
@@ -0,0 +1,64 @@
+<ui version="4.0" >
+ <class>Controller</class>
+ <widget class="QWidget" name="Controller" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>255</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Controller</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="1" column="1" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Controller</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QPushButton" name="decelerate" >
+ <property name="text" >
+ <string>Decelerate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QPushButton" name="accelerate" >
+ <property name="text" >
+ <string>Accelerate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="right" >
+ <property name="text" >
+ <string>Right</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QPushButton" name="left" >
+ <property name="text" >
+ <string>Left</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/dbus/remotecontrolledcar/controller/main.cpp b/examples/dbus/remotecontrolledcar/controller/main.cpp
new file mode 100644
index 0000000..f28661e
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/controller/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtDBus>
+
+#include "controller.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Controller controller;
+ controller.show();
+ return app.exec();
+}
diff --git a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro
new file mode 100644
index 0000000..73bfa37
--- /dev/null
+++ b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+SUBDIRS = car \
+ controller
+
+# install
+sources.files = *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar
+INSTALLS += sources
diff --git a/examples/designer/README b/examples/designer/README
new file mode 100644
index 0000000..fb9443c
--- /dev/null
+++ b/examples/designer/README
@@ -0,0 +1,37 @@
+Qt Designer is a capable graphical user interface designer that lets you
+create and configure forms without writing code. GUIs created with
+Qt Designer can be compiled into an application or created at run-time.
+
+
+Some of the examples in this directory can be run from the example launcher;
+others can only be used from within Qt Designer.
+
+Documentation for these examples can be found via the "Tutorial and Examples"
+link in the main Qt documentation.
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/designer/calculatorbuilder/calculatorbuilder.pro b/examples/designer/calculatorbuilder/calculatorbuilder.pro
new file mode 100644
index 0000000..1d69cc8
--- /dev/null
+++ b/examples/designer/calculatorbuilder/calculatorbuilder.pro
@@ -0,0 +1,14 @@
+#! [0]
+CONFIG += uitools
+
+HEADERS = calculatorform.h
+RESOURCES = calculatorbuilder.qrc
+SOURCES = calculatorform.cpp \
+ main.cpp
+#! [0]
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorbuilder
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.ui *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorbuilder
+INSTALLS += target sources
diff --git a/examples/designer/calculatorbuilder/calculatorbuilder.qrc b/examples/designer/calculatorbuilder/calculatorbuilder.qrc
new file mode 100644
index 0000000..19b3905
--- /dev/null
+++ b/examples/designer/calculatorbuilder/calculatorbuilder.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/forms">
+ <file>calculatorform.ui</file>
+</qresource>
+</RCC>
diff --git a/examples/designer/calculatorbuilder/calculatorform.cpp b/examples/designer/calculatorbuilder/calculatorform.cpp
new file mode 100644
index 0000000..92d75c5
--- /dev/null
+++ b/examples/designer/calculatorbuilder/calculatorform.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include <QtUiTools>
+//! [0]
+#include <QtGui>
+
+#include "calculatorform.h"
+
+//! [1]
+CalculatorForm::CalculatorForm(QWidget *parent)
+ : QWidget(parent)
+{
+ QUiLoader loader;
+
+ QFile file(":/forms/calculatorform.ui");
+ file.open(QFile::ReadOnly);
+ QWidget *formWidget = loader.load(&file, this);
+ file.close();
+//! [1]
+
+//! [2]
+ ui_inputSpinBox1 = qFindChild<QSpinBox*>(this, "inputSpinBox1");
+ ui_inputSpinBox2 = qFindChild<QSpinBox*>(this, "inputSpinBox2");
+ ui_outputWidget = qFindChild<QLabel*>(this, "outputWidget");
+//! [2]
+
+//! [3]
+ QMetaObject::connectSlotsByName(this);
+//! [3]
+
+//! [4]
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(formWidget);
+ setLayout(layout);
+
+ setWindowTitle(tr("Calculator Builder"));
+}
+//! [4]
+
+//! [5]
+void CalculatorForm::on_inputSpinBox1_valueChanged(int value)
+{
+ ui_outputWidget->setText(QString::number(value + ui_inputSpinBox2->value()));
+}
+//! [5] //! [6]
+
+//! [6] //! [7]
+void CalculatorForm::on_inputSpinBox2_valueChanged(int value)
+{
+ ui_outputWidget->setText(QString::number(value + ui_inputSpinBox1->value()));
+}
+//! [7]
diff --git a/examples/designer/calculatorbuilder/calculatorform.h b/examples/designer/calculatorbuilder/calculatorform.h
new file mode 100644
index 0000000..8b322b7
--- /dev/null
+++ b/examples/designer/calculatorbuilder/calculatorform.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CALCULATORFORM_H
+#define CALCULATORFORM_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QLabel;
+class QSpinBox;
+QT_END_NAMESPACE
+
+//! [0]
+class CalculatorForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ CalculatorForm(QWidget *parent = 0);
+
+private slots:
+ void on_inputSpinBox1_valueChanged(int value);
+ void on_inputSpinBox2_valueChanged(int value);
+
+private:
+ QSpinBox *ui_inputSpinBox1;
+ QSpinBox *ui_inputSpinBox2;
+ QLabel *ui_outputWidget;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/calculatorbuilder/calculatorform.ui b/examples/designer/calculatorbuilder/calculatorform.ui
new file mode 100644
index 0000000..dda0e62
--- /dev/null
+++ b/examples/designer/calculatorbuilder/calculatorform.ui
@@ -0,0 +1,303 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>CalculatorForm</class>
+ <widget class="QWidget" name="CalculatorForm" >
+ <property name="objectName" >
+ <string notr="true" >CalculatorForm</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>276</width>
+ <height>98</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Calculator Builder</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="objectName" >
+ <string notr="true" >label</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>45</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Input 1</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="inputSpinBox1" >
+ <property name="objectName" >
+ <string notr="true" >inputSpinBox1</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>26</y>
+ <width>45</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="mouseTracking" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="objectName" >
+ <string notr="true" >label_3</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>54</x>
+ <y>1</y>
+ <width>7</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>+</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="objectName" >
+ <string notr="true" >label_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>45</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Input 2</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="inputSpinBox2" >
+ <property name="objectName" >
+ <string notr="true" >inputSpinBox2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>26</y>
+ <width>45</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <property name="mouseTracking" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3_2" >
+ <property name="objectName" >
+ <string notr="true" >label_3_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>120</x>
+ <y>1</y>
+ <width>7</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>=</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2_2_2" >
+ <property name="objectName" >
+ <string notr="true" >label_2_2_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>37</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Output</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="outputWidget" >
+ <property name="objectName" >
+ <string notr="true" >outputWidget</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>24</y>
+ <width>37</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text" >
+ <string>0</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="objectName" >
+ <string notr="true" >verticalSpacer</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>85</x>
+ <y>69</y>
+ <width>20</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1" >
+ <spacer>
+ <property name="objectName" >
+ <string notr="true" >horizontalSpacer</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>188</x>
+ <y>26</y>
+ <width>79</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/designer/calculatorbuilder/main.cpp b/examples/designer/calculatorbuilder/main.cpp
new file mode 100644
index 0000000..56358b8
--- /dev/null
+++ b/examples/designer/calculatorbuilder/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "calculatorform.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(calculatorbuilder);
+
+ QApplication app(argc, argv);
+ CalculatorForm calculator;
+ calculator.show();
+ return app.exec();
+}
diff --git a/examples/designer/calculatorform/calculatorform.cpp b/examples/designer/calculatorform/calculatorform.cpp
new file mode 100644
index 0000000..3de2852
--- /dev/null
+++ b/examples/designer/calculatorform/calculatorform.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "calculatorform.h"
+
+//! [0]
+CalculatorForm::CalculatorForm(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+}
+//! [0]
+
+//! [1]
+void CalculatorForm::on_inputSpinBox1_valueChanged(int value)
+{
+ ui.outputWidget->setText(QString::number(value + ui.inputSpinBox2->value()));
+}
+//! [1]
+
+//! [2]
+void CalculatorForm::on_inputSpinBox2_valueChanged(int value)
+{
+ ui.outputWidget->setText(QString::number(value + ui.inputSpinBox1->value()));
+}
+//! [2]
diff --git a/examples/designer/calculatorform/calculatorform.h b/examples/designer/calculatorform/calculatorform.h
new file mode 100644
index 0000000..37f0a18
--- /dev/null
+++ b/examples/designer/calculatorform/calculatorform.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CALCULATORFORM_H
+#define CALCULATORFORM_H
+
+//! [0]
+#include "ui_calculatorform.h"
+//! [0]
+
+//! [1]
+class CalculatorForm : public QWidget
+{
+ Q_OBJECT
+
+public:
+ CalculatorForm(QWidget *parent = 0);
+
+private slots:
+ void on_inputSpinBox1_valueChanged(int value);
+ void on_inputSpinBox2_valueChanged(int value);
+
+private:
+ Ui::CalculatorForm ui;
+};
+//! [1]
+
+#endif
diff --git a/examples/designer/calculatorform/calculatorform.pro b/examples/designer/calculatorform/calculatorform.pro
new file mode 100644
index 0000000..73f4351
--- /dev/null
+++ b/examples/designer/calculatorform/calculatorform.pro
@@ -0,0 +1,13 @@
+#! [0]
+HEADERS = calculatorform.h
+#! [0] #! [1]
+FORMS = calculatorform.ui
+#! [1]
+SOURCES = calculatorform.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform
+INSTALLS += target sources
diff --git a/examples/designer/calculatorform/calculatorform.ui b/examples/designer/calculatorform/calculatorform.ui
new file mode 100644
index 0000000..3a95639
--- /dev/null
+++ b/examples/designer/calculatorform/calculatorform.ui
@@ -0,0 +1,284 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>CalculatorForm</class>
+ <widget class="QWidget" name="CalculatorForm" >
+ <property name="objectName" >
+ <string notr="true" >CalculatorForm</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Calculator Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="6" >
+ <spacer>
+ <property name="objectName" >
+ <string notr="true" >horizontalSpacer</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>239</x>
+ <y>9</y>
+ <width>152</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="4" >
+ <widget class="QLabel" name="label_3_2" >
+ <property name="objectName" >
+ <string notr="true" >label_3_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>169</x>
+ <y>9</y>
+ <width>20</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>=</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="5" >
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2_2_2" >
+ <property name="objectName" >
+ <string notr="true" >label_2_2_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>36</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Output</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="outputWidget" >
+ <property name="objectName" >
+ <string notr="true" >outputWidget</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>24</y>
+ <width>36</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="frameShape" >
+ <enum>QFrame::Box</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <property name="text" >
+ <string>0</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="2" >
+ <spacer>
+ <property name="objectName" >
+ <string notr="true" >verticalSpacer</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>89</x>
+ <y>67</y>
+ <width>20</width>
+ <height>224</height>
+ </rect>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="3" >
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="objectName" >
+ <string notr="true" >label_2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>46</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Input 2</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="inputSpinBox2" >
+ <property name="objectName" >
+ <string notr="true" >inputSpinBox2</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>26</y>
+ <width>46</width>
+ <height>25</height>
+ </rect>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="label_3" >
+ <property name="objectName" >
+ <string notr="true" >label_3</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>63</x>
+ <y>9</y>
+ <width>20</width>
+ <height>52</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>+</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" >
+ <property name="objectName" >
+ <string notr="true" />
+ </property>
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="objectName" >
+ <string notr="true" >label</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>1</y>
+ <width>46</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text" >
+ <string>Input 1</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="inputSpinBox1" >
+ <property name="objectName" >
+ <string notr="true" >inputSpinBox1</string>
+ </property>
+ <property name="geometry" >
+ <rect>
+ <x>1</x>
+ <y>26</y>
+ <width>46</width>
+ <height>25</height>
+ </rect>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/designer/calculatorform/main.cpp b/examples/designer/calculatorform/main.cpp
new file mode 100644
index 0000000..dcb7366
--- /dev/null
+++ b/examples/designer/calculatorform/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "calculatorform.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ CalculatorForm calculator;
+ calculator.show();
+ return app.exec();
+}
+
diff --git a/examples/designer/containerextension/containerextension.pro b/examples/designer/containerextension/containerextension.pro
new file mode 100644
index 0000000..6a2cb58
--- /dev/null
+++ b/examples/designer/containerextension/containerextension.pro
@@ -0,0 +1,26 @@
+#! [0]
+TEMPLATE = lib
+#! [0]
+TARGET = $$qtLibraryTarget($$TARGET)
+#! [1]
+CONFIG += designer plugin
+#! [1]
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
+
+#! [2]
+HEADERS += multipagewidget.h \
+ multipagewidgetplugin.h \
+ multipagewidgetcontainerextension.h \
+ multipagewidgetextensionfactory.h
+
+SOURCES += multipagewidget.cpp \
+ multipagewidgetplugin.cpp \
+ multipagewidgetcontainerextension.cpp \
+ multipagewidgetextensionfactory.cpp
+#! [2]
+
+# install
+target.path = $$[QT_INSTALL_PLUGINS]/designer
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/containerextension
+INSTALLS += target sources
diff --git a/examples/designer/containerextension/multipagewidget.cpp b/examples/designer/containerextension/multipagewidget.cpp
new file mode 100644
index 0000000..5a3697b
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidget.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "multipagewidget.h"
+
+MultiPageWidget::MultiPageWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ comboBox = new QComboBox();
+ comboBox->setObjectName("__qt__passive_comboBox");
+ stackWidget = new QStackedWidget();
+
+ connect(comboBox, SIGNAL(activated(int)),
+ this, SLOT(setCurrentIndex(int)));
+
+ layout = new QVBoxLayout();
+ layout->addWidget(comboBox);
+ layout->addWidget(stackWidget);
+ setLayout(layout);
+}
+
+QSize MultiPageWidget::sizeHint() const
+{
+ return QSize(200, 150);
+}
+
+void MultiPageWidget::addPage(QWidget *page)
+{
+ insertPage(count(), page);
+}
+
+void MultiPageWidget::removePage(int index)
+{
+ QWidget *widget = stackWidget->widget(index);
+ stackWidget->removeWidget(widget);
+
+ comboBox->removeItem(index);
+}
+
+int MultiPageWidget::count() const
+{
+ return stackWidget->count();
+}
+
+int MultiPageWidget::currentIndex() const
+{
+ return stackWidget->currentIndex();
+}
+
+void MultiPageWidget::insertPage(int index, QWidget *page)
+{
+ page->setParent(stackWidget);
+
+ stackWidget->insertWidget(index, page);
+
+ QString title = page->windowTitle();
+ if (title.isEmpty()) {
+ title = tr("Page %1").arg(comboBox->count() + 1);
+ page->setWindowTitle(title);
+ }
+ comboBox->insertItem(index, title);
+}
+
+void MultiPageWidget::setCurrentIndex(int index)
+{
+ if (index != currentIndex()) {
+ stackWidget->setCurrentIndex(index);
+ comboBox->setCurrentIndex(index);
+ emit currentIndexChanged(index);
+ }
+}
+
+QWidget* MultiPageWidget::widget(int index)
+{
+ return stackWidget->widget(index);
+}
+
+QString MultiPageWidget::pageTitle() const
+{
+ if (const QWidget *currentWidget = stackWidget->currentWidget())
+ return currentWidget->windowTitle();
+ return QString();
+}
+
+void MultiPageWidget::setPageTitle(QString const &newTitle)
+{
+ comboBox->setItemText(currentIndex(), newTitle);
+ if (QWidget *currentWidget = stackWidget->currentWidget())
+ currentWidget->setWindowTitle(newTitle);
+ emit pageTitleChanged(newTitle);
+}
diff --git a/examples/designer/containerextension/multipagewidget.h b/examples/designer/containerextension/multipagewidget.h
new file mode 100644
index 0000000..77a09c5
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidget.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MULTIPAGEWIDGET_H
+#define MULTIPAGEWIDGET_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QStackedWidget;
+class QVBoxLayout;
+QT_END_NAMESPACE
+
+//! [0]
+class MultiPageWidget : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex)
+ Q_PROPERTY(QString pageTitle READ pageTitle WRITE setPageTitle STORED false)
+
+public:
+ MultiPageWidget(QWidget *parent = 0);
+
+ QSize sizeHint() const;
+
+ int count() const;
+ int currentIndex() const;
+ QWidget *widget(int index);
+ QString pageTitle() const;
+
+public slots:
+ void addPage(QWidget *page);
+ void insertPage(int index, QWidget *page);
+ void removePage(int index);
+ void setPageTitle(QString const &newTitle);
+ void setCurrentIndex(int index);
+
+signals:
+ void currentIndexChanged(int index);
+ void pageTitleChanged(const QString &title);
+
+private:
+ QStackedWidget *stackWidget;
+ QComboBox *comboBox;
+ QVBoxLayout *layout;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/containerextension/multipagewidgetcontainerextension.cpp b/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
new file mode 100644
index 0000000..b61da3d
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidgetcontainerextension.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "multipagewidgetcontainerextension.h"
+#include "multipagewidget.h"
+
+//! [0]
+MultiPageWidgetContainerExtension::MultiPageWidgetContainerExtension(MultiPageWidget *widget,
+ QObject *parent)
+ :QObject(parent)
+{
+ myWidget = widget;
+}
+//! [0]
+
+//! [1]
+void MultiPageWidgetContainerExtension::addWidget(QWidget *widget)
+{
+ myWidget->addPage(widget);
+}
+//! [1]
+
+//! [2]
+int MultiPageWidgetContainerExtension::count() const
+{
+ return myWidget->count();
+}
+//! [2]
+
+//! [3]
+int MultiPageWidgetContainerExtension::currentIndex() const
+{
+ return myWidget->currentIndex();
+}
+//! [3]
+
+//! [4]
+void MultiPageWidgetContainerExtension::insertWidget(int index, QWidget *widget)
+{
+ myWidget->insertPage(index, widget);
+}
+//! [4]
+
+//! [5]
+void MultiPageWidgetContainerExtension::remove(int index)
+{
+ myWidget->removePage(index);
+}
+//! [5]
+
+//! [6]
+void MultiPageWidgetContainerExtension::setCurrentIndex(int index)
+{
+ myWidget->setCurrentIndex(index);
+}
+//! [6]
+
+//! [7]
+QWidget* MultiPageWidgetContainerExtension::widget(int index) const
+{
+ return myWidget->widget(index);
+}
+//! [7]
diff --git a/examples/designer/containerextension/multipagewidgetcontainerextension.h b/examples/designer/containerextension/multipagewidgetcontainerextension.h
new file mode 100644
index 0000000..661146e
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidgetcontainerextension.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MULTIPAGEWIDGETCONTAINEREXTENSION_H
+#define MULTIPAGEWIDGETCONTAINEREXTENSION_H
+
+#include <QtDesigner/QDesignerContainerExtension>
+
+QT_BEGIN_NAMESPACE
+class QExtensionManager;
+QT_END_NAMESPACE
+class MultiPageWidget;
+
+//! [0]
+class MultiPageWidgetContainerExtension: public QObject,
+ public QDesignerContainerExtension
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerContainerExtension)
+
+public:
+ MultiPageWidgetContainerExtension(MultiPageWidget *widget, QObject *parent);
+
+ void addWidget(QWidget *widget);
+ int count() const;
+ int currentIndex() const;
+ void insertWidget(int index, QWidget *widget);
+ void remove(int index);
+ void setCurrentIndex(int index);
+ QWidget *widget(int index) const;
+
+private:
+ MultiPageWidget *myWidget;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/containerextension/multipagewidgetextensionfactory.cpp b/examples/designer/containerextension/multipagewidgetextensionfactory.cpp
new file mode 100644
index 0000000..4a1e81b
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidgetextensionfactory.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "multipagewidgetextensionfactory.h"
+#include "multipagewidgetcontainerextension.h"
+#include "multipagewidget.h"
+
+//! [0]
+MultiPageWidgetExtensionFactory::MultiPageWidgetExtensionFactory(QExtensionManager *parent)
+ : QExtensionFactory(parent)
+{}
+//! [0]
+
+//! [1]
+QObject *MultiPageWidgetExtensionFactory::createExtension(QObject *object,
+ const QString &iid,
+ QObject *parent) const
+{
+ MultiPageWidget *widget = qobject_cast<MultiPageWidget*>(object);
+
+ if (widget && (iid == Q_TYPEID(QDesignerContainerExtension))) {
+ return new MultiPageWidgetContainerExtension(widget, parent);
+ } else {
+ return 0;
+ }
+}
+//! [1]
diff --git a/examples/designer/containerextension/multipagewidgetextensionfactory.h b/examples/designer/containerextension/multipagewidgetextensionfactory.h
new file mode 100644
index 0000000..9a96b37
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidgetextensionfactory.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MULTIPAGEWIDGETEXTENSIONFACTORY_H
+#define MULTIPAGEWIDGETEXTENSIONFACTORY_H
+
+#include <QtDesigner/QExtensionFactory>
+
+QT_BEGIN_NAMESPACE
+class QExtensionManager;
+QT_END_NAMESPACE
+
+//! [0]
+class MultiPageWidgetExtensionFactory: public QExtensionFactory
+{
+ Q_OBJECT
+
+public:
+ MultiPageWidgetExtensionFactory(QExtensionManager *parent = 0);
+
+protected:
+ QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/containerextension/multipagewidgetplugin.cpp b/examples/designer/containerextension/multipagewidgetplugin.cpp
new file mode 100644
index 0000000..c09ed3a
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidgetplugin.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtDesigner/QExtensionFactory>
+#include <QtDesigner/QExtensionManager>
+#include <QtDesigner/QDesignerFormEditorInterface>
+#include <QtDesigner/QDesignerFormWindowInterface>
+#include <QtDesigner/QDesignerContainerExtension>
+#include <QtDesigner/QDesignerPropertySheetExtension>
+
+#include <QIcon>
+#include <QtPlugin>
+
+#include "multipagewidget.h"
+#include "multipagewidgetplugin.h"
+#include "multipagewidgetextensionfactory.h"
+
+//! [0]
+MultiPageWidgetPlugin::MultiPageWidgetPlugin(QObject *parent)
+ :QObject(parent)
+{
+ initialized = false;
+}
+
+QString MultiPageWidgetPlugin::name() const
+{
+ return QLatin1String("MultiPageWidget");
+}
+
+QString MultiPageWidgetPlugin::group() const
+{
+ return QLatin1String("Display Widgets [Examples]");
+}
+
+QString MultiPageWidgetPlugin::toolTip() const
+{
+ return QString();
+}
+
+QString MultiPageWidgetPlugin::whatsThis() const
+{
+ return QString();
+}
+
+QString MultiPageWidgetPlugin::includeFile() const
+{
+ return QLatin1String("multipagewidget.h");
+}
+
+QIcon MultiPageWidgetPlugin::icon() const
+{
+ return QIcon();
+}
+
+//! [0] //! [1]
+bool MultiPageWidgetPlugin::isContainer() const
+{
+ return true;
+}
+
+//! [1] //! [2]
+QWidget *MultiPageWidgetPlugin::createWidget(QWidget *parent)
+{
+ MultiPageWidget *widget = new MultiPageWidget(parent);
+ connect(widget, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(currentIndexChanged(int)));
+ connect(widget, SIGNAL(pageTitleChanged(const QString &)),
+ this, SLOT(pageTitleChanged(const QString &)));
+ return widget;
+}
+
+//! [2] //! [3]
+bool MultiPageWidgetPlugin::isInitialized() const
+{
+ return initialized;
+}
+//! [3]
+
+//! [4]
+void MultiPageWidgetPlugin::initialize(QDesignerFormEditorInterface *formEditor)
+{
+ if (initialized)
+ return;
+//! [4]
+
+//! [5]
+ QExtensionManager *manager = formEditor->extensionManager();
+//! [5] //! [6]
+ QExtensionFactory *factory = new MultiPageWidgetExtensionFactory(manager);
+
+ Q_ASSERT(manager != 0);
+ manager->registerExtensions(factory, Q_TYPEID(QDesignerContainerExtension));
+
+ initialized = true;
+}
+//! [6]
+
+//! [7]
+QString MultiPageWidgetPlugin::domXml() const
+{
+ return QLatin1String("\
+<ui language=\"c++\">\
+ <widget class=\"MultiPageWidget\" name=\"multipagewidget\">\
+ <widget class=\"QWidget\" name=\"page\" />\
+ </widget>\
+ <customwidgets>\
+ <customwidget>\
+ <class>MultiPageWidget</class>\
+ <extends>QWidget</extends>\
+ <addpagemethod>addPage</addpagemethod>\
+ </customwidget>\
+ </customwidgets>\
+</ui>");
+}
+//! [7]
+
+//! [8]
+void MultiPageWidgetPlugin::currentIndexChanged(int index)
+{
+ Q_UNUSED(index);
+ MultiPageWidget *widget = qobject_cast<MultiPageWidget*>(sender());
+//! [8] //! [9]
+ if (widget) {
+ QDesignerFormWindowInterface *form = QDesignerFormWindowInterface::findFormWindow(widget);
+ if (form)
+ form->emitSelectionChanged();
+ }
+}
+//! [9]
+
+//! [10]
+void MultiPageWidgetPlugin::pageTitleChanged(const QString &title)
+{
+ Q_UNUSED(title);
+ MultiPageWidget *widget = qobject_cast<MultiPageWidget*>(sender());
+//! [10] //! [11]
+ if (widget) {
+ QWidget *page = widget->widget(widget->currentIndex());
+ QDesignerFormWindowInterface *form;
+ form = QDesignerFormWindowInterface::findFormWindow(widget);
+//! [11]
+ if (form) {
+//! [12]
+ QDesignerFormEditorInterface *editor = form->core();
+ QExtensionManager *manager = editor->extensionManager();
+//! [12] //! [13]
+ QDesignerPropertySheetExtension *sheet;
+ sheet = qt_extension<QDesignerPropertySheetExtension*>(manager, page);
+ const int propertyIndex = sheet->indexOf(QLatin1String("windowTitle"));
+ sheet->setChanged(propertyIndex, true);
+ }
+ }
+}
+
+//! [13]
+
+//! [14]
+Q_EXPORT_PLUGIN2(containerextension, MultiPageWidgetPlugin)
+//! [14]
diff --git a/examples/designer/containerextension/multipagewidgetplugin.h b/examples/designer/containerextension/multipagewidgetplugin.h
new file mode 100644
index 0000000..1431c8a
--- /dev/null
+++ b/examples/designer/containerextension/multipagewidgetplugin.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#ifndef MULTIPAGEWIDGETPLUGIN_H
+#define MULTIPAGEWIDGETPLUGIN_H
+
+#include <QtDesigner/QDesignerCustomWidgetInterface>
+
+QT_BEGIN_NAMESPACE
+class QIcon;
+class QWidget;
+QT_END_NAMESPACE
+
+class MultiPageWidgetPlugin: public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+public:
+ MultiPageWidgetPlugin(QObject *parent = 0);
+
+ QString name() const;
+ QString group() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ QString includeFile() const;
+ QIcon icon() const;
+ bool isContainer() const;
+ QWidget *createWidget(QWidget *parent);
+ bool isInitialized() const;
+ void initialize(QDesignerFormEditorInterface *formEditor);
+ QString domXml() const;
+
+private slots:
+ void currentIndexChanged(int index);
+ void pageTitleChanged(const QString &title);
+
+private:
+ bool initialized;
+};
+
+#endif
+//! [0]
diff --git a/examples/designer/customwidgetplugin/analogclock.cpp b/examples/designer/customwidgetplugin/analogclock.cpp
new file mode 100644
index 0000000..28155ba
--- /dev/null
+++ b/examples/designer/customwidgetplugin/analogclock.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "analogclock.h"
+
+AnalogClock::AnalogClock(QWidget *parent)
+ : QWidget(parent)
+{
+ QTimer *timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(update()));
+ timer->start(1000);
+
+ setWindowTitle(tr("Analog Clock"));
+ resize(200, 200);
+}
+
+void AnalogClock::paintEvent(QPaintEvent *)
+{
+ static const QPoint hourHand[3] = {
+ QPoint(7, 8),
+ QPoint(-7, 8),
+ QPoint(0, -40)
+ };
+ static const QPoint minuteHand[3] = {
+ QPoint(7, 8),
+ QPoint(-7, 8),
+ QPoint(0, -70)
+ };
+
+ QColor hourColor(127, 0, 127);
+ QColor minuteColor(0, 127, 127, 191);
+
+ int side = qMin(width(), height());
+ QTime time = QTime::currentTime();
+
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.translate(width() / 2, height() / 2);
+ painter.scale(side / 200.0, side / 200.0);
+
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(hourColor);
+
+ painter.save();
+ painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
+ painter.drawConvexPolygon(hourHand, 3);
+ painter.restore();
+
+ painter.setPen(hourColor);
+
+ for (int i = 0; i < 12; ++i) {
+ painter.drawLine(88, 0, 96, 0);
+ painter.rotate(30.0);
+ }
+
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(minuteColor);
+
+ painter.save();
+ painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
+ painter.drawConvexPolygon(minuteHand, 3);
+ painter.restore();
+
+ painter.setPen(minuteColor);
+
+ for (int j = 0; j < 60; ++j) {
+ if ((j % 5) != 0)
+ painter.drawLine(92, 0, 96, 0);
+ painter.rotate(6.0);
+ }
+}
diff --git a/examples/designer/customwidgetplugin/analogclock.h b/examples/designer/customwidgetplugin/analogclock.h
new file mode 100644
index 0000000..4d843ad
--- /dev/null
+++ b/examples/designer/customwidgetplugin/analogclock.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ANALOGCLOCK_H
+#define ANALOGCLOCK_H
+
+#include <QWidget>
+#include <QtDesigner/QDesignerExportWidget>
+
+class QDESIGNER_WIDGET_EXPORT AnalogClock : public QWidget
+{
+ Q_OBJECT
+
+public:
+ AnalogClock(QWidget *parent = 0);
+
+protected:
+ void paintEvent(QPaintEvent *event);
+};
+
+#endif
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.cpp b/examples/designer/customwidgetplugin/customwidgetplugin.cpp
new file mode 100644
index 0000000..bcea3b8
--- /dev/null
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "analogclock.h"
+#include "customwidgetplugin.h"
+
+#include <QtPlugin>
+
+//! [0]
+AnalogClockPlugin::AnalogClockPlugin(QObject *parent)
+ : QObject(parent)
+{
+ initialized = false;
+}
+//! [0]
+
+//! [1]
+void AnalogClockPlugin::initialize(QDesignerFormEditorInterface * /* core */)
+{
+ if (initialized)
+ return;
+
+ initialized = true;
+}
+//! [1]
+
+//! [2]
+bool AnalogClockPlugin::isInitialized() const
+{
+ return initialized;
+}
+//! [2]
+
+//! [3]
+QWidget *AnalogClockPlugin::createWidget(QWidget *parent)
+{
+ return new AnalogClock(parent);
+}
+//! [3]
+
+//! [4]
+QString AnalogClockPlugin::name() const
+{
+ return "AnalogClock";
+}
+//! [4]
+
+//! [5]
+QString AnalogClockPlugin::group() const
+{
+ return "Display Widgets [Examples]";
+}
+//! [5]
+
+//! [6]
+QIcon AnalogClockPlugin::icon() const
+{
+ return QIcon();
+}
+//! [6]
+
+//! [7]
+QString AnalogClockPlugin::toolTip() const
+{
+ return "";
+}
+//! [7]
+
+//! [8]
+QString AnalogClockPlugin::whatsThis() const
+{
+ return "";
+}
+//! [8]
+
+//! [9]
+bool AnalogClockPlugin::isContainer() const
+{
+ return false;
+}
+//! [9]
+
+//! [10]
+QString AnalogClockPlugin::domXml() const
+{
+ return "<ui language=\"c++\">\n"
+ " <widget class=\"AnalogClock\" name=\"analogClock\">\n"
+//! [11]
+ " <property name=\"geometry\">\n"
+ " <rect>\n"
+ " <x>0</x>\n"
+ " <y>0</y>\n"
+ " <width>100</width>\n"
+ " <height>100</height>\n"
+ " </rect>\n"
+ " </property>\n"
+//! [11]
+ " <property name=\"toolTip\" >\n"
+ " <string>The current time</string>\n"
+ " </property>\n"
+ " <property name=\"whatsThis\" >\n"
+ " <string>The analog clock widget displays the current time.</string>\n"
+ " </property>\n"
+ " </widget>\n"
+ "</ui>\n";
+}
+//! [10]
+
+//! [12]
+QString AnalogClockPlugin::includeFile() const
+{
+ return "analogclock.h";
+}
+//! [12]
+
+//! [13]
+Q_EXPORT_PLUGIN2(customwidgetplugin, AnalogClockPlugin)
+//! [13]
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.h b/examples/designer/customwidgetplugin/customwidgetplugin.h
new file mode 100644
index 0000000..4438690
--- /dev/null
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMWIDGETPLUGIN_H
+#define CUSTOMWIDGETPLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+//! [0]
+class AnalogClockPlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ AnalogClockPlugin(QObject *parent = 0);
+
+ bool isContainer() const;
+ bool isInitialized() const;
+ QIcon icon() const;
+ QString domXml() const;
+ QString group() const;
+ QString includeFile() const;
+ QString name() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ QWidget *createWidget(QWidget *parent);
+ void initialize(QDesignerFormEditorInterface *core);
+
+private:
+ bool initialized;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/customwidgetplugin/customwidgetplugin.pro b/examples/designer/customwidgetplugin/customwidgetplugin.pro
new file mode 100644
index 0000000..4feee59
--- /dev/null
+++ b/examples/designer/customwidgetplugin/customwidgetplugin.pro
@@ -0,0 +1,21 @@
+#! [0] #! [1]
+CONFIG += designer plugin
+#! [0]
+TARGET = $$qtLibraryTarget($$TARGET)
+#! [2]
+TEMPLATE = lib
+#! [1] #! [2]
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
+
+#! [3]
+HEADERS = analogclock.h \
+ customwidgetplugin.h
+SOURCES = analogclock.cpp \
+ customwidgetplugin.cpp
+#! [3]
+
+# install
+target.path = $$[QT_INSTALL_PLUGINS]/designer
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/customwidgetplugin
+INSTALLS += target sources
diff --git a/examples/designer/designer.pro b/examples/designer/designer.pro
new file mode 100644
index 0000000..0f30421
--- /dev/null
+++ b/examples/designer/designer.pro
@@ -0,0 +1,19 @@
+TEMPLATE = subdirs
+SUBDIRS = calculatorform
+
+!static:SUBDIRS += calculatorbuilder \
+ containerextension \
+ customwidgetplugin \
+ taskmenuextension \
+ worldtimeclockbuilder \
+ worldtimeclockplugin
+
+# the sun cc compiler has a problem with the include lines for the form.prf
+solaris-cc*:SUBDIRS -= calculatorbuilder \
+ worldtimeclockbuilder
+
+
+# install
+sources.files = README *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer
+INSTALLS += sources
diff --git a/examples/designer/taskmenuextension/taskmenuextension.pro b/examples/designer/taskmenuextension/taskmenuextension.pro
new file mode 100644
index 0000000..83dd878
--- /dev/null
+++ b/examples/designer/taskmenuextension/taskmenuextension.pro
@@ -0,0 +1,25 @@
+#! [0]
+TEMPLATE = lib
+#! [0]
+TARGET = $$qtLibraryTarget($$TARGET)
+#! [1]
+CONFIG += designer plugin
+#! [1]
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
+
+#! [2]
+HEADERS += tictactoe.h \
+ tictactoedialog.h \
+ tictactoeplugin.h \
+ tictactoetaskmenu.h
+SOURCES += tictactoe.cpp \
+ tictactoedialog.cpp \
+ tictactoeplugin.cpp \
+ tictactoetaskmenu.cpp
+#! [2]
+
+# install
+target.path = $$[QT_INSTALL_PLUGINS]/designer
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/taskmenuextension
+INSTALLS += target sources
diff --git a/examples/designer/taskmenuextension/tictactoe.cpp b/examples/designer/taskmenuextension/tictactoe.cpp
new file mode 100644
index 0000000..ba766ccd
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoe.cpp
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "tictactoe.h"
+
+TicTacToe::TicTacToe(QWidget *parent)
+ : QWidget(parent)
+{
+}
+
+QSize TicTacToe::minimumSizeHint() const
+{
+ return QSize(200, 200);
+}
+
+QSize TicTacToe::sizeHint() const
+{
+ return QSize(200, 200);
+}
+
+void TicTacToe::setState(const QString &newState)
+{
+ turnNumber = 0;
+ myState = "---------";
+ int position = 0;
+ while (position < 9 && position < newState.length()) {
+ QChar mark = newState.at(position);
+ if (mark == Cross || mark == Nought) {
+ ++turnNumber;
+ myState.replace(position, 1, mark);
+ }
+ position++;
+ }
+ update();
+}
+
+QString TicTacToe::state() const
+{
+ return myState;
+}
+
+void TicTacToe::clearBoard()
+{
+ myState = "---------";
+ turnNumber = 0;
+ update();
+}
+
+void TicTacToe::mousePressEvent(QMouseEvent *event)
+{
+ if (turnNumber == 9) {
+ clearBoard();
+ update();
+ } else {
+ for (int position = 0; position < 9; ++position) {
+ QRect cell = cellRect(position / 3, position % 3);
+ if (cell.contains(event->pos())) {
+ if (myState.at(position) == Empty) {
+ if (turnNumber % 2 == 0)
+ myState.replace(position, 1, Cross);
+ else
+ myState.replace(position, 1, Nought);
+ ++turnNumber;
+ update();
+ }
+ }
+ }
+ }
+}
+
+void TicTacToe::paintEvent(QPaintEvent * /* event */)
+{
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+
+ painter.setPen(QPen(Qt::darkGreen, 1));
+ painter.drawLine(cellWidth(), 0, cellWidth(), height());
+ painter.drawLine(2 * cellWidth(), 0, 2 * cellWidth(), height());
+ painter.drawLine(0, cellHeight(), width(), cellHeight());
+ painter.drawLine(0, 2 * cellHeight(), width(), 2 * cellHeight());
+
+ painter.setPen(QPen(Qt::darkBlue, 2));
+
+ for (int position = 0; position < 9; ++position) {
+ QRect cell = cellRect(position / 3, position % 3);
+
+ if (myState.at(position) == Cross) {
+ painter.drawLine(cell.topLeft(), cell.bottomRight());
+ painter.drawLine(cell.topRight(), cell.bottomLeft());
+ } else if (myState.at(position) == Nought) {
+ painter.drawEllipse(cell);
+ }
+ }
+
+ painter.setPen(QPen(Qt::yellow, 3));
+
+ for (int position = 0; position < 9; position = position + 3) {
+ if (myState.at(position) != Empty
+ && myState.at(position + 1) == myState.at(position)
+ && myState.at(position + 2) == myState.at(position)) {
+ int y = cellRect((position / 3), 0).center().y();
+ painter.drawLine(0, y, width(), y);
+ turnNumber = 9;
+ }
+ }
+
+ for (int position = 0; position < 3; ++position) {
+ if (myState.at(position) != Empty
+ && myState.at(position + 3) == myState.at(position)
+ && myState.at(position + 6) == myState.at(position)) {
+ int x = cellRect(0, position).center().x();
+ painter.drawLine(x, 0, x, height());
+ turnNumber = 9;
+ }
+ }
+ if (myState.at(0) != Empty && myState.at(4) == myState.at(0)
+ && myState.at(8) == myState.at(0)) {
+ painter.drawLine(0, 0, width(), height());
+ turnNumber = 9;
+ }
+ if (myState.at(2) != Empty && myState.at(4) == myState.at(2)
+ && myState.at(6) == myState.at(2)) {
+ painter.drawLine(0, height(), width(), 0);
+ turnNumber = 9;
+ }
+}
+
+QRect TicTacToe::cellRect(int row, int column) const
+{
+ const int HMargin = width() / 30;
+ const int VMargin = height() / 30;
+ return QRect(column * cellWidth() + HMargin,
+ row * cellHeight() + VMargin,
+ cellWidth() - 2 * HMargin,
+ cellHeight() - 2 * VMargin);
+}
diff --git a/examples/designer/taskmenuextension/tictactoe.h b/examples/designer/taskmenuextension/tictactoe.h
new file mode 100644
index 0000000..ef3c533
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoe.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TICTACTOE_H
+#define TICTACTOE_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QRect;
+class QSize;
+QT_END_NAMESPACE
+
+//! [0]
+class TicTacToe : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(QString state READ state WRITE setState)
+
+public:
+ TicTacToe(QWidget *parent = 0);
+
+ QSize minimumSizeHint() const;
+ QSize sizeHint() const;
+ void setState(const QString &newState);
+ QString state() const;
+ void clearBoard();
+
+protected:
+ void mousePressEvent(QMouseEvent *event);
+ void paintEvent(QPaintEvent *event);
+
+private:
+ enum { Empty = '-', Cross = 'X', Nought = 'O' };
+
+ QRect cellRect(int row, int col) const;
+ int cellWidth() const { return width() / 3; }
+ int cellHeight() const { return height() / 3; }
+
+ QString myState;
+ int turnNumber;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/taskmenuextension/tictactoedialog.cpp b/examples/designer/taskmenuextension/tictactoedialog.cpp
new file mode 100644
index 0000000..a9bd16a
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoedialog.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtDesigner>
+
+#include "tictactoe.h"
+#include "tictactoedialog.h"
+
+//! [0]
+TicTacToeDialog::TicTacToeDialog(TicTacToe *tic, QWidget *parent)
+ : QDialog(parent)
+{
+ ticTacToe = tic;
+ editor = new TicTacToe;
+ editor->setState(ticTacToe->state());
+
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
+ | QDialogButtonBox::Cancel
+ | QDialogButtonBox::Reset);
+
+ connect(buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
+ this, SLOT(resetState()));
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(saveState()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(editor);
+ mainLayout->addWidget(buttonBox);
+
+ setLayout(mainLayout);
+ setWindowTitle(tr("Edit State"));
+}
+//! [0]
+
+//! [1]
+QSize TicTacToeDialog::sizeHint() const
+{
+ return QSize(250, 250);
+}
+//! [1]
+
+//! [2]
+void TicTacToeDialog::resetState()
+{
+ editor->clearBoard();
+}
+//! [2]
+
+//! [3]
+void TicTacToeDialog::saveState()
+{
+//! [3] //! [4]
+ if (QDesignerFormWindowInterface *formWindow
+ = QDesignerFormWindowInterface::findFormWindow(ticTacToe)) {
+ formWindow->cursor()->setProperty("state", editor->state());
+ }
+//! [4] //! [5]
+ accept();
+}
+//! [5]
diff --git a/examples/designer/taskmenuextension/tictactoedialog.h b/examples/designer/taskmenuextension/tictactoedialog.h
new file mode 100644
index 0000000..55b25d2
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoedialog.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TICTACTOEDIALOG_H
+#define TICTACTOEDIALOG_H
+
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QDialogButtonBox;
+QT_END_NAMESPACE
+class TicTacToe;
+
+//! [0]
+class TicTacToeDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0);
+
+ QSize sizeHint() const;
+
+private slots:
+ void resetState();
+ void saveState();
+
+private:
+ TicTacToe *editor;
+ TicTacToe *ticTacToe;
+ QDialogButtonBox *buttonBox;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/taskmenuextension/tictactoeplugin.cpp b/examples/designer/taskmenuextension/tictactoeplugin.cpp
new file mode 100644
index 0000000..1333090
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoeplugin.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtDesigner>
+#include <QtGui>
+#include <QtPlugin>
+
+#include "tictactoe.h"
+#include "tictactoeplugin.h"
+#include "tictactoetaskmenu.h"
+
+//! [0]
+TicTacToePlugin::TicTacToePlugin(QObject *parent)
+ : QObject(parent)
+{
+ initialized = false;
+}
+
+QString TicTacToePlugin::name() const
+{
+ return "TicTacToe";
+}
+
+QString TicTacToePlugin::group() const
+{
+ return "Display Widgets [Examples]";
+}
+
+QString TicTacToePlugin::toolTip() const
+{
+ return "";
+}
+
+QString TicTacToePlugin::whatsThis() const
+{
+ return "";
+}
+
+QString TicTacToePlugin::includeFile() const
+{
+ return "tictactoe.h";
+}
+
+QIcon TicTacToePlugin::icon() const
+{
+ return QIcon();
+}
+
+bool TicTacToePlugin::isContainer() const
+{
+ return false;
+}
+
+QWidget *TicTacToePlugin::createWidget(QWidget *parent)
+{
+ TicTacToe *ticTacToe = new TicTacToe(parent);
+ ticTacToe->setState("-X-XO----");
+ return ticTacToe;
+}
+
+bool TicTacToePlugin::isInitialized() const
+{
+ return initialized;
+}
+
+//! [0] //! [1]
+void TicTacToePlugin::initialize(QDesignerFormEditorInterface *formEditor)
+{
+//! [1] //! [2]
+ if (initialized)
+ return;
+
+ QExtensionManager *manager = formEditor->extensionManager();
+ Q_ASSERT(manager != 0);
+//! [2]
+
+//! [3]
+ manager->registerExtensions(new TicTacToeTaskMenuFactory(manager),
+ Q_TYPEID(QDesignerTaskMenuExtension));
+
+ initialized = true;
+}
+
+QString TicTacToePlugin::domXml() const
+{
+ return QLatin1String("\
+<ui language=\"c++\">\
+ <widget class=\"TicTacToe\" name=\"ticTacToe\"/>\
+</ui>");
+}
+
+//! [3]
+
+//! [4]
+Q_EXPORT_PLUGIN2(taskmenuextension, TicTacToePlugin)
+//! [4]
diff --git a/examples/designer/taskmenuextension/tictactoeplugin.h b/examples/designer/taskmenuextension/tictactoeplugin.h
new file mode 100644
index 0000000..b51540e
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoeplugin.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#ifndef TICTACTOEPLUGIN_H
+#define TICTACTOEPLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+QT_BEGIN_NAMESPACE
+class QIcon;
+class QWidget;
+QT_END_NAMESPACE
+
+class TicTacToePlugin : public QObject, public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ TicTacToePlugin(QObject *parent = 0);
+
+ QString name() const;
+ QString group() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ QString includeFile() const;
+ QIcon icon() const;
+ bool isContainer() const;
+ QWidget *createWidget(QWidget *parent);
+ bool isInitialized() const;
+ void initialize(QDesignerFormEditorInterface *formEditor);
+ QString domXml() const;
+
+private:
+ bool initialized;
+};
+
+#endif
+//! [0]
diff --git a/examples/designer/taskmenuextension/tictactoetaskmenu.cpp b/examples/designer/taskmenuextension/tictactoetaskmenu.cpp
new file mode 100644
index 0000000..af5401a
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoetaskmenu.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtDesigner>
+#include <QtGui>
+
+#include "tictactoe.h"
+#include "tictactoedialog.h"
+#include "tictactoetaskmenu.h"
+
+//! [0]
+TicTacToeTaskMenu::TicTacToeTaskMenu(TicTacToe *tic, QObject *parent)
+ : QObject(parent)
+{
+ ticTacToe = tic;
+
+ editStateAction = new QAction(tr("Edit State..."), this);
+ connect(editStateAction, SIGNAL(triggered()), this, SLOT(editState()));
+}
+//! [0]
+
+//! [1]
+void TicTacToeTaskMenu::editState()
+{
+ TicTacToeDialog dialog(ticTacToe);
+ dialog.exec();
+}
+//! [1]
+
+//! [2]
+QAction *TicTacToeTaskMenu::preferredEditAction() const
+{
+ return editStateAction;
+}
+//! [2]
+
+//! [3]
+QList<QAction *> TicTacToeTaskMenu::taskActions() const
+{
+ QList<QAction *> list;
+ list.append(editStateAction);
+ return list;
+}
+//! [3]
+
+//! [4]
+TicTacToeTaskMenuFactory::TicTacToeTaskMenuFactory(QExtensionManager *parent)
+ : QExtensionFactory(parent)
+{
+}
+//! [4]
+
+//! [5]
+QObject *TicTacToeTaskMenuFactory::createExtension(QObject *object,
+ const QString &iid,
+ QObject *parent) const
+{
+ if (iid != Q_TYPEID(QDesignerTaskMenuExtension))
+ return 0;
+
+ if (TicTacToe *tic = qobject_cast<TicTacToe*>(object))
+ return new TicTacToeTaskMenu(tic, parent);
+
+ return 0;
+}
+//! [5]
diff --git a/examples/designer/taskmenuextension/tictactoetaskmenu.h b/examples/designer/taskmenuextension/tictactoetaskmenu.h
new file mode 100644
index 0000000..4bd3170
--- /dev/null
+++ b/examples/designer/taskmenuextension/tictactoetaskmenu.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TICTACTOETASKMENU_H
+#define TICTACTOETASKMENU_H
+
+#include <QDesignerTaskMenuExtension>
+#include <QExtensionFactory>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QExtensionManager;
+QT_END_NAMESPACE
+class TicTacToe;
+
+//! [0]
+class TicTacToeTaskMenu : public QObject, public QDesignerTaskMenuExtension
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerTaskMenuExtension)
+
+public:
+ TicTacToeTaskMenu(TicTacToe *tic, QObject *parent);
+
+ QAction *preferredEditAction() const;
+ QList<QAction *> taskActions() const;
+
+private slots:
+ void editState();
+
+private:
+ QAction *editStateAction;
+ TicTacToe *ticTacToe;
+};
+//! [0]
+
+//! [1]
+class TicTacToeTaskMenuFactory : public QExtensionFactory
+{
+ Q_OBJECT
+
+public:
+ TicTacToeTaskMenuFactory(QExtensionManager *parent = 0);
+
+protected:
+ QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const;
+};
+//! [1]
+
+#endif
diff --git a/examples/designer/worldtimeclockbuilder/form.ui b/examples/designer/worldtimeclockbuilder/form.ui
new file mode 100644
index 0000000..e5be1d9
--- /dev/null
+++ b/examples/designer/worldtimeclockbuilder/form.ui
@@ -0,0 +1,162 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>WorldTimeForm</class>
+ <widget class="QWidget" name="WorldTimeForm" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>World Time Clock</string>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="WorldTimeClock" name="worldTimeClock" />
+ </item>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Current time:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTimeEdit" name="timeEdit" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>1</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Set time zone:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox" >
+ <property name="maximum" >
+ <number>12</number>
+ </property>
+ <property name="minimum" >
+ <number>-12</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <customwidgets>
+ <customwidget>
+ <class>WorldTimeClock</class>
+ <extends></extends>
+ <header>worldtimeclock.h</header>
+ <container>0</container>
+ <pixmap></pixmap>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>spinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>worldTimeClock</receiver>
+ <slot>setTimeZone(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>339</x>
+ <y>166</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>230</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>worldTimeClock</sender>
+ <signal>updated(QTime)</signal>
+ <receiver>timeEdit</receiver>
+ <slot>setTime(QTime)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>141</x>
+ <y>59</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>291</x>
+ <y>133</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/designer/worldtimeclockbuilder/main.cpp b/examples/designer/worldtimeclockbuilder/main.cpp
new file mode 100644
index 0000000..35f7dc0
--- /dev/null
+++ b/examples/designer/worldtimeclockbuilder/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [0]
+#include <QtUiTools>
+//! [0]
+#include <QtGui>
+
+//! [1]
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(worldtimeclockbuilder);
+
+ QApplication app(argc, argv);
+
+ QUiLoader loader;
+//! [1]
+
+//! [2]
+ QFile file(":/forms/form.ui");
+ file.open(QFile::ReadOnly);
+
+ QWidget *widget = loader.load(&file);
+
+ file.close();
+ widget->show();
+//! [2]
+
+//! [3]
+ return app.exec();
+}
+//! [3]
diff --git a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro
new file mode 100644
index 0000000..2690921
--- /dev/null
+++ b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.pro
@@ -0,0 +1,11 @@
+#! [0]
+CONFIG += uitools
+SOURCES = main.cpp
+RESOURCES = worldtimeclockbuilder.qrc
+#! [0]
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/designer/worldtimeclockbuilder
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.ui *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/worldtimeclockbuilder
+INSTALLS += target sources
diff --git a/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc
new file mode 100644
index 0000000..89d5ac3
--- /dev/null
+++ b/examples/designer/worldtimeclockbuilder/worldtimeclockbuilder.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/forms">
+ <file>form.ui</file>
+</qresource>
+</RCC>
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclock.cpp b/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
new file mode 100644
index 0000000..77eff54
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "worldtimeclock.h"
+
+WorldTimeClock::WorldTimeClock(QWidget *parent)
+ : QWidget(parent)
+{
+ timeZoneOffset = 0;
+
+ QTimer *timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(update()));
+ timer->start(1000);
+
+ setWindowTitle(tr("World Time Clock"));
+ resize(200, 200);
+}
+
+void WorldTimeClock::paintEvent(QPaintEvent *)
+{
+ static const QPoint hourHand[3] = {
+ QPoint(7, 8),
+ QPoint(-7, 8),
+ QPoint(0, -40)
+ };
+ static const QPoint minuteHand[3] = {
+ QPoint(7, 8),
+ QPoint(-7, 8),
+ QPoint(0, -70)
+ };
+
+ QColor hourColor(127, 0, 127);
+ QColor minuteColor(0, 127, 127, 191);
+
+ int side = qMin(width(), height());
+ QTime time = QTime::currentTime();
+ time = time.addSecs(timeZoneOffset);
+
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.translate(width() / 2, height() / 2);
+ painter.scale(side / 200.0, side / 200.0);
+
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(hourColor);
+
+ painter.save();
+ painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
+ painter.drawConvexPolygon(hourHand, 3);
+ painter.restore();
+
+ painter.setPen(hourColor);
+
+ for (int i = 0; i < 12; ++i) {
+ painter.drawLine(88, 0, 96, 0);
+ painter.rotate(30.0);
+ }
+
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(minuteColor);
+
+ painter.save();
+ painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
+ painter.drawConvexPolygon(minuteHand, 3);
+ painter.restore();
+
+ painter.setPen(minuteColor);
+
+ for (int j = 0; j < 60; ++j) {
+ if ((j % 5) != 0)
+ painter.drawLine(92, 0, 96, 0);
+ painter.rotate(6.0);
+ }
+
+ emit updated(time);
+}
+
+void WorldTimeClock::setTimeZone(int hourOffset)
+{
+ timeZoneOffset = qMin(qMax(-12, hourOffset), 12) * 3600;
+ update();
+}
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclock.h b/examples/designer/worldtimeclockplugin/worldtimeclock.h
new file mode 100644
index 0000000..7bfe8c5
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/worldtimeclock.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WORLDTIMECLOCK_H
+#define WORLDTIMECLOCK_H
+
+#include <QTime>
+#include <QWidget>
+#include <QtDesigner/QDesignerExportWidget>
+
+//! [0] //! [1]
+class QDESIGNER_WIDGET_EXPORT WorldTimeClock : public QWidget
+{
+ Q_OBJECT
+//! [0]
+
+public:
+ WorldTimeClock(QWidget *parent = 0);
+
+public slots:
+ void setTimeZone(int hourOffset);
+
+signals:
+ void updated(QTime currentTime);
+
+protected:
+ void paintEvent(QPaintEvent *event);
+
+private:
+ int timeZoneOffset;
+//! [2]
+};
+//! [1] //! [2]
+
+#endif
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
new file mode 100644
index 0000000..e73c45b
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "worldtimeclock.h"
+#include "worldtimeclockplugin.h"
+
+#include <QtPlugin>
+
+WorldTimeClockPlugin::WorldTimeClockPlugin(QObject *parent)
+ : QObject(parent)
+{
+ initialized = false;
+}
+
+void WorldTimeClockPlugin::initialize(QDesignerFormEditorInterface * /* core */)
+{
+ if (initialized)
+ return;
+
+ initialized = true;
+}
+
+bool WorldTimeClockPlugin::isInitialized() const
+{
+ return initialized;
+}
+
+QWidget *WorldTimeClockPlugin::createWidget(QWidget *parent)
+{
+ return new WorldTimeClock(parent);
+}
+
+QString WorldTimeClockPlugin::name() const
+{
+ return "WorldTimeClock";
+}
+
+QString WorldTimeClockPlugin::group() const
+{
+ return "Display Widgets [Examples]";
+}
+
+QIcon WorldTimeClockPlugin::icon() const
+{
+ return QIcon();
+}
+
+QString WorldTimeClockPlugin::toolTip() const
+{
+ return "";
+}
+
+QString WorldTimeClockPlugin::whatsThis() const
+{
+ return "";
+}
+
+bool WorldTimeClockPlugin::isContainer() const
+{
+ return false;
+}
+
+QString WorldTimeClockPlugin::domXml() const
+{
+ return "<ui language=\"c++\">\n"
+ " <widget class=\"WorldTimeClock\" name=\"worldTimeClock\">\n"
+ " <property name=\"geometry\">\n"
+ " <rect>\n"
+ " <x>0</x>\n"
+ " <y>0</y>\n"
+ " <width>100</width>\n"
+ " <height>100</height>\n"
+ " </rect>\n"
+ " </property>\n"
+ " </widget>\n"
+ "</ui>";
+}
+
+QString WorldTimeClockPlugin::includeFile() const
+{
+ return "worldtimeclock.h";
+}
+
+//! [0]
+Q_EXPORT_PLUGIN2(worldtimeclockplugin, WorldTimeClockPlugin)
+//! [0]
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
new file mode 100644
index 0000000..87d797a
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WORLDTIMECLOCKPLUGIN_H
+#define WORLDTIMECLOCKPLUGIN_H
+
+#include <QDesignerCustomWidgetInterface>
+
+//! [0]
+class WorldTimeClockPlugin : public QObject,
+ public QDesignerCustomWidgetInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QDesignerCustomWidgetInterface)
+
+public:
+ WorldTimeClockPlugin(QObject *parent = 0);
+
+ bool isContainer() const;
+ bool isInitialized() const;
+ QIcon icon() const;
+ QString domXml() const;
+ QString group() const;
+ QString includeFile() const;
+ QString name() const;
+ QString toolTip() const;
+ QString whatsThis() const;
+ QWidget *createWidget(QWidget *parent);
+ void initialize(QDesignerFormEditorInterface *core);
+
+private:
+ bool initialized;
+};
+//! [0]
+
+#endif
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro
new file mode 100644
index 0000000..cd117dc
--- /dev/null
+++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.pro
@@ -0,0 +1,21 @@
+#! [0]
+CONFIG += designer plugin
+#! [0]
+TARGET = $$qtLibraryTarget($$TARGET)
+#! [1]
+TEMPLATE = lib
+#! [1]
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/designer
+
+#! [2]
+HEADERS = worldtimeclock.h \
+ worldtimeclockplugin.h
+SOURCES = worldtimeclock.cpp \
+ worldtimeclockplugin.cpp
+#! [2]
+
+# install
+target.path = $$[QT_INSTALL_PLUGINS]/designer
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/designer/worldtimeclockplugin
+INSTALLS += target sources
diff --git a/examples/desktop/README b/examples/desktop/README
new file mode 100644
index 0000000..efe569a
--- /dev/null
+++ b/examples/desktop/README
@@ -0,0 +1,41 @@
+Qt provides features to enable applications to integrate with the user's
+preferred desktop environment.
+
+Features such as system tray icons, access to the desktop widget, and
+support for desktop services can be used to improve the appearance of
+applications and take advantage of underlying desktop facilities.
+
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/desktop/desktop.pro b/examples/desktop/desktop.pro
new file mode 100644
index 0000000..b65f4f2
--- /dev/null
+++ b/examples/desktop/desktop.pro
@@ -0,0 +1,11 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS = screenshot
+
+contains(QT_CONFIG, svg): SUBDIRS += systray
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/desktop
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS desktop.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/desktop
+INSTALLS += target sources
diff --git a/examples/desktop/screenshot/main.cpp b/examples/desktop/screenshot/main.cpp
new file mode 100644
index 0000000..59e8674
--- /dev/null
+++ b/examples/desktop/screenshot/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "screenshot.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Screenshot screenshot;
+ screenshot.show();
+ return app.exec();
+}
diff --git a/examples/desktop/screenshot/screenshot.cpp b/examples/desktop/screenshot/screenshot.cpp
new file mode 100644
index 0000000..7d9545e
--- /dev/null
+++ b/examples/desktop/screenshot/screenshot.cpp
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "screenshot.h"
+
+//! [0]
+Screenshot::Screenshot()
+{
+ screenshotLabel = new QLabel;
+ screenshotLabel->setSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Expanding);
+ screenshotLabel->setAlignment(Qt::AlignCenter);
+ screenshotLabel->setMinimumSize(240, 160);
+
+ createOptionsGroupBox();
+ createButtonsLayout();
+
+ mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(screenshotLabel);
+ mainLayout->addWidget(optionsGroupBox);
+ mainLayout->addLayout(buttonsLayout);
+ setLayout(mainLayout);
+
+ shootScreen();
+ delaySpinBox->setValue(5);
+
+ setWindowTitle(tr("Screenshot"));
+ resize(300, 200);
+}
+//! [0]
+
+//! [1]
+void Screenshot::resizeEvent(QResizeEvent * /* event */)
+{
+ QSize scaledSize = originalPixmap.size();
+ scaledSize.scale(screenshotLabel->size(), Qt::KeepAspectRatio);
+ if (!screenshotLabel->pixmap()
+ || scaledSize != screenshotLabel->pixmap()->size())
+ updateScreenshotLabel();
+}
+//! [1]
+
+//! [2]
+void Screenshot::newScreenshot()
+{
+ if (hideThisWindowCheckBox->isChecked())
+ hide();
+ newScreenshotButton->setDisabled(true);
+
+ QTimer::singleShot(delaySpinBox->value() * 1000, this, SLOT(shootScreen()));
+}
+//! [2]
+
+//! [3]
+void Screenshot::saveScreenshot()
+{
+ QString format = "png";
+ QString initialPath = QDir::currentPath() + tr("/untitled.") + format;
+
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
+ initialPath,
+ tr("%1 Files (*.%2);;All Files (*)")
+ .arg(format.toUpper())
+ .arg(format));
+ if (!fileName.isEmpty())
+ originalPixmap.save(fileName, format.toAscii());
+}
+//! [3]
+
+//! [4]
+void Screenshot::shootScreen()
+{
+ if (delaySpinBox->value() != 0)
+ qApp->beep();
+//! [4]
+ originalPixmap = QPixmap(); // clear image for low memory situations
+ // on embedded devices.
+//! [5]
+ originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
+ updateScreenshotLabel();
+
+ newScreenshotButton->setDisabled(false);
+ if (hideThisWindowCheckBox->isChecked())
+ show();
+}
+//! [5]
+
+//! [6]
+void Screenshot::updateCheckBox()
+{
+ if (delaySpinBox->value() == 0) {
+ hideThisWindowCheckBox->setDisabled(true);
+ hideThisWindowCheckBox->setChecked(false);
+ }
+ else
+ hideThisWindowCheckBox->setDisabled(false);
+}
+//! [6]
+
+//! [7]
+void Screenshot::createOptionsGroupBox()
+{
+ optionsGroupBox = new QGroupBox(tr("Options"));
+
+ delaySpinBox = new QSpinBox;
+ delaySpinBox->setSuffix(tr(" s"));
+ delaySpinBox->setMaximum(60);
+ connect(delaySpinBox, SIGNAL(valueChanged(int)), this, SLOT(updateCheckBox()));
+
+ delaySpinBoxLabel = new QLabel(tr("Screenshot Delay:"));
+
+ hideThisWindowCheckBox = new QCheckBox(tr("Hide This Window"));
+
+ optionsGroupBoxLayout = new QGridLayout;
+ optionsGroupBoxLayout->addWidget(delaySpinBoxLabel, 0, 0);
+ optionsGroupBoxLayout->addWidget(delaySpinBox, 0, 1);
+ optionsGroupBoxLayout->addWidget(hideThisWindowCheckBox, 1, 0, 1, 2);
+ optionsGroupBox->setLayout(optionsGroupBoxLayout);
+}
+//! [7]
+
+//! [8]
+void Screenshot::createButtonsLayout()
+{
+ newScreenshotButton = createButton(tr("New Screenshot"),
+ this, SLOT(newScreenshot()));
+
+ saveScreenshotButton = createButton(tr("Save Screenshot"),
+ this, SLOT(saveScreenshot()));
+
+ quitScreenshotButton = createButton(tr("Quit"), this, SLOT(close()));
+
+ buttonsLayout = new QHBoxLayout;
+ buttonsLayout->addStretch();
+ buttonsLayout->addWidget(newScreenshotButton);
+ buttonsLayout->addWidget(saveScreenshotButton);
+ buttonsLayout->addWidget(quitScreenshotButton);
+}
+//! [8]
+
+//! [9]
+QPushButton *Screenshot::createButton(const QString &text, QWidget *receiver,
+ const char *member)
+{
+ QPushButton *button = new QPushButton(text);
+ button->connect(button, SIGNAL(clicked()), receiver, member);
+ return button;
+}
+//! [9]
+
+//! [10]
+void Screenshot::updateScreenshotLabel()
+{
+ screenshotLabel->setPixmap(originalPixmap.scaled(screenshotLabel->size(),
+ Qt::KeepAspectRatio,
+ Qt::SmoothTransformation));
+}
+//! [10]
diff --git a/examples/desktop/screenshot/screenshot.h b/examples/desktop/screenshot/screenshot.h
new file mode 100644
index 0000000..ecc7724
--- /dev/null
+++ b/examples/desktop/screenshot/screenshot.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SCREENSHOT_H
+#define SCREENSHOT_H
+
+#include <QPixmap>
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QGridLayout;
+class QGroupBox;
+class QHBoxLayout;
+class QLabel;
+class QPushButton;
+class QSpinBox;
+class QVBoxLayout;
+QT_END_NAMESPACE
+
+//! [0]
+class Screenshot : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Screenshot();
+
+protected:
+ void resizeEvent(QResizeEvent *event);
+
+private slots:
+ void newScreenshot();
+ void saveScreenshot();
+ void shootScreen();
+ void updateCheckBox();
+
+private:
+ void createOptionsGroupBox();
+ void createButtonsLayout();
+ QPushButton *createButton(const QString &text, QWidget *receiver,
+ const char *member);
+ void updateScreenshotLabel();
+
+ QPixmap originalPixmap;
+
+ QLabel *screenshotLabel;
+ QGroupBox *optionsGroupBox;
+ QSpinBox *delaySpinBox;
+ QLabel *delaySpinBoxLabel;
+ QCheckBox *hideThisWindowCheckBox;
+ QPushButton *newScreenshotButton;
+ QPushButton *saveScreenshotButton;
+ QPushButton *quitScreenshotButton;
+
+ QVBoxLayout *mainLayout;
+ QGridLayout *optionsGroupBoxLayout;
+ QHBoxLayout *buttonsLayout;
+};
+//! [0]
+
+#endif
diff --git a/examples/desktop/screenshot/screenshot.pro b/examples/desktop/screenshot/screenshot.pro
new file mode 100644
index 0000000..3ecbf8f
--- /dev/null
+++ b/examples/desktop/screenshot/screenshot.pro
@@ -0,0 +1,9 @@
+HEADERS = screenshot.h
+SOURCES = main.cpp \
+ screenshot.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/desktop/screenshot
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS screenshot.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/desktop/screenshot
+INSTALLS += target sources
diff --git a/examples/desktop/systray/images/bad.svg b/examples/desktop/systray/images/bad.svg
new file mode 100644
index 0000000..186dba9
--- /dev/null
+++ b/examples/desktop/systray/images/bad.svg
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg viewBox="-10 -10 178 178" height="177.523" id="svg1" inkscape:version="0.40" sodipodi:docbase="/mnt/donnees/09-Mes_images/Travaux/Travaux vectoriel/pictogrammes/sécu SVG/produits chimiques" sodipodi:docname="XiIrritant.svg" sodipodi:version="0.32" width="155.932" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
+<metadata>
+<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<cc:Work rdf:about="">
+<dc:title>Irritant</dc:title>
+<dc:description>produit chimique</dc:description>
+<dc:subject>
+<rdf:Bag>
+<rdf:li></rdf:li>
+<rdf:li>symbol</rdf:li>
+<rdf:li>signs_and_symbols</rdf:li>
+</rdf:Bag>
+</dc:subject>
+<dc:publisher>
+<cc:Agent rdf:about="http://www.openclipart.org">
+<dc:title>yves GUILLOU</dc:title>
+</cc:Agent>
+</dc:publisher>
+<dc:creator>
+<cc:Agent>
+<dc:title>yves GUILLOU</dc:title>
+</cc:Agent>
+</dc:creator>
+<dc:rights>
+<cc:Agent>
+<dc:title>yves GUILLOU</dc:title>
+</cc:Agent>
+</dc:rights>
+<dc:date></dc:date>
+<dc:format>image/svg+xml</dc:format>
+<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
+<dc:language>en</dc:language>
+</cc:Work>
+<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
+<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+</cc:License>
+</rdf:RDF>
+</metadata>
+<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="svg1" inkscape:cx="62.372805" inkscape:cy="34.864537" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="1121" inkscape:window-width="1590" inkscape:window-x="200" inkscape:window-y="0" inkscape:zoom="6.6399849" pagecolor="#ffffff"/>
+<defs id="defs2">
+<marker id="ArrowEnd" markerHeight="3" markerUnits="strokeWidth" markerWidth="4" orient="auto" refX="0" refY="5" viewBox="0 0 10 10">
+<path d="M 0 0 L 10 5 L 0 10 z" id="path4"/>
+</marker>
+<marker id="ArrowStart" markerHeight="3" markerUnits="strokeWidth" markerWidth="4" orient="auto" refX="10" refY="5" viewBox="0 0 10 10">
+<path d="M 10 0 L 0 5 L 10 10 z" id="path6"/>
+</marker>
+</defs>
+<g id="g7">
+<g id="g8">
+<path d="M 155.932 155.932L 155.932 0L 0 0L 0 155.932L 155.932 155.932z" id="path9" style="stroke:none; fill:#000000"/>
+<path d="M 150.83 150.83L 150.83 5.1011L 5.1011 5.1011L 5.1011 150.83L 150.83 150.83z" id="path10" style="stroke:none; fill:#ff9900"/>
+</g>
+<g id="g11">
+<path d="M 140.823 111.783L 44.3677 14.0771L 15.1084 44.1489L 111.564 141.854L 140.823 111.783z" id="path12" style="stroke:none; fill:#000000"/>
+<path d="M 111.783 15.1084L 14.0771 111.564L 44.1489 140.823L 141.855 44.3677L 111.783 15.1084z" id="path13" style="stroke:none; fill:#000000"/>
+</g>
+</g>
+</svg>
diff --git a/examples/desktop/systray/images/heart.svg b/examples/desktop/systray/images/heart.svg
new file mode 100644
index 0000000..ba5f050
--- /dev/null
+++ b/examples/desktop/systray/images/heart.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="595.27559pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
+<metadata>
+<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<cc:Work rdf:about="">
+<dc:title>Heart Left-Highlight</dc:title>
+<dc:description>This is a normal valentines day heart.</dc:description>
+<dc:subject>
+<rdf:Bag>
+<rdf:li>holiday</rdf:li>
+<rdf:li>valentines</rdf:li>
+<rdf:li></rdf:li>
+<rdf:li>valentine</rdf:li>
+<rdf:li>hash(0x8a091c0)</rdf:li>
+<rdf:li>hash(0x8a0916c)</rdf:li>
+<rdf:li>signs_and_symbols</rdf:li>
+<rdf:li>hash(0x8a091f0)</rdf:li>
+<rdf:li>day</rdf:li>
+</rdf:Bag>
+</dc:subject>
+<dc:publisher>
+<cc:Agent rdf:about="http://www.openclipart.org">
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:publisher>
+<dc:creator>
+<cc:Agent>
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:creator>
+<dc:rights>
+<cc:Agent>
+<dc:title>Jon Phillips</dc:title>
+</cc:Agent>
+</dc:rights>
+<dc:date></dc:date>
+<dc:format>image/svg+xml</dc:format>
+<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
+<dc:language>en</dc:language>
+</cc:Work>
+<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
+<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+</cc:License>
+</rdf:RDF>
+</metadata>
+<defs id="defs3"/>
+<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/>
+<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
+<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
+<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
+</g>
+</svg>
diff --git a/examples/desktop/systray/images/trash.svg b/examples/desktop/systray/images/trash.svg
new file mode 100644
index 0000000..c44e4c7
--- /dev/null
+++ b/examples/desktop/systray/images/trash.svg
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 10, SVG Export Plug-In . SVG Version: 3.0.0 Build 76) --><svg enable-background="new 0 0 347 348" height="348" i:pageBounds="0 792 612 0" i:rulerOrigin="0 0" i:viewOrigin="131 567" overflow="visible" space="preserve" viewBox="-20 -20 387 388" width="347" xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink">
+<metadata>
+<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<cc:Work rdf:about="">
+<dc:title>Keep Tidy Inside</dc:title>
+<dc:description></dc:description>
+<dc:subject>
+<rdf:Bag>
+<rdf:li></rdf:li>
+<rdf:li>symbol</rdf:li>
+<rdf:li>bin</rdf:li>
+<rdf:li>signs_and_symbols</rdf:li>
+<rdf:li>clean</rdf:li>
+<rdf:li>rubish</rdf:li>
+<rdf:li>trash</rdf:li>
+<rdf:li>inside</rdf:li>
+<rdf:li>garbage</rdf:li>
+<rdf:li>sign</rdf:li>
+</rdf:Bag>
+</dc:subject>
+<dc:publisher>
+<cc:Agent rdf:about="http://www.openclipart.org">
+<dc:title>Martin Owens</dc:title>
+</cc:Agent>
+</dc:publisher>
+<dc:creator>
+<cc:Agent>
+<dc:title>Martin Owens</dc:title>
+</cc:Agent>
+</dc:creator>
+<dc:rights>
+<cc:Agent>
+<dc:title>Martin Owens</dc:title>
+</cc:Agent>
+</dc:rights>
+<dc:date></dc:date>
+<dc:format>image/svg+xml</dc:format>
+<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
+<dc:language>en</dc:language>
+</cc:Work>
+<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
+<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+</cc:License>
+</rdf:RDF>
+</metadata>
+<g i:dimmedPercent="50" i:knockout="Off" i:layer="yes" i:rgbTrio="#4F008000FFFF" id="Layer_1">
+<path d="M347,174c0,96.098-77.679,174-173.5,174C77.679,348,0,270.098,0,174 C0,77.902,77.679,0,173.5,0C269.321,0,347,77.902,347,174z" fill="#10A040" i:knockout="Off"/>
+<path d="M238,53c0,13.807-11.864,25-26.5,25S185,66.807,185,53s11.864-25,26.5-25 S238,39.193,238,53z" fill="#FFFFFF" i:knockout="Off"/>
+<path d="M66,175c1.055,6.355,19.333,126.417,19.333,126.417h68.333 c0,0,14.105-122.524,14.333-126.417c6.224-0.622,6.667-13-2-13c-12.164,0-89.205-0.059-98,0S61.167,174.487,66,175z" fill="#FFFFFF" i:knockout="Off"/>
+<path d="M78,141c17.292-5.325,24.179-23.532,27-31c14.513,6.596,40.333,12.265,59,8 c3.683,19.419-28.043,19.31-23,37C132.577,145.705,89.404,167.292,78,141z" fill="#FFFFFF" i:knockout="Off"/>
+<path d="M103,82l139-1c-0.6,3.421,33.633,57.497,29,67c-4.089,0.418-67,5-67,5 c6.109-9.379-13-43-13-43L103,82z" fill="#FFFFFF" i:knockout="Off"/>
+<path d="M270,156l-66-3c0,0-23.565,143.355-24,145s1.855,2.536,3,1s51-82,51-82 s19.754,80.701,20,82s3.721,1.209,4,0S270,156,270,156z" fill="#FFFFFF" i:knockout="Off"/>
+</g>
+</svg>
diff --git a/examples/desktop/systray/main.cpp b/examples/desktop/systray/main.cpp
new file mode 100644
index 0000000..d406d16
--- /dev/null
+++ b/examples/desktop/systray/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "window.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(systray);
+
+ QApplication app(argc, argv);
+
+ if (!QSystemTrayIcon::isSystemTrayAvailable()) {
+ QMessageBox::critical(0, QObject::tr("Systray"),
+ QObject::tr("I couldn't detect any system tray "
+ "on this system."));
+ return 1;
+ }
+ QApplication::setQuitOnLastWindowClosed(false);
+
+ Window window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/desktop/systray/systray.pro b/examples/desktop/systray/systray.pro
new file mode 100644
index 0000000..c73a48e
--- /dev/null
+++ b/examples/desktop/systray/systray.pro
@@ -0,0 +1,22 @@
+HEADERS = window.h
+SOURCES = main.cpp \
+ window.cpp
+RESOURCES = systray.qrc
+QT += xml svg
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/desktop/systray
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS systray.pro resources images
+sources.path = $$[QT_INSTALL_EXAMPLES]/desktop/systray
+INSTALLS += target sources
+
+wince* {
+ CONFIG(debug, release|debug) {
+ addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qsvgd4.dll
+ }
+ CONFIG(release, release|debug) {
+ addPlugins.sources = $$QT_BUILD_TREE/plugins/imageformats/qsvg4.dll
+ }
+ addPlugins.path = imageformats
+ DEPLOYMENT += addPlugins
+}
diff --git a/examples/desktop/systray/systray.qrc b/examples/desktop/systray/systray.qrc
new file mode 100644
index 0000000..b0d5e0c
--- /dev/null
+++ b/examples/desktop/systray/systray.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>images/bad.svg</file>
+ <file>images/heart.svg</file>
+ <file>images/trash.svg</file>
+</qresource>
+</RCC>
diff --git a/examples/desktop/systray/window.cpp b/examples/desktop/systray/window.cpp
new file mode 100644
index 0000000..052ecdd
--- /dev/null
+++ b/examples/desktop/systray/window.cpp
@@ -0,0 +1,259 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "window.h"
+
+//! [0]
+Window::Window()
+{
+ createIconGroupBox();
+ createMessageGroupBox();
+
+ iconLabel->setMinimumWidth(durationLabel->sizeHint().width());
+
+ createActions();
+ createTrayIcon();
+
+ connect(showMessageButton, SIGNAL(clicked()), this, SLOT(showMessage()));
+ connect(showIconCheckBox, SIGNAL(toggled(bool)),
+ trayIcon, SLOT(setVisible(bool)));
+ connect(iconComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(setIcon(int)));
+ connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
+ connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
+ this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(iconGroupBox);
+ mainLayout->addWidget(messageGroupBox);
+ setLayout(mainLayout);
+
+ iconComboBox->setCurrentIndex(1);
+ trayIcon->show();
+
+ setWindowTitle(tr("Systray"));
+ resize(400, 300);
+}
+//! [0]
+
+//! [1]
+void Window::setVisible(bool visible)
+{
+ minimizeAction->setEnabled(visible);
+ maximizeAction->setEnabled(!isMaximized());
+ restoreAction->setEnabled(isMaximized() || !visible);
+ QDialog::setVisible(visible);
+}
+//! [1]
+
+//! [2]
+void Window::closeEvent(QCloseEvent *event)
+{
+ if (trayIcon->isVisible()) {
+ QMessageBox::information(this, tr("Systray"),
+ tr("The program will keep running in the "
+ "system tray. To terminate the program, "
+ "choose <b>Quit</b> in the context menu "
+ "of the system tray entry."));
+ hide();
+ event->ignore();
+ }
+}
+//! [2]
+
+//! [3]
+void Window::setIcon(int index)
+{
+ QIcon icon = iconComboBox->itemIcon(index);
+ trayIcon->setIcon(icon);
+ setWindowIcon(icon);
+
+ trayIcon->setToolTip(iconComboBox->itemText(index));
+}
+//! [3]
+
+//! [4]
+void Window::iconActivated(QSystemTrayIcon::ActivationReason reason)
+{
+ switch (reason) {
+ case QSystemTrayIcon::Trigger:
+ case QSystemTrayIcon::DoubleClick:
+ iconComboBox->setCurrentIndex((iconComboBox->currentIndex() + 1)
+ % iconComboBox->count());
+ break;
+ case QSystemTrayIcon::MiddleClick:
+ showMessage();
+ break;
+ default:
+ ;
+ }
+}
+//! [4]
+
+//! [5]
+void Window::showMessage()
+{
+ QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::MessageIcon(
+ typeComboBox->itemData(typeComboBox->currentIndex()).toInt());
+ trayIcon->showMessage(titleEdit->text(), bodyEdit->toPlainText(), icon,
+ durationSpinBox->value() * 1000);
+}
+//! [5]
+
+//! [6]
+void Window::messageClicked()
+{
+ QMessageBox::information(0, tr("Systray"),
+ tr("Sorry, I already gave what help I could.\n"
+ "Maybe you should try asking a human?"));
+}
+//! [6]
+
+void Window::createIconGroupBox()
+{
+ iconGroupBox = new QGroupBox(tr("Tray Icon"));
+
+ iconLabel = new QLabel("Icon:");
+
+ iconComboBox = new QComboBox;
+ iconComboBox->addItem(QIcon(":/images/bad.svg"), tr("Bad"));
+ iconComboBox->addItem(QIcon(":/images/heart.svg"), tr("Heart"));
+ iconComboBox->addItem(QIcon(":/images/trash.svg"), tr("Trash"));
+
+ showIconCheckBox = new QCheckBox(tr("Show icon"));
+ showIconCheckBox->setChecked(true);
+
+ QHBoxLayout *iconLayout = new QHBoxLayout;
+ iconLayout->addWidget(iconLabel);
+ iconLayout->addWidget(iconComboBox);
+ iconLayout->addStretch();
+ iconLayout->addWidget(showIconCheckBox);
+ iconGroupBox->setLayout(iconLayout);
+}
+
+void Window::createMessageGroupBox()
+{
+ messageGroupBox = new QGroupBox(tr("Balloon Message"));
+
+ typeLabel = new QLabel(tr("Type:"));
+
+ typeComboBox = new QComboBox;
+ typeComboBox->addItem(tr("None"), QSystemTrayIcon::NoIcon);
+ typeComboBox->addItem(style()->standardIcon(
+ QStyle::SP_MessageBoxInformation), tr("Information"),
+ QSystemTrayIcon::Information);
+ typeComboBox->addItem(style()->standardIcon(
+ QStyle::SP_MessageBoxWarning), tr("Warning"),
+ QSystemTrayIcon::Warning);
+ typeComboBox->addItem(style()->standardIcon(
+ QStyle::SP_MessageBoxCritical), tr("Critical"),
+ QSystemTrayIcon::Critical);
+ typeComboBox->setCurrentIndex(1);
+
+ durationLabel = new QLabel(tr("Duration:"));
+
+ durationSpinBox = new QSpinBox;
+ durationSpinBox->setRange(5, 60);
+ durationSpinBox->setSuffix(" s");
+ durationSpinBox->setValue(15);
+
+ durationWarningLabel = new QLabel(tr("(some systems might ignore this "
+ "hint)"));
+ durationWarningLabel->setIndent(10);
+
+ titleLabel = new QLabel(tr("Title:"));
+
+ titleEdit = new QLineEdit(tr("Cannot connect to network"));
+
+ bodyLabel = new QLabel(tr("Body:"));
+
+ bodyEdit = new QTextEdit;
+ bodyEdit->setPlainText(tr("Don't believe me. Honestly, I don't have a "
+ "clue.\nClick this balloon for details."));
+
+ showMessageButton = new QPushButton(tr("Show Message"));
+ showMessageButton->setDefault(true);
+
+ QGridLayout *messageLayout = new QGridLayout;
+ messageLayout->addWidget(typeLabel, 0, 0);
+ messageLayout->addWidget(typeComboBox, 0, 1, 1, 2);
+ messageLayout->addWidget(durationLabel, 1, 0);
+ messageLayout->addWidget(durationSpinBox, 1, 1);
+ messageLayout->addWidget(durationWarningLabel, 1, 2, 1, 3);
+ messageLayout->addWidget(titleLabel, 2, 0);
+ messageLayout->addWidget(titleEdit, 2, 1, 1, 4);
+ messageLayout->addWidget(bodyLabel, 3, 0);
+ messageLayout->addWidget(bodyEdit, 3, 1, 2, 4);
+ messageLayout->addWidget(showMessageButton, 5, 4);
+ messageLayout->setColumnStretch(3, 1);
+ messageLayout->setRowStretch(4, 1);
+ messageGroupBox->setLayout(messageLayout);
+}
+
+void Window::createActions()
+{
+ minimizeAction = new QAction(tr("Mi&nimize"), this);
+ connect(minimizeAction, SIGNAL(triggered()), this, SLOT(hide()));
+
+ maximizeAction = new QAction(tr("Ma&ximize"), this);
+ connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
+
+ restoreAction = new QAction(tr("&Restore"), this);
+ connect(restoreAction, SIGNAL(triggered()), this, SLOT(showNormal()));
+
+ quitAction = new QAction(tr("&Quit"), this);
+ connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+}
+
+void Window::createTrayIcon()
+{
+ trayIconMenu = new QMenu(this);
+ trayIconMenu->addAction(minimizeAction);
+ trayIconMenu->addAction(maximizeAction);
+ trayIconMenu->addAction(restoreAction);
+ trayIconMenu->addSeparator();
+ trayIconMenu->addAction(quitAction);
+
+ trayIcon = new QSystemTrayIcon(this);
+ trayIcon->setContextMenu(trayIconMenu);
+}
diff --git a/examples/desktop/systray/window.h b/examples/desktop/systray/window.h
new file mode 100644
index 0000000..d9bfd52
--- /dev/null
+++ b/examples/desktop/systray/window.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QSystemTrayIcon>
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QCheckBox;
+class QComboBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QMenu;
+class QPushButton;
+class QSpinBox;
+class QTextEdit;
+QT_END_NAMESPACE
+
+//! [0]
+class Window : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Window();
+
+ void setVisible(bool visible);
+
+protected:
+ void closeEvent(QCloseEvent *event);
+
+private slots:
+ void setIcon(int index);
+ void iconActivated(QSystemTrayIcon::ActivationReason reason);
+ void showMessage();
+ void messageClicked();
+
+private:
+ void createIconGroupBox();
+ void createMessageGroupBox();
+ void createActions();
+ void createTrayIcon();
+
+ QGroupBox *iconGroupBox;
+ QLabel *iconLabel;
+ QComboBox *iconComboBox;
+ QCheckBox *showIconCheckBox;
+
+ QGroupBox *messageGroupBox;
+ QLabel *typeLabel;
+ QLabel *durationLabel;
+ QLabel *durationWarningLabel;
+ QLabel *titleLabel;
+ QLabel *bodyLabel;
+ QComboBox *typeComboBox;
+ QSpinBox *durationSpinBox;
+ QLineEdit *titleEdit;
+ QTextEdit *bodyEdit;
+ QPushButton *showMessageButton;
+
+ QAction *minimizeAction;
+ QAction *maximizeAction;
+ QAction *restoreAction;
+ QAction *quitAction;
+
+ QSystemTrayIcon *trayIcon;
+ QMenu *trayIconMenu;
+};
+//! [0]
+
+#endif
diff --git a/examples/dialogs/README b/examples/dialogs/README
new file mode 100644
index 0000000..ab0f884
--- /dev/null
+++ b/examples/dialogs/README
@@ -0,0 +1,40 @@
+Qt includes standard dialogs for many common operations, such as file
+selection, printing, and color selection.
+
+Custom dialogs can also be created for specialized modal or modeless
+interactions with users.
+
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/dialogs/classwizard/classwizard.cpp b/examples/dialogs/classwizard/classwizard.cpp
new file mode 100644
index 0000000..200d7ac
--- /dev/null
+++ b/examples/dialogs/classwizard/classwizard.cpp
@@ -0,0 +1,431 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "classwizard.h"
+
+//! [0] //! [1]
+ClassWizard::ClassWizard(QWidget *parent)
+ : QWizard(parent)
+{
+ addPage(new IntroPage);
+ addPage(new ClassInfoPage);
+ addPage(new CodeStylePage);
+ addPage(new OutputFilesPage);
+ addPage(new ConclusionPage);
+//! [0]
+
+ setPixmap(QWizard::BannerPixmap, QPixmap(":/images/banner.png"));
+ setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/background.png"));
+
+ setWindowTitle(tr("Class Wizard"));
+//! [2]
+}
+//! [1] //! [2]
+
+//! [3]
+void ClassWizard::accept()
+//! [3] //! [4]
+{
+ QByteArray className = field("className").toByteArray();
+ QByteArray baseClass = field("baseClass").toByteArray();
+ QByteArray macroName = field("macroName").toByteArray();
+ QByteArray baseInclude = field("baseInclude").toByteArray();
+
+ QString outputDir = field("outputDir").toString();
+ QString header = field("header").toString();
+ QString implementation = field("implementation").toString();
+//! [4]
+
+ QByteArray block;
+
+ if (field("comment").toBool()) {
+ block += "/*\n";
+ block += " " + header.toAscii() + "\n";
+ block += "*/\n";
+ block += "\n";
+ }
+ if (field("protect").toBool()) {
+ block += "#ifndef " + macroName + "\n";
+ block += "#define " + macroName + "\n";
+ block += "\n";
+ }
+ if (field("includeBase").toBool()) {
+ block += "#include " + baseInclude + "\n";
+ block += "\n";
+ }
+
+ block += "class " + className;
+ if (!baseClass.isEmpty())
+ block += " : public " + baseClass;
+ block += "\n";
+ block += "{\n";
+
+ /* qmake ignore Q_OBJECT */
+
+ if (field("qobjectMacro").toBool()) {
+ block += " Q_OBJECT\n";
+ block += "\n";
+ }
+ block += "public:\n";
+
+ if (field("qobjectCtor").toBool()) {
+ block += " " + className + "(QObject *parent = 0);\n";
+ } else if (field("qwidgetCtor").toBool()) {
+ block += " " + className + "(QWidget *parent = 0);\n";
+ } else if (field("defaultCtor").toBool()) {
+ block += " " + className + "();\n";
+ if (field("copyCtor").toBool()) {
+ block += " " + className + "(const " + className + " &other);\n";
+ block += "\n";
+ block += " " + className + " &operator=" + "(const " + className
+ + " &other);\n";
+ }
+ }
+ block += "};\n";
+
+ if (field("protect").toBool()) {
+ block += "\n";
+ block += "#endif\n";
+ }
+
+ QFile headerFile(outputDir + "/" + header);
+ if (!headerFile.open(QFile::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(0, QObject::tr("Simple Wizard"),
+ QObject::tr("Cannot write file %1:\n%2")
+ .arg(headerFile.fileName())
+ .arg(headerFile.errorString()));
+ return;
+ }
+ headerFile.write(block);
+
+ block.clear();
+
+ if (field("comment").toBool()) {
+ block += "/*\n";
+ block += " " + implementation.toAscii() + "\n";
+ block += "*/\n";
+ block += "\n";
+ }
+ block += "#include \"" + header.toAscii() + "\"\n";
+ block += "\n";
+
+ if (field("qobjectCtor").toBool()) {
+ block += className + "::" + className + "(QObject *parent)\n";
+ block += " : " + baseClass + "(parent)\n";
+ block += "{\n";
+ block += "}\n";
+ } else if (field("qwidgetCtor").toBool()) {
+ block += className + "::" + className + "(QWidget *parent)\n";
+ block += " : " + baseClass + "(parent)\n";
+ block += "{\n";
+ block += "}\n";
+ } else if (field("defaultCtor").toBool()) {
+ block += className + "::" + className + "()\n";
+ block += "{\n";
+ block += " // missing code\n";
+ block += "}\n";
+
+ if (field("copyCtor").toBool()) {
+ block += "\n";
+ block += className + "::" + className + "(const " + className
+ + " &other)\n";
+ block += "{\n";
+ block += " *this = other;\n";
+ block += "}\n";
+ block += "\n";
+ block += className + " &" + className + "::operator=(const "
+ + className + " &other)\n";
+ block += "{\n";
+ if (!baseClass.isEmpty())
+ block += " " + baseClass + "::operator=(other);\n";
+ block += " // missing code\n";
+ block += " return *this;\n";
+ block += "}\n";
+ }
+ }
+
+ QFile implementationFile(outputDir + "/" + implementation);
+ if (!implementationFile.open(QFile::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(0, QObject::tr("Simple Wizard"),
+ QObject::tr("Cannot write file %1:\n%2")
+ .arg(implementationFile.fileName())
+ .arg(implementationFile.errorString()));
+ return;
+ }
+ implementationFile.write(block);
+
+//! [5]
+ QDialog::accept();
+//! [5] //! [6]
+}
+//! [6]
+
+//! [7]
+IntroPage::IntroPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Introduction"));
+ setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark1.png"));
+
+ label = new QLabel(tr("This wizard will generate a skeleton C++ class "
+ "definition, including a few functions. You simply "
+ "need to specify the class name and set a few "
+ "options to produce a header file and an "
+ "implementation file for your new C++ class."));
+ label->setWordWrap(true);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ setLayout(layout);
+}
+//! [7]
+
+//! [8] //! [9]
+ClassInfoPage::ClassInfoPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+//! [8]
+ setTitle(tr("Class Information"));
+ setSubTitle(tr("Specify basic information about the class for which you "
+ "want to generate skeleton source code files."));
+ setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo1.png"));
+
+//! [10]
+ classNameLabel = new QLabel(tr("&Class name:"));
+ classNameLineEdit = new QLineEdit;
+ classNameLabel->setBuddy(classNameLineEdit);
+
+ baseClassLabel = new QLabel(tr("B&ase class:"));
+ baseClassLineEdit = new QLineEdit;
+ baseClassLabel->setBuddy(baseClassLineEdit);
+
+ qobjectMacroCheckBox = new QCheckBox(tr("Generate Q_OBJECT &macro"));
+
+//! [10]
+ groupBox = new QGroupBox(tr("C&onstructor"));
+//! [9]
+
+ qobjectCtorRadioButton = new QRadioButton(tr("&QObject-style constructor"));
+ qwidgetCtorRadioButton = new QRadioButton(tr("Q&Widget-style constructor"));
+ defaultCtorRadioButton = new QRadioButton(tr("&Default constructor"));
+ copyCtorCheckBox = new QCheckBox(tr("&Generate copy constructor and "
+ "operator="));
+
+ defaultCtorRadioButton->setChecked(true);
+
+ connect(defaultCtorRadioButton, SIGNAL(toggled(bool)),
+ copyCtorCheckBox, SLOT(setEnabled(bool)));
+
+//! [11] //! [12]
+ registerField("className*", classNameLineEdit);
+ registerField("baseClass", baseClassLineEdit);
+ registerField("qobjectMacro", qobjectMacroCheckBox);
+//! [11]
+ registerField("qobjectCtor", qobjectCtorRadioButton);
+ registerField("qwidgetCtor", qwidgetCtorRadioButton);
+ registerField("defaultCtor", defaultCtorRadioButton);
+ registerField("copyCtor", copyCtorCheckBox);
+
+ QVBoxLayout *groupBoxLayout = new QVBoxLayout;
+//! [12]
+ groupBoxLayout->addWidget(qobjectCtorRadioButton);
+ groupBoxLayout->addWidget(qwidgetCtorRadioButton);
+ groupBoxLayout->addWidget(defaultCtorRadioButton);
+ groupBoxLayout->addWidget(copyCtorCheckBox);
+ groupBox->setLayout(groupBoxLayout);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(classNameLabel, 0, 0);
+ layout->addWidget(classNameLineEdit, 0, 1);
+ layout->addWidget(baseClassLabel, 1, 0);
+ layout->addWidget(baseClassLineEdit, 1, 1);
+ layout->addWidget(qobjectMacroCheckBox, 2, 0, 1, 2);
+ layout->addWidget(groupBox, 3, 0, 1, 2);
+ setLayout(layout);
+//! [13]
+}
+//! [13]
+
+//! [14]
+CodeStylePage::CodeStylePage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Code Style Options"));
+ setSubTitle(tr("Choose the formatting of the generated code."));
+ setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo2.png"));
+
+ commentCheckBox = new QCheckBox(tr("&Start generated files with a "
+//! [14]
+ "comment"));
+ commentCheckBox->setChecked(true);
+
+ protectCheckBox = new QCheckBox(tr("&Protect header file against multiple "
+ "inclusions"));
+ protectCheckBox->setChecked(true);
+
+ macroNameLabel = new QLabel(tr("&Macro name:"));
+ macroNameLineEdit = new QLineEdit;
+ macroNameLabel->setBuddy(macroNameLineEdit);
+
+ includeBaseCheckBox = new QCheckBox(tr("&Include base class definition"));
+ baseIncludeLabel = new QLabel(tr("Base class include:"));
+ baseIncludeLineEdit = new QLineEdit;
+ baseIncludeLabel->setBuddy(baseIncludeLineEdit);
+
+ connect(protectCheckBox, SIGNAL(toggled(bool)),
+ macroNameLabel, SLOT(setEnabled(bool)));
+ connect(protectCheckBox, SIGNAL(toggled(bool)),
+ macroNameLineEdit, SLOT(setEnabled(bool)));
+ connect(includeBaseCheckBox, SIGNAL(toggled(bool)),
+ baseIncludeLabel, SLOT(setEnabled(bool)));
+ connect(includeBaseCheckBox, SIGNAL(toggled(bool)),
+ baseIncludeLineEdit, SLOT(setEnabled(bool)));
+
+ registerField("comment", commentCheckBox);
+ registerField("protect", protectCheckBox);
+ registerField("macroName", macroNameLineEdit);
+ registerField("includeBase", includeBaseCheckBox);
+ registerField("baseInclude", baseIncludeLineEdit);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->setColumnMinimumWidth(0, 20);
+ layout->addWidget(commentCheckBox, 0, 0, 1, 3);
+ layout->addWidget(protectCheckBox, 1, 0, 1, 3);
+ layout->addWidget(macroNameLabel, 2, 1);
+ layout->addWidget(macroNameLineEdit, 2, 2);
+ layout->addWidget(includeBaseCheckBox, 3, 0, 1, 3);
+ layout->addWidget(baseIncludeLabel, 4, 1);
+ layout->addWidget(baseIncludeLineEdit, 4, 2);
+//! [15]
+ setLayout(layout);
+}
+//! [15]
+
+//! [16]
+void CodeStylePage::initializePage()
+{
+ QString className = field("className").toString();
+ macroNameLineEdit->setText(className.toUpper() + "_H");
+
+ QString baseClass = field("baseClass").toString();
+
+ includeBaseCheckBox->setChecked(!baseClass.isEmpty());
+ includeBaseCheckBox->setEnabled(!baseClass.isEmpty());
+ baseIncludeLabel->setEnabled(!baseClass.isEmpty());
+ baseIncludeLineEdit->setEnabled(!baseClass.isEmpty());
+
+ if (baseClass.isEmpty()) {
+ baseIncludeLineEdit->clear();
+ } else if (QRegExp("Q[A-Z].*").exactMatch(baseClass)) {
+ baseIncludeLineEdit->setText("<" + baseClass + ">");
+ } else {
+ baseIncludeLineEdit->setText("\"" + baseClass.toLower() + ".h\"");
+ }
+}
+//! [16]
+
+OutputFilesPage::OutputFilesPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Output Files"));
+ setSubTitle(tr("Specify where you want the wizard to put the generated "
+ "skeleton code."));
+ setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo3.png"));
+
+ outputDirLabel = new QLabel(tr("&Output directory:"));
+ outputDirLineEdit = new QLineEdit;
+ outputDirLabel->setBuddy(outputDirLineEdit);
+
+ headerLabel = new QLabel(tr("&Header file name:"));
+ headerLineEdit = new QLineEdit;
+ headerLabel->setBuddy(headerLineEdit);
+
+ implementationLabel = new QLabel(tr("&Implementation file name:"));
+ implementationLineEdit = new QLineEdit;
+ implementationLabel->setBuddy(implementationLineEdit);
+
+ registerField("outputDir*", outputDirLineEdit);
+ registerField("header*", headerLineEdit);
+ registerField("implementation*", implementationLineEdit);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(outputDirLabel, 0, 0);
+ layout->addWidget(outputDirLineEdit, 0, 1);
+ layout->addWidget(headerLabel, 1, 0);
+ layout->addWidget(headerLineEdit, 1, 1);
+ layout->addWidget(implementationLabel, 2, 0);
+ layout->addWidget(implementationLineEdit, 2, 1);
+ setLayout(layout);
+}
+
+//! [17]
+void OutputFilesPage::initializePage()
+{
+ QString className = field("className").toString();
+ headerLineEdit->setText(className.toLower() + ".h");
+ implementationLineEdit->setText(className.toLower() + ".cpp");
+ outputDirLineEdit->setText(QDir::convertSeparators(QDir::tempPath()));
+}
+//! [17]
+
+ConclusionPage::ConclusionPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Conclusion"));
+ setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark2.png"));
+
+ label = new QLabel;
+ label->setWordWrap(true);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ setLayout(layout);
+}
+
+void ConclusionPage::initializePage()
+{
+ QString finishText = wizard()->buttonText(QWizard::FinishButton);
+ finishText.remove('&');
+ label->setText(tr("Click %1 to generate the class skeleton.")
+ .arg(finishText));
+}
diff --git a/examples/dialogs/classwizard/classwizard.h b/examples/dialogs/classwizard/classwizard.h
new file mode 100644
index 0000000..4808629
--- /dev/null
+++ b/examples/dialogs/classwizard/classwizard.h
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CLASSWIZARD_H
+#define CLASSWIZARD_H
+
+#include <QWizard>
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QRadioButton;
+QT_END_NAMESPACE
+
+//! [0]
+class ClassWizard : public QWizard
+{
+ Q_OBJECT
+
+public:
+ ClassWizard(QWidget *parent = 0);
+
+ void accept();
+};
+//! [0]
+
+//! [1]
+class IntroPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ IntroPage(QWidget *parent = 0);
+
+private:
+ QLabel *label;
+};
+//! [1]
+
+//! [2]
+class ClassInfoPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ ClassInfoPage(QWidget *parent = 0);
+
+private:
+ QLabel *classNameLabel;
+ QLabel *baseClassLabel;
+ QLineEdit *classNameLineEdit;
+ QLineEdit *baseClassLineEdit;
+ QCheckBox *qobjectMacroCheckBox;
+ QGroupBox *groupBox;
+ QRadioButton *qobjectCtorRadioButton;
+ QRadioButton *qwidgetCtorRadioButton;
+ QRadioButton *defaultCtorRadioButton;
+ QCheckBox *copyCtorCheckBox;
+};
+//! [2]
+
+//! [3]
+class CodeStylePage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ CodeStylePage(QWidget *parent = 0);
+
+protected:
+ void initializePage();
+
+private:
+ QCheckBox *commentCheckBox;
+ QCheckBox *protectCheckBox;
+ QCheckBox *includeBaseCheckBox;
+ QLabel *macroNameLabel;
+ QLabel *baseIncludeLabel;
+ QLineEdit *macroNameLineEdit;
+ QLineEdit *baseIncludeLineEdit;
+};
+//! [3]
+
+class OutputFilesPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ OutputFilesPage(QWidget *parent = 0);
+
+protected:
+ void initializePage();
+
+private:
+ QLabel *outputDirLabel;
+ QLabel *headerLabel;
+ QLabel *implementationLabel;
+ QLineEdit *outputDirLineEdit;
+ QLineEdit *headerLineEdit;
+ QLineEdit *implementationLineEdit;
+};
+
+class ConclusionPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ ConclusionPage(QWidget *parent = 0);
+
+protected:
+ void initializePage();
+
+private:
+ QLabel *label;
+};
+
+#endif
diff --git a/examples/dialogs/classwizard/classwizard.pro b/examples/dialogs/classwizard/classwizard.pro
new file mode 100644
index 0000000..15b6029
--- /dev/null
+++ b/examples/dialogs/classwizard/classwizard.pro
@@ -0,0 +1,10 @@
+HEADERS = classwizard.h
+SOURCES = classwizard.cpp \
+ main.cpp
+RESOURCES = classwizard.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/classwizard
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/classwizard
+INSTALLS += target sources
diff --git a/examples/dialogs/classwizard/classwizard.qrc b/examples/dialogs/classwizard/classwizard.qrc
new file mode 100644
index 0000000..41a5ddc
--- /dev/null
+++ b/examples/dialogs/classwizard/classwizard.qrc
@@ -0,0 +1,11 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/background.png</file>
+ <file>images/banner.png</file>
+ <file>images/logo1.png</file>
+ <file>images/logo2.png</file>
+ <file>images/logo3.png</file>
+ <file>images/watermark1.png</file>
+ <file>images/watermark2.png</file>
+</qresource>
+</RCC>
diff --git a/examples/dialogs/classwizard/images/background.png b/examples/dialogs/classwizard/images/background.png
new file mode 100644
index 0000000..44c7bad
--- /dev/null
+++ b/examples/dialogs/classwizard/images/background.png
Binary files differ
diff --git a/examples/dialogs/classwizard/images/banner.png b/examples/dialogs/classwizard/images/banner.png
new file mode 100644
index 0000000..3169152
--- /dev/null
+++ b/examples/dialogs/classwizard/images/banner.png
Binary files differ
diff --git a/examples/dialogs/classwizard/images/logo1.png b/examples/dialogs/classwizard/images/logo1.png
new file mode 100644
index 0000000..f9b594a
--- /dev/null
+++ b/examples/dialogs/classwizard/images/logo1.png
Binary files differ
diff --git a/examples/dialogs/classwizard/images/logo2.png b/examples/dialogs/classwizard/images/logo2.png
new file mode 100644
index 0000000..5dcbd46
--- /dev/null
+++ b/examples/dialogs/classwizard/images/logo2.png
Binary files differ
diff --git a/examples/dialogs/classwizard/images/logo3.png b/examples/dialogs/classwizard/images/logo3.png
new file mode 100644
index 0000000..9fd3ea2
--- /dev/null
+++ b/examples/dialogs/classwizard/images/logo3.png
Binary files differ
diff --git a/examples/dialogs/classwizard/images/watermark1.png b/examples/dialogs/classwizard/images/watermark1.png
new file mode 100644
index 0000000..0091f5c
--- /dev/null
+++ b/examples/dialogs/classwizard/images/watermark1.png
Binary files differ
diff --git a/examples/dialogs/classwizard/images/watermark2.png b/examples/dialogs/classwizard/images/watermark2.png
new file mode 100644
index 0000000..3b88f2e
--- /dev/null
+++ b/examples/dialogs/classwizard/images/watermark2.png
Binary files differ
diff --git a/examples/dialogs/classwizard/main.cpp b/examples/dialogs/classwizard/main.cpp
new file mode 100644
index 0000000..8230695
--- /dev/null
+++ b/examples/dialogs/classwizard/main.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+
+#include "classwizard.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(classwizard);
+
+ QApplication app(argc, argv);
+
+ QString translatorFileName = QLatin1String("qt_");
+ translatorFileName += QLocale::system().name();
+ QTranslator *translator = new QTranslator(&app);
+ if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ app.installTranslator(translator);
+
+ ClassWizard wizard;
+ wizard.show();
+ return app.exec();
+}
diff --git a/examples/dialogs/configdialog/configdialog.cpp b/examples/dialogs/configdialog/configdialog.cpp
new file mode 100644
index 0000000..f442e10
--- /dev/null
+++ b/examples/dialogs/configdialog/configdialog.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "configdialog.h"
+#include "pages.h"
+
+ConfigDialog::ConfigDialog()
+{
+ contentsWidget = new QListWidget;
+ contentsWidget->setViewMode(QListView::IconMode);
+ contentsWidget->setIconSize(QSize(96, 84));
+ contentsWidget->setMovement(QListView::Static);
+ contentsWidget->setMaximumWidth(128);
+ contentsWidget->setSpacing(12);
+
+ pagesWidget = new QStackedWidget;
+ pagesWidget->addWidget(new ConfigurationPage);
+ pagesWidget->addWidget(new UpdatePage);
+ pagesWidget->addWidget(new QueryPage);
+
+ QPushButton *closeButton = new QPushButton(tr("Close"));
+
+ createIcons();
+ contentsWidget->setCurrentRow(0);
+
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+
+ QHBoxLayout *horizontalLayout = new QHBoxLayout;
+ horizontalLayout->addWidget(contentsWidget);
+ horizontalLayout->addWidget(pagesWidget, 1);
+
+ QHBoxLayout *buttonsLayout = new QHBoxLayout;
+ buttonsLayout->addStretch(1);
+ buttonsLayout->addWidget(closeButton);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addLayout(horizontalLayout);
+ mainLayout->addStretch(1);
+ mainLayout->addSpacing(12);
+ mainLayout->addLayout(buttonsLayout);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("Config Dialog"));
+}
+
+void ConfigDialog::createIcons()
+{
+ QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
+ configButton->setIcon(QIcon(":/images/config.png"));
+ configButton->setText(tr("Configuration"));
+ configButton->setTextAlignment(Qt::AlignHCenter);
+ configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+ QListWidgetItem *updateButton = new QListWidgetItem(contentsWidget);
+ updateButton->setIcon(QIcon(":/images/update.png"));
+ updateButton->setText(tr("Update"));
+ updateButton->setTextAlignment(Qt::AlignHCenter);
+ updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+ QListWidgetItem *queryButton = new QListWidgetItem(contentsWidget);
+ queryButton->setIcon(QIcon(":/images/query.png"));
+ queryButton->setText(tr("Query"));
+ queryButton->setTextAlignment(Qt::AlignHCenter);
+ queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+ connect(contentsWidget,
+ SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
+ this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
+}
+
+void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
+{
+ if (!current)
+ current = previous;
+
+ pagesWidget->setCurrentIndex(contentsWidget->row(current));
+}
diff --git a/examples/dialogs/configdialog/configdialog.h b/examples/dialogs/configdialog/configdialog.h
new file mode 100644
index 0000000..b09771c
--- /dev/null
+++ b/examples/dialogs/configdialog/configdialog.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CONFIGDIALOG_H
+#define CONFIGDIALOG_H
+
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QListWidget;
+class QListWidgetItem;
+class QStackedWidget;
+QT_END_NAMESPACE
+
+class ConfigDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ConfigDialog();
+
+public slots:
+ void changePage(QListWidgetItem *current, QListWidgetItem *previous);
+
+private:
+ void createIcons();
+
+ QListWidget *contentsWidget;
+ QStackedWidget *pagesWidget;
+};
+
+#endif
diff --git a/examples/dialogs/configdialog/configdialog.pro b/examples/dialogs/configdialog/configdialog.pro
new file mode 100644
index 0000000..344a394
--- /dev/null
+++ b/examples/dialogs/configdialog/configdialog.pro
@@ -0,0 +1,14 @@
+HEADERS = configdialog.h \
+ pages.h
+SOURCES = configdialog.cpp \
+ main.cpp \
+ pages.cpp
+RESOURCES += configdialog.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/configdialog
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/configdialog
+INSTALLS += target sources
+wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
+
diff --git a/examples/dialogs/configdialog/configdialog.qrc b/examples/dialogs/configdialog/configdialog.qrc
new file mode 100644
index 0000000..31d0d49
--- /dev/null
+++ b/examples/dialogs/configdialog/configdialog.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/config.png</file>
+ <file>images/query.png</file>
+ <file>images/update.png</file>
+</qresource>
+</RCC>
diff --git a/examples/dialogs/configdialog/images/config.png b/examples/dialogs/configdialog/images/config.png
new file mode 100644
index 0000000..5c14d5f
--- /dev/null
+++ b/examples/dialogs/configdialog/images/config.png
Binary files differ
diff --git a/examples/dialogs/configdialog/images/query.png b/examples/dialogs/configdialog/images/query.png
new file mode 100644
index 0000000..ea9e291
--- /dev/null
+++ b/examples/dialogs/configdialog/images/query.png
Binary files differ
diff --git a/examples/dialogs/configdialog/images/update.png b/examples/dialogs/configdialog/images/update.png
new file mode 100644
index 0000000..3cb8ba6
--- /dev/null
+++ b/examples/dialogs/configdialog/images/update.png
Binary files differ
diff --git a/examples/dialogs/configdialog/main.cpp b/examples/dialogs/configdialog/main.cpp
new file mode 100644
index 0000000..afc5467
--- /dev/null
+++ b/examples/dialogs/configdialog/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "configdialog.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(configdialog);
+
+ QApplication app(argc, argv);
+ ConfigDialog dialog;
+ return dialog.exec();
+}
diff --git a/examples/dialogs/configdialog/pages.cpp b/examples/dialogs/configdialog/pages.cpp
new file mode 100644
index 0000000..27c322a
--- /dev/null
+++ b/examples/dialogs/configdialog/pages.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "pages.h"
+
+ConfigurationPage::ConfigurationPage(QWidget *parent)
+ : QWidget(parent)
+{
+ QGroupBox *configGroup = new QGroupBox(tr("Server configuration"));
+
+ QLabel *serverLabel = new QLabel(tr("Server:"));
+ QComboBox *serverCombo = new QComboBox;
+ serverCombo->addItem(tr("Qt Software (Australia)"));
+ serverCombo->addItem(tr("Qt Software (Germany)"));
+ serverCombo->addItem(tr("Qt Software (Norway)"));
+ serverCombo->addItem(tr("Qt Software (People's Republic of China)"));
+ serverCombo->addItem(tr("Qt Software (USA)"));
+
+ QHBoxLayout *serverLayout = new QHBoxLayout;
+ serverLayout->addWidget(serverLabel);
+ serverLayout->addWidget(serverCombo);
+
+ QVBoxLayout *configLayout = new QVBoxLayout;
+ configLayout->addLayout(serverLayout);
+ configGroup->setLayout(configLayout);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(configGroup);
+ mainLayout->addStretch(1);
+ setLayout(mainLayout);
+}
+
+UpdatePage::UpdatePage(QWidget *parent)
+ : QWidget(parent)
+{
+ QGroupBox *updateGroup = new QGroupBox(tr("Package selection"));
+ QCheckBox *systemCheckBox = new QCheckBox(tr("Update system"));
+ QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications"));
+ QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation"));
+
+ QGroupBox *packageGroup = new QGroupBox(tr("Existing packages"));
+
+ QListWidget *packageList = new QListWidget;
+ QListWidgetItem *qtItem = new QListWidgetItem(packageList);
+ qtItem->setText(tr("Qt"));
+ QListWidgetItem *qsaItem = new QListWidgetItem(packageList);
+ qsaItem->setText(tr("QSA"));
+ QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList);
+ teamBuilderItem->setText(tr("Teambuilder"));
+
+ QPushButton *startUpdateButton = new QPushButton(tr("Start update"));
+
+ QVBoxLayout *updateLayout = new QVBoxLayout;
+ updateLayout->addWidget(systemCheckBox);
+ updateLayout->addWidget(appsCheckBox);
+ updateLayout->addWidget(docsCheckBox);
+ updateGroup->setLayout(updateLayout);
+
+ QVBoxLayout *packageLayout = new QVBoxLayout;
+ packageLayout->addWidget(packageList);
+ packageGroup->setLayout(packageLayout);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(updateGroup);
+ mainLayout->addWidget(packageGroup);
+ mainLayout->addSpacing(12);
+ mainLayout->addWidget(startUpdateButton);
+ mainLayout->addStretch(1);
+ setLayout(mainLayout);
+}
+
+QueryPage::QueryPage(QWidget *parent)
+ : QWidget(parent)
+{
+ QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages"));
+
+ QLabel *nameLabel = new QLabel(tr("Name:"));
+ QLineEdit *nameEdit = new QLineEdit;
+
+ QLabel *dateLabel = new QLabel(tr("Released after:"));
+ QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
+
+ QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases"));
+ QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades"));
+
+ QSpinBox *hitsSpinBox = new QSpinBox;
+ hitsSpinBox->setPrefix(tr("Return up to "));
+ hitsSpinBox->setSuffix(tr(" results"));
+ hitsSpinBox->setSpecialValueText(tr("Return only the first result"));
+ hitsSpinBox->setMinimum(1);
+ hitsSpinBox->setMaximum(100);
+ hitsSpinBox->setSingleStep(10);
+
+ QPushButton *startQueryButton = new QPushButton(tr("Start query"));
+
+ QGridLayout *packagesLayout = new QGridLayout;
+ packagesLayout->addWidget(nameLabel, 0, 0);
+ packagesLayout->addWidget(nameEdit, 0, 1);
+ packagesLayout->addWidget(dateLabel, 1, 0);
+ packagesLayout->addWidget(dateEdit, 1, 1);
+ packagesLayout->addWidget(releasesCheckBox, 2, 0);
+ packagesLayout->addWidget(upgradesCheckBox, 3, 0);
+ packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
+ packagesGroup->setLayout(packagesLayout);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(packagesGroup);
+ mainLayout->addSpacing(12);
+ mainLayout->addWidget(startQueryButton);
+ mainLayout->addStretch(1);
+ setLayout(mainLayout);
+}
diff --git a/examples/dialogs/configdialog/pages.h b/examples/dialogs/configdialog/pages.h
new file mode 100644
index 0000000..534798f
--- /dev/null
+++ b/examples/dialogs/configdialog/pages.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PAGES_H
+#define PAGES_H
+
+#include <QWidget>
+
+class ConfigurationPage : public QWidget
+{
+public:
+ ConfigurationPage(QWidget *parent = 0);
+};
+
+class QueryPage : public QWidget
+{
+public:
+ QueryPage(QWidget *parent = 0);
+};
+
+class UpdatePage : public QWidget
+{
+public:
+ UpdatePage(QWidget *parent = 0);
+};
+
+#endif
diff --git a/examples/dialogs/dialogs.pro b/examples/dialogs/dialogs.pro
new file mode 100644
index 0000000..b9f029a
--- /dev/null
+++ b/examples/dialogs/dialogs.pro
@@ -0,0 +1,17 @@
+TEMPLATE = subdirs
+SUBDIRS = classwizard \
+ configdialog \
+ standarddialogs \
+ tabdialog \
+ trivialwizard
+
+!wince*: SUBDIRS += licensewizard \
+ extension \
+ findfiles
+
+wince*: SUBDIRS += sipdialog
+
+# install
+sources.files = README *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs
+INSTALLS += sources
diff --git a/examples/dialogs/extension/extension.pro b/examples/dialogs/extension/extension.pro
new file mode 100644
index 0000000..3e56cb9
--- /dev/null
+++ b/examples/dialogs/extension/extension.pro
@@ -0,0 +1,9 @@
+HEADERS = finddialog.h
+SOURCES = finddialog.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/extension
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/extension
+INSTALLS += target sources
diff --git a/examples/dialogs/extension/finddialog.cpp b/examples/dialogs/extension/finddialog.cpp
new file mode 100644
index 0000000..80c2868
--- /dev/null
+++ b/examples/dialogs/extension/finddialog.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "finddialog.h"
+
+//! [0]
+FindDialog::FindDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ label = new QLabel(tr("Find &what:"));
+ lineEdit = new QLineEdit;
+ label->setBuddy(lineEdit);
+
+ caseCheckBox = new QCheckBox(tr("Match &case"));
+ fromStartCheckBox = new QCheckBox(tr("Search from &start"));
+ fromStartCheckBox->setChecked(true);
+
+//! [1]
+ findButton = new QPushButton(tr("&Find"));
+ findButton->setDefault(true);
+
+ moreButton = new QPushButton(tr("&More"));
+ moreButton->setCheckable(true);
+//! [0]
+ moreButton->setAutoDefault(false);
+
+ buttonBox = new QDialogButtonBox(Qt::Vertical);
+ buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
+ buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
+//! [1]
+
+//! [2]
+ extension = new QWidget;
+
+ wholeWordsCheckBox = new QCheckBox(tr("&Whole words"));
+ backwardCheckBox = new QCheckBox(tr("Search &backward"));
+ searchSelectionCheckBox = new QCheckBox(tr("Search se&lection"));
+//! [2]
+
+//! [3]
+ connect(moreButton, SIGNAL(toggled(bool)), extension, SLOT(setVisible(bool)));
+
+ QVBoxLayout *extensionLayout = new QVBoxLayout;
+ extensionLayout->setMargin(0);
+ extensionLayout->addWidget(wholeWordsCheckBox);
+ extensionLayout->addWidget(backwardCheckBox);
+ extensionLayout->addWidget(searchSelectionCheckBox);
+ extension->setLayout(extensionLayout);
+//! [3]
+
+//! [4]
+ QHBoxLayout *topLeftLayout = new QHBoxLayout;
+ topLeftLayout->addWidget(label);
+ topLeftLayout->addWidget(lineEdit);
+
+ QVBoxLayout *leftLayout = new QVBoxLayout;
+ leftLayout->addLayout(topLeftLayout);
+ leftLayout->addWidget(caseCheckBox);
+ leftLayout->addWidget(fromStartCheckBox);
+ leftLayout->addStretch(1);
+
+ QGridLayout *mainLayout = new QGridLayout;
+ mainLayout->setSizeConstraint(QLayout::SetFixedSize);
+ mainLayout->addLayout(leftLayout, 0, 0);
+ mainLayout->addWidget(buttonBox, 0, 1);
+ mainLayout->addWidget(extension, 1, 0, 1, 2);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("Extension"));
+//! [4] //! [5]
+ extension->hide();
+}
+//! [5]
diff --git a/examples/dialogs/extension/finddialog.h b/examples/dialogs/extension/finddialog.h
new file mode 100644
index 0000000..4fc7ee5
--- /dev/null
+++ b/examples/dialogs/extension/finddialog.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FINDDIALOG_H
+#define FINDDIALOG_H
+
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QDialogButtonBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+QT_END_NAMESPACE
+
+//! [0]
+class FindDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ FindDialog(QWidget *parent = 0);
+
+private:
+ QLabel *label;
+ QLineEdit *lineEdit;
+ QCheckBox *caseCheckBox;
+ QCheckBox *fromStartCheckBox;
+ QCheckBox *wholeWordsCheckBox;
+ QCheckBox *searchSelectionCheckBox;
+ QCheckBox *backwardCheckBox;
+ QDialogButtonBox *buttonBox;
+ QPushButton *findButton;
+ QPushButton *moreButton;
+ QWidget *extension;
+};
+//! [0]
+
+#endif
diff --git a/examples/dialogs/extension/main.cpp b/examples/dialogs/extension/main.cpp
new file mode 100644
index 0000000..fa70a55
--- /dev/null
+++ b/examples/dialogs/extension/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "finddialog.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ FindDialog dialog;
+ return dialog.exec();
+}
diff --git a/examples/dialogs/findfiles/findfiles.pro b/examples/dialogs/findfiles/findfiles.pro
new file mode 100644
index 0000000..99be394
--- /dev/null
+++ b/examples/dialogs/findfiles/findfiles.pro
@@ -0,0 +1,9 @@
+HEADERS = window.h
+SOURCES = main.cpp \
+ window.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/findfiles
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/findfiles
+INSTALLS += target sources
diff --git a/examples/dialogs/findfiles/main.cpp b/examples/dialogs/findfiles/main.cpp
new file mode 100644
index 0000000..fa8b0ab
--- /dev/null
+++ b/examples/dialogs/findfiles/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "window.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Window window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/dialogs/findfiles/window.cpp b/examples/dialogs/findfiles/window.cpp
new file mode 100644
index 0000000..7620a68
--- /dev/null
+++ b/examples/dialogs/findfiles/window.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "window.h"
+
+//! [0]
+Window::Window(QWidget *parent)
+ : QDialog(parent)
+{
+ browseButton = createButton(tr("&Browse..."), SLOT(browse()));
+ findButton = createButton(tr("&Find"), SLOT(find()));
+
+ fileComboBox = createComboBox(tr("*"));
+ textComboBox = createComboBox();
+ directoryComboBox = createComboBox(QDir::currentPath());
+
+ fileLabel = new QLabel(tr("Named:"));
+ textLabel = new QLabel(tr("Containing text:"));
+ directoryLabel = new QLabel(tr("In directory:"));
+ filesFoundLabel = new QLabel;
+
+ createFilesTable();
+//! [0]
+
+//! [1]
+ QHBoxLayout *buttonsLayout = new QHBoxLayout;
+ buttonsLayout->addStretch();
+ buttonsLayout->addWidget(findButton);
+
+ QGridLayout *mainLayout = new QGridLayout;
+ mainLayout->addWidget(fileLabel, 0, 0);
+ mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
+ mainLayout->addWidget(textLabel, 1, 0);
+ mainLayout->addWidget(textComboBox, 1, 1, 1, 2);
+ mainLayout->addWidget(directoryLabel, 2, 0);
+ mainLayout->addWidget(directoryComboBox, 2, 1);
+ mainLayout->addWidget(browseButton, 2, 2);
+ mainLayout->addWidget(filesTable, 3, 0, 1, 3);
+ mainLayout->addWidget(filesFoundLabel, 4, 0);
+ mainLayout->addLayout(buttonsLayout, 5, 0, 1, 3);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("Find Files"));
+ resize(700, 300);
+}
+//! [1]
+
+//! [2]
+void Window::browse()
+{
+ QString directory = QFileDialog::getExistingDirectory(this,
+ tr("Find Files"), QDir::currentPath());
+
+ if (!directory.isEmpty()) {
+ if (directoryComboBox->findText(directory) == -1)
+ directoryComboBox->addItem(directory);
+ directoryComboBox->setCurrentIndex(directoryComboBox->findText(directory));
+ }
+}
+//! [2]
+
+static void updateComboBox(QComboBox *comboBox)
+{
+ if (comboBox->findText(comboBox->currentText()) == -1)
+ comboBox->addItem(comboBox->currentText());
+}
+
+//! [3]
+void Window::find()
+{
+ filesTable->setRowCount(0);
+
+ QString fileName = fileComboBox->currentText();
+ QString text = textComboBox->currentText();
+ QString path = directoryComboBox->currentText();
+//! [3]
+
+ updateComboBox(fileComboBox);
+ updateComboBox(textComboBox);
+ updateComboBox(directoryComboBox);
+
+//! [4]
+ currentDir = QDir(path);
+ QStringList files;
+ if (fileName.isEmpty())
+ fileName = "*";
+ files = currentDir.entryList(QStringList(fileName),
+ QDir::Files | QDir::NoSymLinks);
+
+ if (!text.isEmpty())
+ files = findFiles(files, text);
+ showFiles(files);
+}
+//! [4]
+
+//! [5]
+QStringList Window::findFiles(const QStringList &files, const QString &text)
+{
+ QProgressDialog progressDialog(this);
+ progressDialog.setCancelButtonText(tr("&Cancel"));
+ progressDialog.setRange(0, files.size());
+ progressDialog.setWindowTitle(tr("Find Files"));
+
+//! [5] //! [6]
+ QStringList foundFiles;
+
+ for (int i = 0; i < files.size(); ++i) {
+ progressDialog.setValue(i);
+ progressDialog.setLabelText(tr("Searching file number %1 of %2...")
+ .arg(i).arg(files.size()));
+ qApp->processEvents();
+//! [6]
+
+ if (progressDialog.wasCanceled())
+ break;
+
+//! [7]
+ QFile file(currentDir.absoluteFilePath(files[i]));
+
+ if (file.open(QIODevice::ReadOnly)) {
+ QString line;
+ QTextStream in(&file);
+ while (!in.atEnd()) {
+ if (progressDialog.wasCanceled())
+ break;
+ line = in.readLine();
+ if (line.contains(text)) {
+ foundFiles << files[i];
+ break;
+ }
+ }
+ }
+ }
+ return foundFiles;
+}
+//! [7]
+
+//! [8]
+void Window::showFiles(const QStringList &files)
+{
+ for (int i = 0; i < files.size(); ++i) {
+ QFile file(currentDir.absoluteFilePath(files[i]));
+ qint64 size = QFileInfo(file).size();
+
+ QTableWidgetItem *fileNameItem = new QTableWidgetItem(files[i]);
+ fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
+ QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB")
+ .arg(int((size + 1023) / 1024)));
+ sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
+ sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);
+
+ int row = filesTable->rowCount();
+ filesTable->insertRow(row);
+ filesTable->setItem(row, 0, fileNameItem);
+ filesTable->setItem(row, 1, sizeItem);
+ }
+ filesFoundLabel->setText(tr("%1 file(s) found").arg(files.size()) +
+ (" (Double click on a file to open it)"));
+}
+//! [8]
+
+//! [9]
+QPushButton *Window::createButton(const QString &text, const char *member)
+{
+ QPushButton *button = new QPushButton(text);
+ connect(button, SIGNAL(clicked()), this, member);
+ return button;
+}
+//! [9]
+
+//! [10]
+QComboBox *Window::createComboBox(const QString &text)
+{
+ QComboBox *comboBox = new QComboBox;
+ comboBox->setEditable(true);
+ comboBox->addItem(text);
+ comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ return comboBox;
+}
+//! [10]
+
+//! [11]
+void Window::createFilesTable()
+{
+ filesTable = new QTableWidget(0, 2);
+ filesTable->setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ QStringList labels;
+ labels << tr("File Name") << tr("Size");
+ filesTable->setHorizontalHeaderLabels(labels);
+ filesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
+ filesTable->verticalHeader()->hide();
+ filesTable->setShowGrid(false);
+
+ connect(filesTable, SIGNAL(cellActivated(int, int)),
+ this, SLOT(openFileOfItem(int, int)));
+}
+//! [11]
+
+//! [12]
+
+void Window::openFileOfItem(int row, int /* column */)
+{
+ QTableWidgetItem *item = filesTable->item(row, 0);
+
+ QDesktopServices::openUrl(currentDir.absoluteFilePath(item->text()));
+}
+
+//! [12]
+
diff --git a/examples/dialogs/findfiles/window.h b/examples/dialogs/findfiles/window.h
new file mode 100644
index 0000000..8cd4813
--- /dev/null
+++ b/examples/dialogs/findfiles/window.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QDialog>
+#include <QDir>
+
+QT_BEGIN_NAMESPACE
+class QComboBox;
+class QLabel;
+class QPushButton;
+class QTableWidget;
+class QTableWidgetItem;
+QT_END_NAMESPACE
+
+//! [0]
+class Window : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Window(QWidget *parent = 0);
+
+private slots:
+ void browse();
+ void find();
+ void openFileOfItem(int row, int column);
+
+private:
+ QStringList findFiles(const QStringList &files, const QString &text);
+ void showFiles(const QStringList &files);
+ QPushButton *createButton(const QString &text, const char *member);
+ QComboBox *createComboBox(const QString &text = QString());
+ void createFilesTable();
+
+ QComboBox *fileComboBox;
+ QComboBox *textComboBox;
+ QComboBox *directoryComboBox;
+ QLabel *fileLabel;
+ QLabel *textLabel;
+ QLabel *directoryLabel;
+ QLabel *filesFoundLabel;
+ QPushButton *browseButton;
+ QPushButton *findButton;
+ QTableWidget *filesTable;
+
+ QDir currentDir;
+};
+//! [0]
+
+#endif
diff --git a/examples/dialogs/licensewizard/images/logo.png b/examples/dialogs/licensewizard/images/logo.png
new file mode 100644
index 0000000..56f17a3
--- /dev/null
+++ b/examples/dialogs/licensewizard/images/logo.png
Binary files differ
diff --git a/examples/dialogs/licensewizard/images/watermark.png b/examples/dialogs/licensewizard/images/watermark.png
new file mode 100644
index 0000000..124a050
--- /dev/null
+++ b/examples/dialogs/licensewizard/images/watermark.png
Binary files differ
diff --git a/examples/dialogs/licensewizard/licensewizard.cpp b/examples/dialogs/licensewizard/licensewizard.cpp
new file mode 100644
index 0000000..30b4165
--- /dev/null
+++ b/examples/dialogs/licensewizard/licensewizard.cpp
@@ -0,0 +1,360 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "licensewizard.h"
+
+//! [0] //! [1] //! [2]
+LicenseWizard::LicenseWizard(QWidget *parent)
+ : QWizard(parent)
+{
+//! [0]
+ setPage(Page_Intro, new IntroPage);
+ setPage(Page_Evaluate, new EvaluatePage);
+ setPage(Page_Register, new RegisterPage);
+ setPage(Page_Details, new DetailsPage);
+ setPage(Page_Conclusion, new ConclusionPage);
+//! [1]
+
+ setStartId(Page_Intro);
+//! [2]
+
+//! [3]
+#ifndef Q_WS_MAC
+//! [3] //! [4]
+ setWizardStyle(ModernStyle);
+#endif
+//! [4] //! [5]
+ setOption(HaveHelpButton, true);
+//! [5] //! [6]
+ setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo.png"));
+
+//! [7]
+ connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
+//! [7]
+
+ setWindowTitle(tr("License Wizard"));
+//! [8]
+}
+//! [6] //! [8]
+
+//! [9] //! [10]
+void LicenseWizard::showHelp()
+//! [9] //! [11]
+{
+ static QString lastHelpMessage;
+
+ QString message;
+
+ switch (currentId()) {
+ case Page_Intro:
+ message = tr("The decision you make here will affect which page you "
+ "get to see next.");
+ break;
+//! [10] //! [11]
+ case Page_Evaluate:
+ message = tr("Make sure to provide a valid email address, such as "
+ "toni.buddenbrook@example.de.");
+ break;
+ case Page_Register:
+ message = tr("If you don't provide an upgrade key, you will be "
+ "asked to fill in your details.");
+ break;
+ case Page_Details:
+ message = tr("Make sure to provide a valid email address, such as "
+ "thomas.gradgrind@example.co.uk.");
+ break;
+ case Page_Conclusion:
+ message = tr("You must accept the terms and conditions of the "
+ "license to proceed.");
+ break;
+//! [12] //! [13]
+ default:
+ message = tr("This help is likely not to be of any help.");
+ }
+//! [12]
+
+ if (lastHelpMessage == message)
+ message = tr("Sorry, I already gave what help I could. "
+ "Maybe you should try asking a human?");
+
+//! [14]
+ QMessageBox::information(this, tr("License Wizard Help"), message);
+//! [14]
+
+ lastHelpMessage = message;
+//! [15]
+}
+//! [13] //! [15]
+
+//! [16]
+IntroPage::IntroPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Introduction"));
+ setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png"));
+
+ topLabel = new QLabel(tr("This wizard will help you register your copy of "
+ "<i>Super Product One</i>&trade; or start "
+ "evaluating the product."));
+ topLabel->setWordWrap(true);
+
+ registerRadioButton = new QRadioButton(tr("&Register your copy"));
+ evaluateRadioButton = new QRadioButton(tr("&Evaluate the product for 30 "
+ "days"));
+ registerRadioButton->setChecked(true);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(topLabel);
+ layout->addWidget(registerRadioButton);
+ layout->addWidget(evaluateRadioButton);
+ setLayout(layout);
+}
+//! [16] //! [17]
+
+//! [18]
+int IntroPage::nextId() const
+//! [17] //! [19]
+{
+ if (evaluateRadioButton->isChecked()) {
+ return LicenseWizard::Page_Evaluate;
+ } else {
+ return LicenseWizard::Page_Register;
+ }
+}
+//! [18] //! [19]
+
+//! [20]
+EvaluatePage::EvaluatePage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Evaluate <i>Super Product One</i>&trade;"));
+ setSubTitle(tr("Please fill both fields. Make sure to provide a valid "
+ "email address (e.g., john.smith@example.com)."));
+
+ nameLabel = new QLabel(tr("N&ame:"));
+ nameLineEdit = new QLineEdit;
+//! [20]
+ nameLabel->setBuddy(nameLineEdit);
+
+ emailLabel = new QLabel(tr("&Email address:"));
+ emailLineEdit = new QLineEdit;
+ emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this));
+ emailLabel->setBuddy(emailLineEdit);
+
+//! [21]
+ registerField("evaluate.name*", nameLineEdit);
+ registerField("evaluate.email*", emailLineEdit);
+//! [21]
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(nameLabel, 0, 0);
+ layout->addWidget(nameLineEdit, 0, 1);
+ layout->addWidget(emailLabel, 1, 0);
+ layout->addWidget(emailLineEdit, 1, 1);
+ setLayout(layout);
+//! [22]
+}
+//! [22]
+
+//! [23]
+int EvaluatePage::nextId() const
+{
+ return LicenseWizard::Page_Conclusion;
+}
+//! [23]
+
+RegisterPage::RegisterPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Register Your Copy of <i>Super Product One</i>&trade;"));
+ setSubTitle(tr("If you have an upgrade key, please fill in "
+ "the appropriate field."));
+
+ nameLabel = new QLabel(tr("N&ame:"));
+ nameLineEdit = new QLineEdit;
+ nameLabel->setBuddy(nameLineEdit);
+
+ upgradeKeyLabel = new QLabel(tr("&Upgrade key:"));
+ upgradeKeyLineEdit = new QLineEdit;
+ upgradeKeyLabel->setBuddy(upgradeKeyLineEdit);
+
+ registerField("register.name*", nameLineEdit);
+ registerField("register.upgradeKey", upgradeKeyLineEdit);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(nameLabel, 0, 0);
+ layout->addWidget(nameLineEdit, 0, 1);
+ layout->addWidget(upgradeKeyLabel, 1, 0);
+ layout->addWidget(upgradeKeyLineEdit, 1, 1);
+ setLayout(layout);
+}
+
+//! [24]
+int RegisterPage::nextId() const
+{
+ if (upgradeKeyLineEdit->text().isEmpty()) {
+ return LicenseWizard::Page_Details;
+ } else {
+ return LicenseWizard::Page_Conclusion;
+ }
+}
+//! [24]
+
+DetailsPage::DetailsPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Fill In Your Details"));
+ setSubTitle(tr("Please fill all three fields. Make sure to provide a valid "
+ "email address (e.g., tanaka.aya@example.co.jp)."));
+
+ companyLabel = new QLabel(tr("&Company name:"));
+ companyLineEdit = new QLineEdit;
+ companyLabel->setBuddy(companyLineEdit);
+
+ emailLabel = new QLabel(tr("&Email address:"));
+ emailLineEdit = new QLineEdit;
+ emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this));
+ emailLabel->setBuddy(emailLineEdit);
+
+ postalLabel = new QLabel(tr("&Postal address:"));
+ postalLineEdit = new QLineEdit;
+ postalLabel->setBuddy(postalLineEdit);
+
+ registerField("details.company*", companyLineEdit);
+ registerField("details.email*", emailLineEdit);
+ registerField("details.postal*", postalLineEdit);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(companyLabel, 0, 0);
+ layout->addWidget(companyLineEdit, 0, 1);
+ layout->addWidget(emailLabel, 1, 0);
+ layout->addWidget(emailLineEdit, 1, 1);
+ layout->addWidget(postalLabel, 2, 0);
+ layout->addWidget(postalLineEdit, 2, 1);
+ setLayout(layout);
+}
+
+//! [25]
+int DetailsPage::nextId() const
+{
+ return LicenseWizard::Page_Conclusion;
+}
+//! [25]
+
+ConclusionPage::ConclusionPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Complete Your Registration"));
+ setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png"));
+
+ bottomLabel = new QLabel;
+ bottomLabel->setWordWrap(true);
+
+ agreeCheckBox = new QCheckBox(tr("I agree to the terms of the license"));
+
+ registerField("conclusion.agree*", agreeCheckBox);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(bottomLabel);
+ layout->addWidget(agreeCheckBox);
+ setLayout(layout);
+}
+
+//! [26]
+int ConclusionPage::nextId() const
+{
+ return -1;
+}
+//! [26]
+
+//! [27]
+void ConclusionPage::initializePage()
+{
+ QString licenseText;
+
+ if (wizard()->hasVisitedPage(LicenseWizard::Page_Evaluate)) {
+ licenseText = tr("<u>Evaluation License Agreement:</u> "
+ "You can use this software for 30 days and make one "
+ "backup, but you are not allowed to distribute it.");
+ } else if (wizard()->hasVisitedPage(LicenseWizard::Page_Details)) {
+ licenseText = tr("<u>First-Time License Agreement:</u> "
+ "You can use this software subject to the license "
+ "you will receive by email.");
+ } else {
+ licenseText = tr("<u>Upgrade License Agreement:</u> "
+ "This software is licensed under the terms of your "
+ "current license.");
+ }
+ bottomLabel->setText(licenseText);
+}
+//! [27]
+
+//! [28]
+void ConclusionPage::setVisible(bool visible)
+{
+ QWizardPage::setVisible(visible);
+
+ if (visible) {
+//! [29]
+ wizard()->setButtonText(QWizard::CustomButton1, tr("&Print"));
+ wizard()->setOption(QWizard::HaveCustomButton1, true);
+ connect(wizard(), SIGNAL(customButtonClicked(int)),
+ this, SLOT(printButtonClicked()));
+//! [29]
+ } else {
+ wizard()->setOption(QWizard::HaveCustomButton1, false);
+ disconnect(wizard(), SIGNAL(customButtonClicked(int)),
+ this, SLOT(printButtonClicked()));
+ }
+}
+//! [28]
+
+void ConclusionPage::printButtonClicked()
+{
+ QPrinter printer;
+ QPrintDialog dialog(&printer, this);
+ if (dialog.exec())
+ QMessageBox::warning(this, tr("Print License"),
+ tr("As an environmentally friendly measure, the "
+ "license text will not actually be printed."));
+}
diff --git a/examples/dialogs/licensewizard/licensewizard.h b/examples/dialogs/licensewizard/licensewizard.h
new file mode 100644
index 0000000..bcf22a2
--- /dev/null
+++ b/examples/dialogs/licensewizard/licensewizard.h
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef LICENSEWIZARD_H
+#define LICENSEWIZARD_H
+
+#include <QWizard>
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+class QRadioButton;
+QT_END_NAMESPACE
+
+//! [0] //! [1]
+class LicenseWizard : public QWizard
+{
+//! [0]
+ Q_OBJECT
+
+public:
+//! [2]
+ enum { Page_Intro, Page_Evaluate, Page_Register, Page_Details,
+ Page_Conclusion };
+//! [2]
+
+ LicenseWizard(QWidget *parent = 0);
+
+private slots:
+ void showHelp();
+//! [3]
+};
+//! [1] //! [3]
+
+//! [4]
+class IntroPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ IntroPage(QWidget *parent = 0);
+
+ int nextId() const;
+
+private:
+ QLabel *topLabel;
+ QRadioButton *registerRadioButton;
+ QRadioButton *evaluateRadioButton;
+};
+//! [4]
+
+//! [5]
+class EvaluatePage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ EvaluatePage(QWidget *parent = 0);
+
+ int nextId() const;
+
+private:
+ QLabel *nameLabel;
+ QLabel *emailLabel;
+ QLineEdit *nameLineEdit;
+ QLineEdit *emailLineEdit;
+};
+//! [5]
+
+class RegisterPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ RegisterPage(QWidget *parent = 0);
+
+ int nextId() const;
+
+private:
+ QLabel *nameLabel;
+ QLabel *upgradeKeyLabel;
+ QLineEdit *nameLineEdit;
+ QLineEdit *upgradeKeyLineEdit;
+};
+
+class DetailsPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ DetailsPage(QWidget *parent = 0);
+
+ int nextId() const;
+
+private:
+ QLabel *companyLabel;
+ QLabel *emailLabel;
+ QLabel *postalLabel;
+ QLineEdit *companyLineEdit;
+ QLineEdit *emailLineEdit;
+ QLineEdit *postalLineEdit;
+};
+
+//! [6]
+class ConclusionPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ ConclusionPage(QWidget *parent = 0);
+
+ void initializePage();
+ int nextId() const;
+ void setVisible(bool visible);
+
+private slots:
+ void printButtonClicked();
+
+private:
+ QLabel *bottomLabel;
+ QCheckBox *agreeCheckBox;
+};
+//! [6]
+
+#endif
diff --git a/examples/dialogs/licensewizard/licensewizard.pro b/examples/dialogs/licensewizard/licensewizard.pro
new file mode 100644
index 0000000..fd5e37c
--- /dev/null
+++ b/examples/dialogs/licensewizard/licensewizard.pro
@@ -0,0 +1,10 @@
+HEADERS = licensewizard.h
+SOURCES = licensewizard.cpp \
+ main.cpp
+RESOURCES = licensewizard.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/licensewizard
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/licensewizard
+INSTALLS += target sources
diff --git a/examples/dialogs/licensewizard/licensewizard.qrc b/examples/dialogs/licensewizard/licensewizard.qrc
new file mode 100644
index 0000000..b069938
--- /dev/null
+++ b/examples/dialogs/licensewizard/licensewizard.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/logo.png</file>
+ <file>images/watermark.png</file>
+</qresource>
+</RCC>
diff --git a/examples/dialogs/licensewizard/main.cpp b/examples/dialogs/licensewizard/main.cpp
new file mode 100644
index 0000000..9d10032
--- /dev/null
+++ b/examples/dialogs/licensewizard/main.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+
+#include "licensewizard.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(licensewizard);
+
+ QApplication app(argc, argv);
+
+ QString translatorFileName = QLatin1String("qt_");
+ translatorFileName += QLocale::system().name();
+ QTranslator *translator = new QTranslator(&app);
+ if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ app.installTranslator(translator);
+
+ LicenseWizard wizard;
+ wizard.show();
+ return app.exec();
+}
diff --git a/examples/dialogs/sipdialog/dialog.cpp b/examples/dialogs/sipdialog/dialog.cpp
new file mode 100644
index 0000000..9f1b9ad
--- /dev/null
+++ b/examples/dialogs/sipdialog/dialog.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "dialog.h"
+
+//! [Dialog constructor part1]
+Dialog::Dialog()
+{
+ desktopGeometry = QApplication::desktop()->availableGeometry(0);
+
+ setWindowTitle(tr("SIP Dialog Example"));
+ QScrollArea *scrollArea = new QScrollArea(this);
+ QGroupBox *groupBox = new QGroupBox(scrollArea);
+ groupBox->setTitle(tr("SIP Dialog Example"));
+ QGridLayout *gridLayout = new QGridLayout(groupBox);
+ groupBox->setLayout(gridLayout);
+//! [Dialog constructor part1]
+
+//! [Dialog constructor part2]
+ QLineEdit* lineEdit = new QLineEdit(groupBox);
+ lineEdit->setText(tr("Open and close the SIP"));
+ lineEdit->setMinimumWidth(220);
+
+ QLabel* label = new QLabel(groupBox);
+ label->setText(tr("This dialog resizes if the SIP is opened"));
+ label->setMinimumWidth(220);
+
+ QPushButton* button = new QPushButton(groupBox);
+ button->setText(tr("Close Dialog"));
+ button->setMinimumWidth(220);
+//! [Dialog constructor part2]
+
+//! [Dialog constructor part3]
+ if (desktopGeometry.height() < 400)
+ gridLayout->setVerticalSpacing(80);
+ else
+ gridLayout->setVerticalSpacing(150);
+
+ gridLayout->addWidget(label);
+ gridLayout->addWidget(lineEdit);
+ gridLayout->addWidget(button);
+//! [Dialog constructor part3]
+
+//! [Dialog constructor part4]
+ scrollArea->setWidget(groupBox);
+ QHBoxLayout* layout = new QHBoxLayout();
+ layout->addWidget(scrollArea);
+ setLayout(layout);
+ scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+//! [Dialog constructor part4]
+
+//! [Dialog constructor part5]
+ connect(button, SIGNAL(pressed()),
+ qApp, SLOT(closeAllWindows()));
+ connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
+ this, SLOT(desktopResized(int)));
+}
+//! [Dialog constructor part5]
+
+//! [desktopResized() function]
+void Dialog::desktopResized(int screen)
+{
+ if (screen != 0)
+ return;
+ reactToSIP();
+}
+//! [desktopResized() function]
+
+//! [reactToSIP() function]
+void Dialog::reactToSIP()
+{
+ QRect availableGeometry = QApplication::desktop()->availableGeometry(0);
+
+ if (desktopGeometry.width() == availableGeometry.width()) {
+ if (desktopGeometry.height() > availableGeometry.height()) {
+ setWindowState(windowState() & ~Qt::WindowMaximized);
+ setGeometry(availableGeometry);
+ } else {
+ setWindowState(windowState() | Qt::WindowMaximized);
+ }
+ }
+ desktopGeometry = availableGeometry;
+}
+//! [reactToSIP() function]
diff --git a/examples/dialogs/sipdialog/dialog.h b/examples/dialogs/sipdialog/dialog.h
new file mode 100644
index 0000000..ffcc926
--- /dev/null
+++ b/examples/dialogs/sipdialog/dialog.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIALOG_H
+#define DIALOG_H
+
+#include <QDialog>
+
+//! [Dialog header]
+class Dialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Dialog();
+ void reactToSIP();
+
+private:
+ QRect desktopGeometry;
+
+public slots:
+ void desktopResized(int screen);
+};
+//! [Dialog header]
+
+#endif
diff --git a/examples/dialogs/sipdialog/main.cpp b/examples/dialogs/sipdialog/main.cpp
new file mode 100644
index 0000000..5fcbfd8
--- /dev/null
+++ b/examples/dialogs/sipdialog/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "dialog.h"
+
+//! [main() function]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Dialog dialog;
+ dialog.exec();
+}
+//! [main() function]
diff --git a/examples/dialogs/sipdialog/sipdialog.pro b/examples/dialogs/sipdialog/sipdialog.pro
new file mode 100644
index 0000000..69667eb
--- /dev/null
+++ b/examples/dialogs/sipdialog/sipdialog.pro
@@ -0,0 +1,12 @@
+HEADERS = dialog.h
+SOURCES = main.cpp \
+ dialog.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/sipdialog
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/sipdialog
+INSTALLS += target sources
+wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
+
+
diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp
new file mode 100644
index 0000000..0fe1f7e
--- /dev/null
+++ b/examples/dialogs/standarddialogs/dialog.cpp
@@ -0,0 +1,390 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "dialog.h"
+
+#define MESSAGE \
+ Dialog::tr("<p>Message boxes have a caption, a text, " \
+ "and any number of buttons, each with standard or custom texts." \
+ "<p>Click a button to close the message box. Pressing the Esc button " \
+ "will activate the detected escape button (if any).")
+
+Dialog::Dialog(QWidget *parent)
+ : QDialog(parent)
+{
+ errorMessageDialog = new QErrorMessage(this);
+
+ int frameStyle = QFrame::Sunken | QFrame::Panel;
+
+ integerLabel = new QLabel;
+ integerLabel->setFrameStyle(frameStyle);
+ QPushButton *integerButton =
+ new QPushButton(tr("QInputDialog::get&Integer()"));
+
+ doubleLabel = new QLabel;
+ doubleLabel->setFrameStyle(frameStyle);
+ QPushButton *doubleButton =
+ new QPushButton(tr("QInputDialog::get&Double()"));
+
+ itemLabel = new QLabel;
+ itemLabel->setFrameStyle(frameStyle);
+ QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));
+
+ textLabel = new QLabel;
+ textLabel->setFrameStyle(frameStyle);
+ QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));
+
+ colorLabel = new QLabel;
+ colorLabel->setFrameStyle(frameStyle);
+ QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));
+
+ fontLabel = new QLabel;
+ fontLabel->setFrameStyle(frameStyle);
+ QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));
+
+ directoryLabel = new QLabel;
+ directoryLabel->setFrameStyle(frameStyle);
+ QPushButton *directoryButton =
+ new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));
+
+ openFileNameLabel = new QLabel;
+ openFileNameLabel->setFrameStyle(frameStyle);
+ QPushButton *openFileNameButton =
+ new QPushButton(tr("QFileDialog::get&OpenFileName()"));
+
+ openFileNamesLabel = new QLabel;
+ openFileNamesLabel->setFrameStyle(frameStyle);
+ QPushButton *openFileNamesButton =
+ new QPushButton(tr("QFileDialog::&getOpenFileNames()"));
+
+ saveFileNameLabel = new QLabel;
+ saveFileNameLabel->setFrameStyle(frameStyle);
+ QPushButton *saveFileNameButton =
+ new QPushButton(tr("QFileDialog::get&SaveFileName()"));
+
+ criticalLabel = new QLabel;
+ criticalLabel->setFrameStyle(frameStyle);
+ QPushButton *criticalButton =
+ new QPushButton(tr("QMessageBox::critica&l()"));
+
+ informationLabel = new QLabel;
+ informationLabel->setFrameStyle(frameStyle);
+ QPushButton *informationButton =
+ new QPushButton(tr("QMessageBox::i&nformation()"));
+
+ questionLabel = new QLabel;
+ questionLabel->setFrameStyle(frameStyle);
+ QPushButton *questionButton =
+ new QPushButton(tr("QMessageBox::&question()"));
+
+ warningLabel = new QLabel;
+ warningLabel->setFrameStyle(frameStyle);
+ QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));
+
+ errorLabel = new QLabel;
+ errorLabel->setFrameStyle(frameStyle);
+ QPushButton *errorButton =
+ new QPushButton(tr("QErrorMessage::show&M&essage()"));
+
+ connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
+ connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
+ connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
+ connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
+ connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
+ connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
+ connect(directoryButton, SIGNAL(clicked()),
+ this, SLOT(setExistingDirectory()));
+ connect(openFileNameButton, SIGNAL(clicked()),
+ this, SLOT(setOpenFileName()));
+ connect(openFileNamesButton, SIGNAL(clicked()),
+ this, SLOT(setOpenFileNames()));
+ connect(saveFileNameButton, SIGNAL(clicked()),
+ this, SLOT(setSaveFileName()));
+ connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
+ connect(informationButton, SIGNAL(clicked()),
+ this, SLOT(informationMessage()));
+ connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
+ connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
+ connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));
+
+ native = new QCheckBox(this);
+ native->setText("Use native file dialog.");
+ native->setChecked(true);
+#ifndef Q_WS_WIN
+#ifndef Q_OS_MAC
+ native->hide();
+#endif
+#endif
+ QGridLayout *layout = new QGridLayout;
+ layout->setColumnStretch(1, 1);
+ layout->setColumnMinimumWidth(1, 250);
+ layout->addWidget(integerButton, 0, 0);
+ layout->addWidget(integerLabel, 0, 1);
+ layout->addWidget(doubleButton, 1, 0);
+ layout->addWidget(doubleLabel, 1, 1);
+ layout->addWidget(itemButton, 2, 0);
+ layout->addWidget(itemLabel, 2, 1);
+ layout->addWidget(textButton, 3, 0);
+ layout->addWidget(textLabel, 3, 1);
+ layout->addWidget(colorButton, 4, 0);
+ layout->addWidget(colorLabel, 4, 1);
+ layout->addWidget(fontButton, 5, 0);
+ layout->addWidget(fontLabel, 5, 1);
+ layout->addWidget(directoryButton, 6, 0);
+ layout->addWidget(directoryLabel, 6, 1);
+ layout->addWidget(openFileNameButton, 7, 0);
+ layout->addWidget(openFileNameLabel, 7, 1);
+ layout->addWidget(openFileNamesButton, 8, 0);
+ layout->addWidget(openFileNamesLabel, 8, 1);
+ layout->addWidget(saveFileNameButton, 9, 0);
+ layout->addWidget(saveFileNameLabel, 9, 1);
+ layout->addWidget(criticalButton, 10, 0);
+ layout->addWidget(criticalLabel, 10, 1);
+ layout->addWidget(informationButton, 11, 0);
+ layout->addWidget(informationLabel, 11, 1);
+ layout->addWidget(questionButton, 12, 0);
+ layout->addWidget(questionLabel, 12, 1);
+ layout->addWidget(warningButton, 13, 0);
+ layout->addWidget(warningLabel, 13, 1);
+ layout->addWidget(errorButton, 14, 0);
+ layout->addWidget(errorLabel, 14, 1);
+ layout->addWidget(native, 15, 0);
+ setLayout(layout);
+
+ setWindowTitle(tr("Standard Dialogs"));
+}
+
+void Dialog::setInteger()
+{
+//! [0]
+ bool ok;
+ int i = QInputDialog::getInteger(this, tr("QInputDialog::getInteger()"),
+ tr("Percentage:"), 25, 0, 100, 1, &ok);
+ if (ok)
+ integerLabel->setText(tr("%1%").arg(i));
+//! [0]
+}
+
+void Dialog::setDouble()
+{
+//! [1]
+ bool ok;
+ double d = QInputDialog::getDouble(this, tr("QInputDialog::getDouble()"),
+ tr("Amount:"), 37.56, -10000, 10000, 2, &ok);
+ if (ok)
+ doubleLabel->setText(QString("$%1").arg(d));
+//! [1]
+}
+
+void Dialog::setItem()
+{
+//! [2]
+ QStringList items;
+ items << tr("Spring") << tr("Summer") << tr("Fall") << tr("Winter");
+
+ bool ok;
+ QString item = QInputDialog::getItem(this, tr("QInputDialog::getItem()"),
+ tr("Season:"), items, 0, false, &ok);
+ if (ok && !item.isEmpty())
+ itemLabel->setText(item);
+//! [2]
+}
+
+void Dialog::setText()
+{
+//! [3]
+ bool ok;
+ QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
+ tr("User name:"), QLineEdit::Normal,
+ QDir::home().dirName(), &ok);
+ if (ok && !text.isEmpty())
+ textLabel->setText(text);
+//! [3]
+}
+
+void Dialog::setColor()
+{
+ QColor color = QColorDialog::getColor(Qt::green, this);
+ if (color.isValid()) {
+ colorLabel->setText(color.name());
+ colorLabel->setPalette(QPalette(color));
+ colorLabel->setAutoFillBackground(true);
+ }
+}
+
+void Dialog::setFont()
+{
+ bool ok;
+ QFont font = QFontDialog::getFont(&ok, QFont(fontLabel->text()), this);
+ if (ok) {
+ fontLabel->setText(font.key());
+ fontLabel->setFont(font);
+ }
+}
+
+void Dialog::setExistingDirectory()
+{
+ QFileDialog::Options options = QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly;
+ if (!native->isChecked())
+ options |= QFileDialog::DontUseNativeDialog;
+ QString directory = QFileDialog::getExistingDirectory(this,
+ tr("QFileDialog::getExistingDirectory()"),
+ directoryLabel->text(),
+ options);
+ if (!directory.isEmpty())
+ directoryLabel->setText(directory);
+}
+
+void Dialog::setOpenFileName()
+{
+ QFileDialog::Options options;
+ if (!native->isChecked())
+ options |= QFileDialog::DontUseNativeDialog;
+ QString selectedFilter;
+ QString fileName = QFileDialog::getOpenFileName(this,
+ tr("QFileDialog::getOpenFileName()"),
+ openFileNameLabel->text(),
+ tr("All Files (*);;Text Files (*.txt)"),
+ &selectedFilter,
+ options);
+ if (!fileName.isEmpty())
+ openFileNameLabel->setText(fileName);
+}
+
+void Dialog::setOpenFileNames()
+{
+ QFileDialog::Options options;
+ if (!native->isChecked())
+ options |= QFileDialog::DontUseNativeDialog;
+ QString selectedFilter;
+ QStringList files = QFileDialog::getOpenFileNames(
+ this, tr("QFileDialog::getOpenFileNames()"),
+ openFilesPath,
+ tr("All Files (*);;Text Files (*.txt)"),
+ &selectedFilter,
+ options);
+ if (files.count()) {
+ openFilesPath = files[0];
+ openFileNamesLabel->setText(QString("[%1]").arg(files.join(", ")));
+ }
+}
+
+void Dialog::setSaveFileName()
+{
+ QFileDialog::Options options;
+ if (!native->isChecked())
+ options |= QFileDialog::DontUseNativeDialog;
+ QString selectedFilter;
+ QString fileName = QFileDialog::getSaveFileName(this,
+ tr("QFileDialog::getSaveFileName()"),
+ saveFileNameLabel->text(),
+ tr("All Files (*);;Text Files (*.txt)"),
+ &selectedFilter,
+ options);
+ if (!fileName.isEmpty())
+ saveFileNameLabel->setText(fileName);
+}
+
+void Dialog::criticalMessage()
+{
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::critical(this, tr("QMessageBox::critical()"),
+ MESSAGE,
+ QMessageBox::Abort | QMessageBox::Retry | QMessageBox::Ignore);
+ if (reply == QMessageBox::Abort)
+ criticalLabel->setText(tr("Abort"));
+ else if (reply == QMessageBox::Retry)
+ criticalLabel->setText(tr("Retry"));
+ else
+ criticalLabel->setText(tr("Ignore"));
+}
+
+void Dialog::informationMessage()
+{
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::information(this, tr("QMessageBox::information()"), MESSAGE);
+ if (reply == QMessageBox::Ok)
+ informationLabel->setText(tr("OK"));
+ else
+ informationLabel->setText(tr("Escape"));
+}
+
+void Dialog::questionMessage()
+{
+ QMessageBox::StandardButton reply;
+ reply = QMessageBox::question(this, tr("QMessageBox::question()"),
+ MESSAGE,
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+ if (reply == QMessageBox::Yes)
+ questionLabel->setText(tr("Yes"));
+ else if (reply == QMessageBox::No)
+ questionLabel->setText(tr("No"));
+ else
+ questionLabel->setText(tr("Cancel"));
+}
+
+void Dialog::warningMessage()
+{
+ QMessageBox msgBox(QMessageBox::Warning, tr("QMessageBox::warning()"),
+ MESSAGE, 0, this);
+ msgBox.addButton(tr("Save &Again"), QMessageBox::AcceptRole);
+ msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
+ if (msgBox.exec() == QMessageBox::AcceptRole)
+ warningLabel->setText(tr("Save Again"));
+ else
+ warningLabel->setText(tr("Continue"));
+
+}
+
+void Dialog::errorMessage()
+{
+ errorMessageDialog->showMessage(
+ tr("This dialog shows and remembers error messages. "
+ "If the checkbox is checked (as it is by default), "
+ "the shown message will be shown again, "
+ "but if the user unchecks the box the message "
+ "will not appear again if QErrorMessage::showMessage() "
+ "is called with the same message."));
+ errorLabel->setText(tr("If the box is unchecked, the message "
+ "won't appear again."));
+}
diff --git a/examples/dialogs/standarddialogs/dialog.h b/examples/dialogs/standarddialogs/dialog.h
new file mode 100644
index 0000000..35f0b05
--- /dev/null
+++ b/examples/dialogs/standarddialogs/dialog.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIALOG_H
+#define DIALOG_H
+
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QCheckBox;
+class QLabel;
+class QErrorMessage;
+QT_END_NAMESPACE
+
+class Dialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Dialog(QWidget *parent = 0);
+
+private slots:
+ void setInteger();
+ void setDouble();
+ void setItem();
+ void setText();
+ void setColor();
+ void setFont();
+ void setExistingDirectory();
+ void setOpenFileName();
+ void setOpenFileNames();
+ void setSaveFileName();
+ void criticalMessage();
+ void informationMessage();
+ void questionMessage();
+ void warningMessage();
+ void errorMessage();
+
+private:
+ QCheckBox *native;
+ QLabel *integerLabel;
+ QLabel *doubleLabel;
+ QLabel *itemLabel;
+ QLabel *textLabel;
+ QLabel *colorLabel;
+ QLabel *fontLabel;
+ QLabel *directoryLabel;
+ QLabel *openFileNameLabel;
+ QLabel *openFileNamesLabel;
+ QLabel *saveFileNameLabel;
+ QLabel *criticalLabel;
+ QLabel *informationLabel;
+ QLabel *questionLabel;
+ QLabel *warningLabel;
+ QLabel *errorLabel;
+ QErrorMessage *errorMessageDialog;
+
+ QString openFilesPath;
+};
+
+#endif
diff --git a/examples/dialogs/standarddialogs/main.cpp b/examples/dialogs/standarddialogs/main.cpp
new file mode 100644
index 0000000..3b7ed8b
--- /dev/null
+++ b/examples/dialogs/standarddialogs/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+
+#include "dialog.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ QString translatorFileName = QLatin1String("qt_");
+ translatorFileName += QLocale::system().name();
+ QTranslator *translator = new QTranslator(&app);
+ if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ app.installTranslator(translator);
+
+ Dialog dialog;
+ return dialog.exec();
+}
diff --git a/examples/dialogs/standarddialogs/standarddialogs.pro b/examples/dialogs/standarddialogs/standarddialogs.pro
new file mode 100644
index 0000000..6bfa6bf
--- /dev/null
+++ b/examples/dialogs/standarddialogs/standarddialogs.pro
@@ -0,0 +1,11 @@
+HEADERS = dialog.h
+SOURCES = dialog.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/standarddialogs
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/standarddialogs
+INSTALLS += target sources
+wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
+
diff --git a/examples/dialogs/tabdialog/main.cpp b/examples/dialogs/tabdialog/main.cpp
new file mode 100644
index 0000000..04f3b33
--- /dev/null
+++ b/examples/dialogs/tabdialog/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "tabdialog.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QString fileName;
+
+ if (argc >= 2)
+ fileName = argv[1];
+ else
+ fileName = ".";
+
+ TabDialog tabdialog(fileName);
+ return tabdialog.exec();
+}
diff --git a/examples/dialogs/tabdialog/tabdialog.cpp b/examples/dialogs/tabdialog/tabdialog.cpp
new file mode 100644
index 0000000..189d085
--- /dev/null
+++ b/examples/dialogs/tabdialog/tabdialog.cpp
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "tabdialog.h"
+
+//! [0]
+TabDialog::TabDialog(const QString &fileName, QWidget *parent)
+ : QDialog(parent)
+{
+ QFileInfo fileInfo(fileName);
+
+ tabWidget = new QTabWidget;
+ tabWidget->addTab(new GeneralTab(fileInfo), tr("General"));
+ tabWidget->addTab(new PermissionsTab(fileInfo), tr("Permissions"));
+ tabWidget->addTab(new ApplicationsTab(fileInfo), tr("Applications"));
+//! [0]
+
+//! [1] //! [2]
+ buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
+//! [1] //! [3]
+ | QDialogButtonBox::Cancel);
+
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+//! [2] //! [3]
+
+//! [4]
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(tabWidget);
+ mainLayout->addWidget(buttonBox);
+ setLayout(mainLayout);
+//! [4]
+
+//! [5]
+ setWindowTitle(tr("Tab Dialog"));
+}
+//! [5]
+
+//! [6]
+GeneralTab::GeneralTab(const QFileInfo &fileInfo, QWidget *parent)
+ : QWidget(parent)
+{
+ QLabel *fileNameLabel = new QLabel(tr("File Name:"));
+ QLineEdit *fileNameEdit = new QLineEdit(fileInfo.fileName());
+
+ QLabel *pathLabel = new QLabel(tr("Path:"));
+ QLabel *pathValueLabel = new QLabel(fileInfo.absoluteFilePath());
+ pathValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+
+ QLabel *sizeLabel = new QLabel(tr("Size:"));
+ qlonglong size = fileInfo.size()/1024;
+ QLabel *sizeValueLabel = new QLabel(tr("%1 K").arg(size));
+ sizeValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+
+ QLabel *lastReadLabel = new QLabel(tr("Last Read:"));
+ QLabel *lastReadValueLabel = new QLabel(fileInfo.lastRead().toString());
+ lastReadValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+
+ QLabel *lastModLabel = new QLabel(tr("Last Modified:"));
+ QLabel *lastModValueLabel = new QLabel(fileInfo.lastModified().toString());
+ lastModValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(fileNameLabel);
+ mainLayout->addWidget(fileNameEdit);
+ mainLayout->addWidget(pathLabel);
+ mainLayout->addWidget(pathValueLabel);
+ mainLayout->addWidget(sizeLabel);
+ mainLayout->addWidget(sizeValueLabel);
+ mainLayout->addWidget(lastReadLabel);
+ mainLayout->addWidget(lastReadValueLabel);
+ mainLayout->addWidget(lastModLabel);
+ mainLayout->addWidget(lastModValueLabel);
+ mainLayout->addStretch(1);
+ setLayout(mainLayout);
+}
+//! [6]
+
+//! [7]
+PermissionsTab::PermissionsTab(const QFileInfo &fileInfo, QWidget *parent)
+ : QWidget(parent)
+{
+ QGroupBox *permissionsGroup = new QGroupBox(tr("Permissions"));
+
+ QCheckBox *readable = new QCheckBox(tr("Readable"));
+ if (fileInfo.isReadable())
+ readable->setChecked(true);
+
+ QCheckBox *writable = new QCheckBox(tr("Writable"));
+ if ( fileInfo.isWritable() )
+ writable->setChecked(true);
+
+ QCheckBox *executable = new QCheckBox(tr("Executable"));
+ if ( fileInfo.isExecutable() )
+ executable->setChecked(true);
+
+ QGroupBox *ownerGroup = new QGroupBox(tr("Ownership"));
+
+ QLabel *ownerLabel = new QLabel(tr("Owner"));
+ QLabel *ownerValueLabel = new QLabel(fileInfo.owner());
+ ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+
+ QLabel *groupLabel = new QLabel(tr("Group"));
+ QLabel *groupValueLabel = new QLabel(fileInfo.group());
+ groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+
+ QVBoxLayout *permissionsLayout = new QVBoxLayout;
+ permissionsLayout->addWidget(readable);
+ permissionsLayout->addWidget(writable);
+ permissionsLayout->addWidget(executable);
+ permissionsGroup->setLayout(permissionsLayout);
+
+ QVBoxLayout *ownerLayout = new QVBoxLayout;
+ ownerLayout->addWidget(ownerLabel);
+ ownerLayout->addWidget(ownerValueLabel);
+ ownerLayout->addWidget(groupLabel);
+ ownerLayout->addWidget(groupValueLabel);
+ ownerGroup->setLayout(ownerLayout);
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(permissionsGroup);
+ mainLayout->addWidget(ownerGroup);
+ mainLayout->addStretch(1);
+ setLayout(mainLayout);
+}
+//! [7]
+
+//! [8]
+ApplicationsTab::ApplicationsTab(const QFileInfo &fileInfo, QWidget *parent)
+ : QWidget(parent)
+{
+ QLabel *topLabel = new QLabel(tr("Open with:"));
+
+ QListWidget *applicationsListBox = new QListWidget;
+ QStringList applications;
+
+ for (int i = 1; i <= 30; ++i)
+ applications.append(tr("Application %1").arg(i));
+ applicationsListBox->insertItems(0, applications);
+
+ QCheckBox *alwaysCheckBox;
+
+ if (fileInfo.suffix().isEmpty())
+ alwaysCheckBox = new QCheckBox(tr("Always use this application to "
+ "open this type of file"));
+ else
+ alwaysCheckBox = new QCheckBox(tr("Always use this application to "
+ "open files with the extension '%1'").arg(fileInfo.suffix()));
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(topLabel);
+ layout->addWidget(applicationsListBox);
+ layout->addWidget(alwaysCheckBox);
+ setLayout(layout);
+}
+//! [8]
diff --git a/examples/dialogs/tabdialog/tabdialog.h b/examples/dialogs/tabdialog/tabdialog.h
new file mode 100644
index 0000000..b22997d
--- /dev/null
+++ b/examples/dialogs/tabdialog/tabdialog.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TABDIALOG_H
+#define TABDIALOG_H
+
+#include <QDialog>
+
+QT_BEGIN_NAMESPACE
+class QDialogButtonBox;
+class QFileInfo;
+class QTabWidget;
+QT_END_NAMESPACE
+
+//! [0]
+class GeneralTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GeneralTab(const QFileInfo &fileInfo, QWidget *parent = 0);
+};
+//! [0]
+
+
+//! [1]
+class PermissionsTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ PermissionsTab(const QFileInfo &fileInfo, QWidget *parent = 0);
+};
+//! [1]
+
+
+//! [2]
+class ApplicationsTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ApplicationsTab(const QFileInfo &fileInfo, QWidget *parent = 0);
+};
+//! [2]
+
+
+//! [3]
+class TabDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ TabDialog(const QString &fileName, QWidget *parent = 0);
+
+private:
+ QTabWidget *tabWidget;
+ QDialogButtonBox *buttonBox;
+};
+//! [3]
+
+#endif
diff --git a/examples/dialogs/tabdialog/tabdialog.pro b/examples/dialogs/tabdialog/tabdialog.pro
new file mode 100644
index 0000000..3239a72
--- /dev/null
+++ b/examples/dialogs/tabdialog/tabdialog.pro
@@ -0,0 +1,10 @@
+HEADERS = tabdialog.h
+SOURCES = main.cpp \
+ tabdialog.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/tabdialog
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/tabdialog
+INSTALLS += target sources
+wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
diff --git a/examples/dialogs/trivialwizard/trivialwizard.cpp b/examples/dialogs/trivialwizard/trivialwizard.cpp
new file mode 100644
index 0000000..128bce7
--- /dev/null
+++ b/examples/dialogs/trivialwizard/trivialwizard.cpp
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+
+//! [0] //! [1]
+QWizardPage *createIntroPage()
+{
+ QWizardPage *page = new QWizardPage;
+ page->setTitle("Introduction");
+
+ QLabel *label = new QLabel("This wizard will help you register your copy "
+ "of Super Product Two.");
+ label->setWordWrap(true);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ page->setLayout(layout);
+
+ return page;
+}
+//! [0]
+
+//! [2]
+QWizardPage *createRegistrationPage()
+//! [1] //! [3]
+{
+//! [3]
+ QWizardPage *page = new QWizardPage;
+ page->setTitle("Registration");
+ page->setSubTitle("Please fill both fields.");
+
+ QLabel *nameLabel = new QLabel("Name:");
+ QLineEdit *nameLineEdit = new QLineEdit;
+
+ QLabel *emailLabel = new QLabel("Email address:");
+ QLineEdit *emailLineEdit = new QLineEdit;
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(nameLabel, 0, 0);
+ layout->addWidget(nameLineEdit, 0, 1);
+ layout->addWidget(emailLabel, 1, 0);
+ layout->addWidget(emailLineEdit, 1, 1);
+ page->setLayout(layout);
+
+ return page;
+//! [4]
+}
+//! [2] //! [4]
+
+//! [5] //! [6]
+QWizardPage *createConclusionPage()
+//! [5] //! [7]
+{
+//! [7]
+ QWizardPage *page = new QWizardPage;
+ page->setTitle("Conclusion");
+
+ QLabel *label = new QLabel("You are now successfully registered. Have a "
+ "nice day!");
+ label->setWordWrap(true);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ page->setLayout(layout);
+
+ return page;
+//! [8]
+}
+//! [6] //! [8]
+
+//! [9] //! [10]
+int main(int argc, char *argv[])
+//! [9] //! [11]
+{
+ QApplication app(argc, argv);
+
+ QString translatorFileName = QLatin1String("qt_");
+ translatorFileName += QLocale::system().name();
+ QTranslator *translator = new QTranslator(&app);
+ if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ app.installTranslator(translator);
+
+
+ QWizard wizard;
+ wizard.addPage(createIntroPage());
+ wizard.addPage(createRegistrationPage());
+ wizard.addPage(createConclusionPage());
+
+ wizard.setWindowTitle("Trivial Wizard");
+ wizard.show();
+
+ return app.exec();
+}
+//! [10] //! [11]
diff --git a/examples/dialogs/trivialwizard/trivialwizard.pro b/examples/dialogs/trivialwizard/trivialwizard.pro
new file mode 100644
index 0000000..970e12f
--- /dev/null
+++ b/examples/dialogs/trivialwizard/trivialwizard.pro
@@ -0,0 +1,7 @@
+SOURCES = trivialwizard.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/dialogs/trivialwizard
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/dialogs/trivialwizard
+INSTALLS += target sources
diff --git a/examples/draganddrop/README b/examples/draganddrop/README
new file mode 100644
index 0000000..f4efd2e
--- /dev/null
+++ b/examples/draganddrop/README
@@ -0,0 +1,40 @@
+Qt supports native drag and drop on all platforms via an extensible
+MIME-based system that enables applications to send data to each other in the
+most appropriate formats.
+
+Drag and drop can also be implemented for internal use by applications.
+
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/draganddrop/delayedencoding/delayedencoding.pro b/examples/draganddrop/delayedencoding/delayedencoding.pro
new file mode 100644
index 0000000..c7b95b6
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/delayedencoding.pro
@@ -0,0 +1,14 @@
+QT += svg
+
+HEADERS = mimedata.h \
+ sourcewidget.h
+RESOURCES = delayedencoding.qrc
+SOURCES = main.cpp \
+ mimedata.cpp \
+ sourcewidget.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/delayedencoding
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/itemviews/delayedencoding
+INSTALLS += target sources
diff --git a/examples/draganddrop/delayedencoding/delayedencoding.qrc b/examples/draganddrop/delayedencoding/delayedencoding.qrc
new file mode 100644
index 0000000..374f211
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/delayedencoding.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="">
+ <file>images/drag.png</file>
+ <file>images/example.svg</file>
+</qresource>
+</RCC>
diff --git a/examples/draganddrop/delayedencoding/images/drag.png b/examples/draganddrop/delayedencoding/images/drag.png
new file mode 100644
index 0000000..dd795cf
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/images/drag.png
Binary files differ
diff --git a/examples/draganddrop/delayedencoding/images/example.svg b/examples/draganddrop/delayedencoding/images/example.svg
new file mode 100644
index 0000000..4707cf8
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/images/example.svg
@@ -0,0 +1,59 @@
+<?xml version="1.0" standalone="no"?>
+<!-- ***********************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+************************************************************************ -->
+<svg width="8cm" height="8cm" viewBox="0 0 400 400"
+ xmlns="http://www.w3.org/2000/svg" baseProfile="tiny" version="1.1">
+ <title>Sphere</title>
+ <desc>A gradient filled sphere.</desc>
+ <g>
+ <defs>
+ <radialGradient id="blueSphere" gradientUnits="userSpaceOnUse"
+ cx="200" cy="200" r="100" fx="150" fy="150">
+ <stop offset="0%" stop-color="white" />
+ <stop offset="75%" stop-color="blue" />
+ <stop offset="100%" stop-color="black" />
+ </radialGradient>
+ </defs>
+ <rect fill="lightblue" x="0" y="0" width="400" height="400" />
+ <circle fill="url(#blueSphere)" stroke="black" stroke-width="2"
+ cx="200" cy="200" r="100"/>
+ </g>
+</svg>
diff --git a/examples/draganddrop/delayedencoding/main.cpp b/examples/draganddrop/delayedencoding/main.cpp
new file mode 100644
index 0000000..801e474
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "sourcewidget.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ SourceWidget window;
+ window.show();
+ return app.exec();
+}
+
diff --git a/examples/draganddrop/delayedencoding/mimedata.cpp b/examples/draganddrop/delayedencoding/mimedata.cpp
new file mode 100644
index 0000000..5c7c23c
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/mimedata.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "mimedata.h"
+
+MimeData::MimeData()
+ : QMimeData()
+{
+}
+
+//![0]
+QStringList MimeData::formats() const
+{
+ return QMimeData::formats() << "image/png";
+}
+//![0]
+
+//![1]
+QVariant MimeData::retrieveData(const QString &mimeType, QVariant::Type type)
+ const
+{
+ emit dataRequested(mimeType);
+
+ return QMimeData::retrieveData(mimeType, type);
+}
+//![1]
+
diff --git a/examples/draganddrop/delayedencoding/mimedata.h b/examples/draganddrop/delayedencoding/mimedata.h
new file mode 100644
index 0000000..13e834d
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/mimedata.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MIMEDATA_H
+#define MIMEDATA_H
+
+#include <QMimeData>
+
+//![0]
+class MimeData : public QMimeData
+{
+ Q_OBJECT
+
+public:
+ MimeData();
+ QStringList formats() const;
+
+signals:
+ void dataRequested(const QString &mimeType) const;
+
+protected:
+ QVariant retrieveData(const QString &mimetype, QVariant::Type type) const;
+};
+//![0]
+
+#endif
diff --git a/examples/draganddrop/delayedencoding/sourcewidget.cpp b/examples/draganddrop/delayedencoding/sourcewidget.cpp
new file mode 100644
index 0000000..f5aed89
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/sourcewidget.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtSvg>
+#include "mimedata.h"
+#include "sourcewidget.h"
+
+SourceWidget::SourceWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ QFile imageFile(":/images/example.svg");
+ imageFile.open(QIODevice::ReadOnly);
+ imageData = imageFile.readAll();
+ imageFile.close();
+
+ QScrollArea *imageArea = new QScrollArea;
+ imageLabel = new QSvgWidget;
+ imageLabel->renderer()->load(imageData);
+ imageArea->setWidget(imageLabel);
+ //imageLabel->setMinimumSize(imageLabel->renderer()->viewBox().size());
+
+ QLabel *instructTopLabel = new QLabel(tr("This is an SVG drawing:"));
+ QLabel *instructBottomLabel = new QLabel(
+ tr("Drag the icon to copy the drawing as a PNG file:"));
+ QPushButton *dragIcon = new QPushButton(tr("Export"));
+ dragIcon->setIcon(QIcon(":/images/drag.png"));
+
+ connect(dragIcon, SIGNAL(pressed()), this, SLOT(startDrag()));
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(instructTopLabel, 0, 0, 1, 2);
+ layout->addWidget(imageArea, 1, 0, 2, 2);
+ layout->addWidget(instructBottomLabel, 3, 0);
+ layout->addWidget(dragIcon, 3, 1);
+ setLayout(layout);
+ setWindowTitle(tr("Delayed Encoding"));
+}
+
+//![1]
+void SourceWidget::createData(const QString &mimeType)
+{
+ if (mimeType != "image/png")
+ return;
+
+ QImage image(imageLabel->size(), QImage::Format_RGB32);
+ QPainter painter;
+ painter.begin(&image);
+ imageLabel->renderer()->render(&painter);
+ painter.end();
+
+ QByteArray data;
+ QBuffer buffer(&data);
+ buffer.open(QIODevice::WriteOnly);
+ image.save(&buffer, "PNG");
+ buffer.close();
+
+ mimeData->setData("image/png", data);
+}
+//![1]
+
+//![0]
+void SourceWidget::startDrag()
+{
+ mimeData = new MimeData;
+
+ connect(mimeData, SIGNAL(dataRequested(const QString &)),
+ this, SLOT(createData(const QString &)), Qt::DirectConnection);
+
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setPixmap(QPixmap(":/images/drag.png"));
+
+ drag->exec(Qt::CopyAction);
+}
+//![0]
+
diff --git a/examples/draganddrop/delayedencoding/sourcewidget.h b/examples/draganddrop/delayedencoding/sourcewidget.h
new file mode 100644
index 0000000..8d6a690
--- /dev/null
+++ b/examples/draganddrop/delayedencoding/sourcewidget.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SOURCEWIDGET_H
+#define SOURCEWIDGET_H
+
+#include <QByteArray>
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QSvgWidget;
+QT_END_NAMESPACE
+class MimeData;
+
+class SourceWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SourceWidget(QWidget *parent = 0);
+//![0]
+public slots:
+ void createData(const QString &mimetype);
+ void startDrag();
+
+private:
+ QByteArray imageData;
+ QSvgWidget *imageLabel;
+ MimeData *mimeData;
+//![0]
+};
+
+#endif
diff --git a/examples/draganddrop/draganddrop.pro b/examples/draganddrop/draganddrop.pro
new file mode 100644
index 0000000..0cd881a
--- /dev/null
+++ b/examples/draganddrop/draganddrop.pro
@@ -0,0 +1,15 @@
+TEMPLATE = subdirs
+SUBDIRS = draggableicons \
+ draggabletext \
+ dropsite \
+ fridgemagnets \
+ puzzle
+
+contains(QT_CONFIG, svg): SUBDIRS += delayedencoding
+
+wince*: SUBDIRS -= dropsite
+
+# install
+sources.files = README *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/draganddrop
+INSTALLS += sources
diff --git a/examples/draganddrop/draggableicons/draggableicons.pro b/examples/draganddrop/draggableicons/draggableicons.pro
new file mode 100644
index 0000000..74cfda9
--- /dev/null
+++ b/examples/draganddrop/draggableicons/draggableicons.pro
@@ -0,0 +1,10 @@
+HEADERS = dragwidget.h
+RESOURCES = draggableicons.qrc
+SOURCES = dragwidget.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/draggableicons
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/draggableicons
+INSTALLS += target sources
diff --git a/examples/draganddrop/draggableicons/draggableicons.qrc b/examples/draganddrop/draggableicons/draggableicons.qrc
new file mode 100644
index 0000000..63f84ac
--- /dev/null
+++ b/examples/draganddrop/draggableicons/draggableicons.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="">
+ <file>images/boat.png</file>
+ <file>images/car.png</file>
+ <file>images/house.png</file>
+</qresource>
+</RCC>
diff --git a/examples/draganddrop/draggableicons/dragwidget.cpp b/examples/draganddrop/draggableicons/dragwidget.cpp
new file mode 100644
index 0000000..021f816
--- /dev/null
+++ b/examples/draganddrop/draggableicons/dragwidget.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "dragwidget.h"
+
+//! [0]
+DragWidget::DragWidget(QWidget *parent)
+ : QFrame(parent)
+{
+ setMinimumSize(200, 200);
+ setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
+ setAcceptDrops(true);
+
+ QLabel *boatIcon = new QLabel(this);
+ boatIcon->setPixmap(QPixmap(":/images/boat.png"));
+ boatIcon->move(20, 20);
+ boatIcon->show();
+ boatIcon->setAttribute(Qt::WA_DeleteOnClose);
+
+ QLabel *carIcon = new QLabel(this);
+ carIcon->setPixmap(QPixmap(":/images/car.png"));
+ carIcon->move(120, 20);
+ carIcon->show();
+ carIcon->setAttribute(Qt::WA_DeleteOnClose);
+
+ QLabel *houseIcon = new QLabel(this);
+ houseIcon->setPixmap(QPixmap(":/images/house.png"));
+ houseIcon->move(20, 120);
+ houseIcon->show();
+ houseIcon->setAttribute(Qt::WA_DeleteOnClose);
+}
+//! [0]
+
+void DragWidget::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
+ if (event->source() == this) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+ } else {
+ event->ignore();
+ }
+}
+
+void DragWidget::dragMoveEvent(QDragMoveEvent *event)
+{
+ if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
+ if (event->source() == this) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+ } else {
+ event->ignore();
+ }
+}
+
+void DragWidget::dropEvent(QDropEvent *event)
+{
+ if (event->mimeData()->hasFormat("application/x-dnditemdata")) {
+ QByteArray itemData = event->mimeData()->data("application/x-dnditemdata");
+ QDataStream dataStream(&itemData, QIODevice::ReadOnly);
+
+ QPixmap pixmap;
+ QPoint offset;
+ dataStream >> pixmap >> offset;
+
+ QLabel *newIcon = new QLabel(this);
+ newIcon->setPixmap(pixmap);
+ newIcon->move(event->pos() - offset);
+ newIcon->show();
+ newIcon->setAttribute(Qt::WA_DeleteOnClose);
+
+ if (event->source() == this) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+ } else {
+ event->ignore();
+ }
+}
+
+//! [1]
+void DragWidget::mousePressEvent(QMouseEvent *event)
+{
+ QLabel *child = static_cast<QLabel*>(childAt(event->pos()));
+ if (!child)
+ return;
+
+ QPixmap pixmap = *child->pixmap();
+
+ QByteArray itemData;
+ QDataStream dataStream(&itemData, QIODevice::WriteOnly);
+ dataStream << pixmap << QPoint(event->pos() - child->pos());
+//! [1]
+
+//! [2]
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setData("application/x-dnditemdata", itemData);
+//! [2]
+
+//! [3]
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setPixmap(pixmap);
+ drag->setHotSpot(event->pos() - child->pos());
+//! [3]
+
+ QPixmap tempPixmap = pixmap;
+ QPainter painter;
+ painter.begin(&tempPixmap);
+ painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127));
+ painter.end();
+
+ child->setPixmap(tempPixmap);
+
+ if (drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction) == Qt::MoveAction)
+ child->close();
+ else {
+ child->show();
+ child->setPixmap(pixmap);
+ }
+}
diff --git a/examples/draganddrop/draggableicons/dragwidget.h b/examples/draganddrop/draggableicons/dragwidget.h
new file mode 100644
index 0000000..201adf8
--- /dev/null
+++ b/examples/draganddrop/draggableicons/dragwidget.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRAGWIDGET_H
+#define DRAGWIDGET_H
+
+#include <QFrame>
+
+QT_BEGIN_NAMESPACE
+class QDragEnterEvent;
+class QDropEvent;
+QT_END_NAMESPACE
+
+//! [0]
+class DragWidget : public QFrame
+{
+public:
+ DragWidget(QWidget *parent=0);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event);
+ void dropEvent(QDropEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+};
+//! [0]
+
+#endif
diff --git a/examples/draganddrop/draggableicons/images/boat.png b/examples/draganddrop/draggableicons/images/boat.png
new file mode 100644
index 0000000..46c894f
--- /dev/null
+++ b/examples/draganddrop/draggableicons/images/boat.png
Binary files differ
diff --git a/examples/draganddrop/draggableicons/images/car.png b/examples/draganddrop/draggableicons/images/car.png
new file mode 100644
index 0000000..3cb35e5
--- /dev/null
+++ b/examples/draganddrop/draggableicons/images/car.png
Binary files differ
diff --git a/examples/draganddrop/draggableicons/images/house.png b/examples/draganddrop/draggableicons/images/house.png
new file mode 100644
index 0000000..ee9d5b1
--- /dev/null
+++ b/examples/draganddrop/draggableicons/images/house.png
Binary files differ
diff --git a/examples/draganddrop/draggableicons/main.cpp b/examples/draganddrop/draggableicons/main.cpp
new file mode 100644
index 0000000..cd94537
--- /dev/null
+++ b/examples/draganddrop/draggableicons/main.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QHBoxLayout>
+#include "dragwidget.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(draggableicons);
+
+ QApplication app(argc, argv);
+
+ QWidget mainWidget;
+ QHBoxLayout *horizontalLayout = new QHBoxLayout;
+ horizontalLayout->addWidget(new DragWidget);
+ horizontalLayout->addWidget(new DragWidget);
+
+ mainWidget.setLayout(horizontalLayout);
+ mainWidget.setWindowTitle(QObject::tr("Draggable Icons"));
+ mainWidget.show();
+
+ return app.exec();
+}
diff --git a/examples/draganddrop/draggabletext/draggabletext.pro b/examples/draganddrop/draggabletext/draggabletext.pro
new file mode 100644
index 0000000..07c7c24
--- /dev/null
+++ b/examples/draganddrop/draggabletext/draggabletext.pro
@@ -0,0 +1,12 @@
+HEADERS = draglabel.h \
+ dragwidget.h
+RESOURCES = draggabletext.qrc
+SOURCES = draglabel.cpp \
+ dragwidget.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/draggabletext
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.txt *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/draggabletext
+INSTALLS += target sources
diff --git a/examples/draganddrop/draggabletext/draggabletext.qrc b/examples/draganddrop/draggabletext/draggabletext.qrc
new file mode 100644
index 0000000..b72217d
--- /dev/null
+++ b/examples/draganddrop/draggabletext/draggabletext.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/dictionary">
+ <file>words.txt</file>
+</qresource>
+</RCC>
diff --git a/examples/draganddrop/draggabletext/draglabel.cpp b/examples/draganddrop/draggabletext/draglabel.cpp
new file mode 100644
index 0000000..4dfa099
--- /dev/null
+++ b/examples/draganddrop/draggabletext/draglabel.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "draglabel.h"
+
+DragLabel::DragLabel(const QString &text, QWidget *parent)
+ : QLabel(text, parent)
+{
+ setAutoFillBackground(true);
+ setFrameShape(QFrame::Panel);
+ setFrameShadow(QFrame::Raised);
+}
diff --git a/examples/draganddrop/draggabletext/draglabel.h b/examples/draganddrop/draggabletext/draglabel.h
new file mode 100644
index 0000000..8ba2778
--- /dev/null
+++ b/examples/draganddrop/draggabletext/draglabel.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRAGLABEL_H
+#define DRAGLABEL_H
+
+#include <QLabel>
+
+QT_BEGIN_NAMESPACE
+class QDragEnterEvent;
+class QDragMoveEvent;
+class QFrame;
+QT_END_NAMESPACE
+
+class DragLabel : public QLabel
+{
+public:
+ DragLabel(const QString &text, QWidget *parent);
+};
+
+#endif
diff --git a/examples/draganddrop/draggabletext/dragwidget.cpp b/examples/draganddrop/draggabletext/dragwidget.cpp
new file mode 100644
index 0000000..2af7b29
--- /dev/null
+++ b/examples/draganddrop/draggabletext/dragwidget.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "draglabel.h"
+#include "dragwidget.h"
+
+DragWidget::DragWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ QFile dictionaryFile(":/dictionary/words.txt");
+ dictionaryFile.open(QIODevice::ReadOnly);
+ QTextStream inputStream(&dictionaryFile);
+
+ int x = 5;
+ int y = 5;
+
+ while (!inputStream.atEnd()) {
+ QString word;
+ inputStream >> word;
+ if (!word.isEmpty()) {
+ DragLabel *wordLabel = new DragLabel(word, this);
+ wordLabel->move(x, y);
+ wordLabel->show();
+ wordLabel->setAttribute(Qt::WA_DeleteOnClose);
+ x += wordLabel->width() + 2;
+ if (x >= 195) {
+ x = 5;
+ y += wordLabel->height() + 2;
+ }
+ }
+ }
+
+ QPalette newPalette = palette();
+ newPalette.setColor(QPalette::Window, Qt::white);
+ setPalette(newPalette);
+
+ setAcceptDrops(true);
+ setMinimumSize(400, qMax(200, y));
+ setWindowTitle(tr("Draggable Text"));
+}
+
+void DragWidget::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasText()) {
+ if (children().contains(event->source())) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+ } else {
+ event->ignore();
+ }
+}
+
+void DragWidget::dropEvent(QDropEvent *event)
+{
+ if (event->mimeData()->hasText()) {
+ const QMimeData *mime = event->mimeData();
+ QStringList pieces = mime->text().split(QRegExp("\\s+"),
+ QString::SkipEmptyParts);
+ QPoint position = event->pos();
+ QPoint hotSpot;
+
+ QList<QByteArray> hotSpotPos = mime->data("application/x-hotspot").split(' ');
+ if (hotSpotPos.size() == 2) {
+ hotSpot.setX(hotSpotPos.first().toInt());
+ hotSpot.setY(hotSpotPos.last().toInt());
+ }
+
+ foreach (QString piece, pieces) {
+ DragLabel *newLabel = new DragLabel(piece, this);
+ newLabel->move(position - hotSpot);
+ newLabel->show();
+ newLabel->setAttribute(Qt::WA_DeleteOnClose);
+
+ position += QPoint(newLabel->width(), 0);
+ }
+
+ if (event->source() == this) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+ } else {
+ event->ignore();
+ }
+ foreach (QObject *child, children()) {
+ if (child->inherits("QWidget")) {
+ QWidget *widget = static_cast<QWidget *>(child);
+ if (!widget->isVisible())
+ widget->deleteLater();
+ }
+ }
+}
+
+void DragWidget::mousePressEvent(QMouseEvent *event)
+{
+ QLabel *child = static_cast<QLabel*>(childAt(event->pos()));
+ if (!child)
+ return;
+
+ QPoint hotSpot = event->pos() - child->pos();
+
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setText(child->text());
+ mimeData->setData("application/x-hotspot",
+ QByteArray::number(hotSpot.x())
+ + " " + QByteArray::number(hotSpot.y()));
+
+ QPixmap pixmap(child->size());
+ child->render(&pixmap);
+
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setPixmap(pixmap);
+ drag->setHotSpot(hotSpot);
+
+ Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
+
+ if (dropAction == Qt::MoveAction)
+ child->close();
+}
diff --git a/examples/draganddrop/draggabletext/dragwidget.h b/examples/draganddrop/draggabletext/dragwidget.h
new file mode 100644
index 0000000..b51f05b
--- /dev/null
+++ b/examples/draganddrop/draggabletext/dragwidget.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRAGWIDGET_H
+#define DRAGWIDGET_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QDragEnterEvent;
+class QDropEvent;
+QT_END_NAMESPACE
+
+class DragWidget : public QWidget
+{
+public:
+ DragWidget(QWidget *parent = 0);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dropEvent(QDropEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+};
+
+#endif
diff --git a/examples/draganddrop/draggabletext/main.cpp b/examples/draganddrop/draggabletext/main.cpp
new file mode 100644
index 0000000..e66c8b7
--- /dev/null
+++ b/examples/draganddrop/draggabletext/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "dragwidget.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(draggabletext);
+
+ QApplication app(argc, argv);
+ DragWidget window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/draganddrop/draggabletext/words.txt b/examples/draganddrop/draggabletext/words.txt
new file mode 100644
index 0000000..19b8b03
--- /dev/null
+++ b/examples/draganddrop/draggabletext/words.txt
@@ -0,0 +1,41 @@
+Qt
+Quarterly
+is
+a
+paper
+based
+newsletter
+exclusively
+available
+to
+Qt
+customers
+Every
+quarter
+we
+mail
+out
+an
+issue
+that
+we
+hope
+will
+bring
+added
+insight
+and
+pleasure
+to
+your
+Qt
+programming
+with
+high
+quality
+technical
+articles
+written
+by
+Qt
+experts
diff --git a/examples/draganddrop/dropsite/droparea.cpp b/examples/draganddrop/dropsite/droparea.cpp
new file mode 100644
index 0000000..495e2bf
--- /dev/null
+++ b/examples/draganddrop/dropsite/droparea.cpp
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "droparea.h"
+
+//! [DropArea constructor]
+DropArea::DropArea(QWidget *parent)
+ : QLabel(parent)
+{
+ setMinimumSize(200, 200);
+ setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
+ setAlignment(Qt::AlignCenter);
+ setAcceptDrops(true);
+ setAutoFillBackground(true);
+ clear();
+}
+//! [DropArea constructor]
+
+//! [dragEnterEvent() function]
+void DropArea::dragEnterEvent(QDragEnterEvent *event)
+{
+ setText(tr("<drop content>"));
+ setBackgroundRole(QPalette::Highlight);
+
+ event->acceptProposedAction();
+ emit changed(event->mimeData());
+}
+//! [dragEnterEvent() function]
+
+//! [dragMoveEvent() function]
+void DropArea::dragMoveEvent(QDragMoveEvent *event)
+{
+ event->acceptProposedAction();
+}
+//! [dragMoveEvent() function]
+
+//! [dropEvent() function part1]
+void DropArea::dropEvent(QDropEvent *event)
+{
+ const QMimeData *mimeData = event->mimeData();
+//! [dropEvent() function part1]
+
+//! [dropEvent() function part2]
+ if (mimeData->hasImage()) {
+ setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
+ } else if (mimeData->hasHtml()) {
+ setText(mimeData->html());
+ setTextFormat(Qt::RichText);
+ } else if (mimeData->hasText()) {
+ setText(mimeData->text());
+ setTextFormat(Qt::PlainText);
+ } else if (mimeData->hasUrls()) {
+ QList<QUrl> urlList = mimeData->urls();
+ QString text;
+ for (int i = 0; i < urlList.size() && i < 32; ++i) {
+ QString url = urlList.at(i).path();
+ text += url + QString("\n");
+ }
+ setText(text);
+ } else {
+ setText(tr("Cannot display data"));
+ }
+//! [dropEvent() function part2]
+
+//! [dropEvent() function part3]
+ setBackgroundRole(QPalette::Dark);
+ event->acceptProposedAction();
+}
+//! [dropEvent() function part3]
+
+//! [dragLeaveEvent() function]
+void DropArea::dragLeaveEvent(QDragLeaveEvent *event)
+{
+ clear();
+ event->accept();
+}
+//! [dragLeaveEvent() function]
+
+//! [clear() function]
+void DropArea::clear()
+{
+ setText(tr("<drop content>"));
+ setBackgroundRole(QPalette::Dark);
+
+ emit changed();
+}
+//! [clear() function]
diff --git a/examples/draganddrop/dropsite/droparea.h b/examples/draganddrop/dropsite/droparea.h
new file mode 100644
index 0000000..8a40acc
--- /dev/null
+++ b/examples/draganddrop/dropsite/droparea.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DROPAREA_H
+#define DROPAREA_H
+
+#include <QLabel>
+
+QT_BEGIN_NAMESPACE
+class QMimeData;
+QT_END_NAMESPACE
+
+//! [DropArea header part1]
+class DropArea : public QLabel
+{
+ Q_OBJECT
+
+public:
+ DropArea(QWidget *parent = 0);
+
+public slots:
+ void clear();
+
+signals:
+ void changed(const QMimeData *mimeData = 0);
+//! [DropArea header part1]
+
+//! [DropArea header part2]
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event);
+ void dragLeaveEvent(QDragLeaveEvent *event);
+ void dropEvent(QDropEvent *event);
+
+private:
+ QLabel *label;
+};
+//! [DropArea header part2]
+
+#endif
diff --git a/examples/draganddrop/dropsite/dropsite.pro b/examples/draganddrop/dropsite/dropsite.pro
new file mode 100644
index 0000000..29dd0fd
--- /dev/null
+++ b/examples/draganddrop/dropsite/dropsite.pro
@@ -0,0 +1,12 @@
+HEADERS = droparea.h \
+ dropsitewindow.h
+SOURCES = droparea.cpp \
+ dropsitewindow.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/dropsite
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/dropsite
+INSTALLS += target sources
+
diff --git a/examples/draganddrop/dropsite/dropsitewindow.cpp b/examples/draganddrop/dropsite/dropsitewindow.cpp
new file mode 100644
index 0000000..6e7055b
--- /dev/null
+++ b/examples/draganddrop/dropsite/dropsitewindow.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "droparea.h"
+#include "dropsitewindow.h"
+
+//! [constructor part1]
+DropSiteWindow::DropSiteWindow()
+{
+ abstractLabel = new QLabel(tr("This example accepts drags from other "
+ "applications and displays the MIME types "
+ "provided by the drag object."));
+ abstractLabel->setWordWrap(true);
+ abstractLabel->adjustSize();
+//! [constructor part1]
+
+//! [constructor part2]
+ dropArea = new DropArea;
+ connect(dropArea, SIGNAL(changed(const QMimeData *)),
+ this, SLOT(updateFormatsTable(const QMimeData *)));
+//! [constructor part2]
+
+//! [constructor part3]
+ QStringList labels;
+ labels << tr("Format") << tr("Content");
+
+ formatsTable = new QTableWidget;
+ formatsTable->setColumnCount(2);
+ formatsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ formatsTable->setHorizontalHeaderLabels(labels);
+ formatsTable->horizontalHeader()->setStretchLastSection(true);
+//! [constructor part3]
+
+//! [constructor part4]
+ clearButton = new QPushButton(tr("Clear"));
+ quitButton = new QPushButton(tr("Quit"));
+
+ buttonBox = new QDialogButtonBox;
+ buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
+ buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
+
+ connect(quitButton, SIGNAL(pressed()), this, SLOT(close()));
+ connect(clearButton, SIGNAL(pressed()), dropArea, SLOT(clear()));
+//! [constructor part4]
+
+//! [constructor part5]
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(abstractLabel);
+ mainLayout->addWidget(dropArea);
+ mainLayout->addWidget(formatsTable);
+ mainLayout->addWidget(buttonBox);
+ setLayout(mainLayout);
+
+ setWindowTitle(tr("Drop Site"));
+ setMinimumSize(350, 500);
+}
+//! [constructor part5]
+
+//! [updateFormatsTable() part1]
+void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
+{
+ formatsTable->setRowCount(0);
+ if (!mimeData)
+ return;
+//! [updateFormatsTable() part1]
+
+//! [updateFormatsTable() part2]
+ foreach (QString format, mimeData->formats()) {
+ QTableWidgetItem *formatItem = new QTableWidgetItem(format);
+ formatItem->setFlags(Qt::ItemIsEnabled);
+ formatItem->setTextAlignment(Qt::AlignTop | Qt::AlignLeft);
+//! [updateFormatsTable() part2]
+
+//! [updateFormatsTable() part3]
+ QString text;
+ if (format == "text/plain") {
+ text = mimeData->text().simplified();
+ } else if (format == "text/html") {
+ text = mimeData->html().simplified();
+ } else if (format == "text/uri-list") {
+ QList<QUrl> urlList = mimeData->urls();
+ for (int i = 0; i < urlList.size() && i < 32; ++i) {
+ QString url = urlList.at(i).path();
+ text.append(url + " ");
+ }
+ } else {
+ QByteArray data = mimeData->data(format);
+ for (int i = 0; i < data.size() && i < 32; ++i) {
+ QString hex = QString("%1").arg(uchar(data[i]), 2, 16,
+ QChar('0'))
+ .toUpper();
+ text.append(hex + " ");
+ }
+ }
+//! [updateFormatsTable() part3]
+
+//! [updateFormatsTable() part4]
+ int row = formatsTable->rowCount();
+ formatsTable->insertRow(row);
+ formatsTable->setItem(row, 0, new QTableWidgetItem(format));
+ formatsTable->setItem(row, 1, new QTableWidgetItem(text));
+ }
+
+ formatsTable->resizeColumnToContents(0);
+}
+//! [updateFormatsTable() part4]
diff --git a/examples/draganddrop/dropsite/dropsitewindow.h b/examples/draganddrop/dropsite/dropsitewindow.h
new file mode 100644
index 0000000..bbdc687
--- /dev/null
+++ b/examples/draganddrop/dropsite/dropsitewindow.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DROPSITEWINDOW_H
+#define DROPSITEWINDOW_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QDialogButtonBox;
+class QLabel;
+class QMimeData;
+class QPushButton;
+class QTableWidget;
+QT_END_NAMESPACE
+class DropArea;
+
+//! [DropSiteWindow header]
+class DropSiteWindow : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DropSiteWindow();
+
+public slots:
+ void updateFormatsTable(const QMimeData *mimeData);
+
+private:
+ DropArea *dropArea;
+ QLabel *abstractLabel;
+ QTableWidget *formatsTable;
+
+ QPushButton *clearButton;
+ QPushButton *quitButton;
+ QDialogButtonBox *buttonBox;
+};
+//! [DropSiteWindow header]
+
+#endif
diff --git a/examples/draganddrop/dropsite/main.cpp b/examples/draganddrop/dropsite/main.cpp
new file mode 100644
index 0000000..62589ad
--- /dev/null
+++ b/examples/draganddrop/dropsite/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "dropsitewindow.h"
+
+//! [main() function]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ DropSiteWindow window;
+ window.show();
+ return app.exec();
+}
+//! [main() function]
diff --git a/examples/draganddrop/fridgemagnets/draglabel.cpp b/examples/draganddrop/fridgemagnets/draglabel.cpp
new file mode 100644
index 0000000..1bec024
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/draglabel.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "draglabel.h"
+
+//! [0]
+DragLabel::DragLabel(const QString &text, QWidget *parent)
+ : QLabel(parent)
+{
+ QFontMetrics metric(font());
+ QSize size = metric.size(Qt::TextSingleLine, text);
+
+ QImage image(size.width() + 12, size.height() + 12,
+ QImage::Format_ARGB32_Premultiplied);
+ image.fill(qRgba(0, 0, 0, 0));
+
+ QFont font;
+ font.setStyleStrategy(QFont::ForceOutline);
+//! [0]
+
+//! [1]
+ QLinearGradient gradient(0, 0, 0, image.height()-1);
+ gradient.setColorAt(0.0, Qt::white);
+ gradient.setColorAt(0.2, QColor(200, 200, 255));
+ gradient.setColorAt(0.8, QColor(200, 200, 255));
+ gradient.setColorAt(1.0, QColor(127, 127, 200));
+
+ QPainter painter;
+ painter.begin(&image);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setBrush(gradient);
+ painter.drawRoundedRect(QRectF(0.5, 0.5, image.width()-1, image.height()-1),
+ 25, 25, Qt::RelativeSize);
+
+ painter.setFont(font);
+ painter.setBrush(Qt::black);
+ painter.drawText(QRect(QPoint(6, 6), size), Qt::AlignCenter, text);
+ painter.end();
+//! [1]
+
+//! [2]
+ setPixmap(QPixmap::fromImage(image));
+ m_labelText = text;
+}
+//! [2]
+
+QString DragLabel::labelText() const
+{
+ return m_labelText;
+}
diff --git a/examples/draganddrop/fridgemagnets/draglabel.h b/examples/draganddrop/fridgemagnets/draglabel.h
new file mode 100644
index 0000000..5d2fd52
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/draglabel.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRAGLABEL_H
+#define DRAGLABEL_H
+
+#include <QLabel>
+
+QT_BEGIN_NAMESPACE
+class QDragEnterEvent;
+class QDragMoveEvent;
+class QFrame;
+QT_END_NAMESPACE
+
+//! [0]
+class DragLabel : public QLabel
+{
+public:
+ DragLabel(const QString &text, QWidget *parent);
+ QString labelText() const;
+
+private:
+ QString m_labelText;
+};
+//! [0]
+
+#endif
diff --git a/examples/draganddrop/fridgemagnets/dragwidget.cpp b/examples/draganddrop/fridgemagnets/dragwidget.cpp
new file mode 100644
index 0000000..43a9588
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/dragwidget.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "draglabel.h"
+#include "dragwidget.h"
+
+//! [0]
+DragWidget::DragWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ QFile dictionaryFile(":/dictionary/words.txt");
+ dictionaryFile.open(QFile::ReadOnly);
+ QTextStream inputStream(&dictionaryFile);
+//! [0]
+
+//! [1]
+ int x = 5;
+ int y = 5;
+
+ while (!inputStream.atEnd()) {
+ QString word;
+ inputStream >> word;
+ if (!word.isEmpty()) {
+ DragLabel *wordLabel = new DragLabel(word, this);
+ wordLabel->move(x, y);
+ wordLabel->show();
+ wordLabel->setAttribute(Qt::WA_DeleteOnClose);
+ x += wordLabel->width() + 2;
+ if (x >= 245) {
+ x = 5;
+ y += wordLabel->height() + 2;
+ }
+ }
+ }
+//! [1]
+
+//! [2]
+ QPalette newPalette = palette();
+ newPalette.setColor(QPalette::Window, Qt::white);
+ setPalette(newPalette);
+
+ setMinimumSize(400, qMax(200, y));
+ setWindowTitle(tr("Fridge Magnets"));
+//! [2] //! [3]
+ setAcceptDrops(true);
+}
+//! [3]
+
+//! [4]
+void DragWidget::dragEnterEvent(QDragEnterEvent *event)
+{
+//! [4] //! [5]
+ if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (children().contains(event->source())) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+//! [5] //! [6]
+ }
+//! [6] //! [7]
+ } else if (event->mimeData()->hasText()) {
+ event->acceptProposedAction();
+ } else {
+ event->ignore();
+ }
+}
+//! [7]
+
+//! [8]
+void DragWidget::dragMoveEvent(QDragMoveEvent *event)
+{
+ if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ if (children().contains(event->source())) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+ } else if (event->mimeData()->hasText()) {
+ event->acceptProposedAction();
+ } else {
+ event->ignore();
+ }
+}
+//! [8]
+
+//! [9]
+void DragWidget::dropEvent(QDropEvent *event)
+{
+ if (event->mimeData()->hasFormat("application/x-fridgemagnet")) {
+ const QMimeData *mime = event->mimeData();
+//! [9] //! [10]
+ QByteArray itemData = mime->data("application/x-fridgemagnet");
+ QDataStream dataStream(&itemData, QIODevice::ReadOnly);
+
+ QString text;
+ QPoint offset;
+ dataStream >> text >> offset;
+//! [10]
+//! [11]
+ DragLabel *newLabel = new DragLabel(text, this);
+ newLabel->move(event->pos() - offset);
+ newLabel->show();
+ newLabel->setAttribute(Qt::WA_DeleteOnClose);
+
+ if (event->source() == this) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->acceptProposedAction();
+ }
+//! [11] //! [12]
+ } else if (event->mimeData()->hasText()) {
+ QStringList pieces = event->mimeData()->text().split(QRegExp("\\s+"),
+ QString::SkipEmptyParts);
+ QPoint position = event->pos();
+
+ foreach (QString piece, pieces) {
+ DragLabel *newLabel = new DragLabel(piece, this);
+ newLabel->move(position);
+ newLabel->show();
+ newLabel->setAttribute(Qt::WA_DeleteOnClose);
+
+ position += QPoint(newLabel->width(), 0);
+ }
+
+ event->acceptProposedAction();
+ } else {
+ event->ignore();
+ }
+}
+//! [12]
+
+//! [13]
+void DragWidget::mousePressEvent(QMouseEvent *event)
+{
+//! [13]
+//! [14]
+ DragLabel *child = static_cast<DragLabel*>(childAt(event->pos()));
+ if (!child)
+ return;
+
+ QPoint hotSpot = event->pos() - child->pos();
+
+ QByteArray itemData;
+ QDataStream dataStream(&itemData, QIODevice::WriteOnly);
+ dataStream << child->labelText() << QPoint(hotSpot);
+//! [14]
+
+//! [15]
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setData("application/x-fridgemagnet", itemData);
+ mimeData->setText(child->labelText());
+//! [15]
+
+//! [16]
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setPixmap(*child->pixmap());
+ drag->setHotSpot(hotSpot);
+
+ child->hide();
+//! [16]
+
+//! [17]
+ if (drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction) == Qt::MoveAction)
+ child->close();
+ else
+ child->show();
+}
+//! [17]
diff --git a/examples/draganddrop/fridgemagnets/dragwidget.h b/examples/draganddrop/fridgemagnets/dragwidget.h
new file mode 100644
index 0000000..4722917
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/dragwidget.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DRAGWIDGET_H
+#define DRAGWIDGET_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QDragEnterEvent;
+class QDropEvent;
+QT_END_NAMESPACE
+
+//! [0]
+class DragWidget : public QWidget
+{
+public:
+ DragWidget(QWidget *parent = 0);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event);
+ void dropEvent(QDropEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+};
+//! [0]
+
+#endif
diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.pro b/examples/draganddrop/fridgemagnets/fridgemagnets.pro
new file mode 100644
index 0000000..f1baaef
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/fridgemagnets.pro
@@ -0,0 +1,12 @@
+HEADERS = draglabel.h \
+ dragwidget.h
+RESOURCES = fridgemagnets.qrc
+SOURCES = draglabel.cpp \
+ dragwidget.cpp \
+ main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/fridgemagnets
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.txt
+sources.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/fridgemagnets
+INSTALLS += target sources
diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.qrc b/examples/draganddrop/fridgemagnets/fridgemagnets.qrc
new file mode 100644
index 0000000..b72217d
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/fridgemagnets.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/dictionary">
+ <file>words.txt</file>
+</qresource>
+</RCC>
diff --git a/examples/draganddrop/fridgemagnets/main.cpp b/examples/draganddrop/fridgemagnets/main.cpp
new file mode 100644
index 0000000..c24cdb2
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "dragwidget.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(fridgemagnets);
+
+ QApplication app(argc, argv);
+ DragWidget window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/draganddrop/fridgemagnets/words.txt b/examples/draganddrop/fridgemagnets/words.txt
new file mode 100644
index 0000000..a7e1632
--- /dev/null
+++ b/examples/draganddrop/fridgemagnets/words.txt
@@ -0,0 +1,48 @@
+Colorless
+green
+ideas
+sleep
+furiously
+A
+colorless
+green
+idea
+is
+a
+new
+untried
+idea
+that
+is
+without
+vividness
+dull
+and
+unexciting
+To
+sleep
+furiously
+may
+seem
+a
+puzzling
+turn
+of
+phrase
+but
+the
+mind
+in
+sleep
+often
+indeed
+moves
+furiously
+with
+ideas
+and
+images
+flickering
+in
+and
+out
diff --git a/examples/draganddrop/puzzle/example.jpg b/examples/draganddrop/puzzle/example.jpg
new file mode 100644
index 0000000..e09fb70
--- /dev/null
+++ b/examples/draganddrop/puzzle/example.jpg
Binary files differ
diff --git a/examples/draganddrop/puzzle/main.cpp b/examples/draganddrop/puzzle/main.cpp
new file mode 100644
index 0000000..e0e5cc1
--- /dev/null
+++ b/examples/draganddrop/puzzle/main.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(puzzle);
+
+ QApplication app(argc, argv);
+ MainWindow window;
+ window.openImage(":/images/example.jpg");
+ window.show();
+ return app.exec();
+}
diff --git a/examples/draganddrop/puzzle/mainwindow.cpp b/examples/draganddrop/puzzle/mainwindow.cpp
new file mode 100644
index 0000000..f998882
--- /dev/null
+++ b/examples/draganddrop/puzzle/mainwindow.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <stdlib.h>
+
+#include "mainwindow.h"
+#include "pieceslist.h"
+#include "puzzlewidget.h"
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+{
+ setupMenus();
+ setupWidgets();
+
+ setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ setWindowTitle(tr("Puzzle"));
+}
+
+void MainWindow::openImage(const QString &path)
+{
+ QString fileName = path;
+
+ if (fileName.isNull())
+ fileName = QFileDialog::getOpenFileName(this,
+ tr("Open Image"), "", "Image Files (*.png *.jpg *.bmp)");
+
+ if (!fileName.isEmpty()) {
+ QPixmap newImage;
+ if (!newImage.load(fileName)) {
+ QMessageBox::warning(this, tr("Open Image"),
+ tr("The image file could not be loaded."),
+ QMessageBox::Cancel);
+ return;
+ }
+ puzzleImage = newImage;
+ setupPuzzle();
+ }
+}
+
+void MainWindow::setCompleted()
+{
+ QMessageBox::information(this, tr("Puzzle Completed"),
+ tr("Congratulations! You have completed the puzzle!\n"
+ "Click OK to start again."),
+ QMessageBox::Ok);
+
+ setupPuzzle();
+}
+
+void MainWindow::setupPuzzle()
+{
+ int size = qMin(puzzleImage.width(), puzzleImage.height());
+ puzzleImage = puzzleImage.copy((puzzleImage.width() - size)/2,
+ (puzzleImage.height() - size)/2, size, size).scaled(400,
+ 400, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+
+ piecesList->clear();
+
+ for (int y = 0; y < 5; ++y) {
+ for (int x = 0; x < 5; ++x) {
+ QPixmap pieceImage = puzzleImage.copy(x*80, y*80, 80, 80);
+ piecesList->addPiece(pieceImage, QPoint(x, y));
+ }
+ }
+
+ qsrand(QCursor::pos().x() ^ QCursor::pos().y());
+
+ for (int i = 0; i < piecesList->count(); ++i) {
+ if (int(2.0*qrand()/(RAND_MAX+1.0)) == 1) {
+ QListWidgetItem *item = piecesList->takeItem(i);
+ piecesList->insertItem(0, item);
+ }
+ }
+
+ puzzleWidget->clear();
+}
+
+void MainWindow::setupMenus()
+{
+ QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
+
+ QAction *openAction = fileMenu->addAction(tr("&Open..."));
+ openAction->setShortcut(QKeySequence(tr("Ctrl+O")));
+
+ QAction *exitAction = fileMenu->addAction(tr("E&xit"));
+ exitAction->setShortcut(QKeySequence(tr("Ctrl+Q")));
+
+ QMenu *gameMenu = menuBar()->addMenu(tr("&Game"));
+
+ QAction *restartAction = gameMenu->addAction(tr("&Restart"));
+
+ connect(openAction, SIGNAL(triggered()), this, SLOT(openImage()));
+ connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+ connect(restartAction, SIGNAL(triggered()), this, SLOT(setupPuzzle()));
+}
+
+void MainWindow::setupWidgets()
+{
+ QFrame *frame = new QFrame;
+ QHBoxLayout *frameLayout = new QHBoxLayout(frame);
+
+ piecesList = new PiecesList;
+ puzzleWidget = new PuzzleWidget;
+
+ connect(puzzleWidget, SIGNAL(puzzleCompleted()),
+ this, SLOT(setCompleted()), Qt::QueuedConnection);
+
+ frameLayout->addWidget(piecesList);
+ frameLayout->addWidget(puzzleWidget);
+ setCentralWidget(frame);
+}
diff --git a/examples/draganddrop/puzzle/mainwindow.h b/examples/draganddrop/puzzle/mainwindow.h
new file mode 100644
index 0000000..edfbb12
--- /dev/null
+++ b/examples/draganddrop/puzzle/mainwindow.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QPixmap>
+#include <QMainWindow>
+
+class PiecesList;
+class PuzzleWidget;
+QT_BEGIN_NAMESPACE
+class QListWidgetItem;
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+
+public slots:
+ void openImage(const QString &path = QString());
+ void setupPuzzle();
+
+private slots:
+ void setCompleted();
+
+private:
+ void setupMenus();
+ void setupWidgets();
+
+ QPixmap puzzleImage;
+ PiecesList *piecesList;
+ PuzzleWidget *puzzleWidget;
+};
+
+#endif
diff --git a/examples/draganddrop/puzzle/pieceslist.cpp b/examples/draganddrop/puzzle/pieceslist.cpp
new file mode 100644
index 0000000..77d06fb
--- /dev/null
+++ b/examples/draganddrop/puzzle/pieceslist.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "pieceslist.h"
+
+PiecesList::PiecesList(QWidget *parent)
+ : QListWidget(parent)
+{
+ setDragEnabled(true);
+ setViewMode(QListView::IconMode);
+ setIconSize(QSize(60, 60));
+ setSpacing(10);
+ setAcceptDrops(true);
+ setDropIndicatorShown(true);
+}
+
+void PiecesList::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasFormat("image/x-puzzle-piece"))
+ event->accept();
+ else
+ event->ignore();
+}
+
+void PiecesList::dragMoveEvent(QDragMoveEvent *event)
+{
+ if (event->mimeData()->hasFormat("image/x-puzzle-piece")) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else
+ event->ignore();
+}
+
+void PiecesList::dropEvent(QDropEvent *event)
+{
+ if (event->mimeData()->hasFormat("image/x-puzzle-piece")) {
+ QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
+ QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
+ QPixmap pixmap;
+ QPoint location;
+ dataStream >> pixmap >> location;
+
+ addPiece(pixmap, location);
+
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else
+ event->ignore();
+}
+
+void PiecesList::addPiece(QPixmap pixmap, QPoint location)
+{
+ QListWidgetItem *pieceItem = new QListWidgetItem(this);
+ pieceItem->setIcon(QIcon(pixmap));
+ pieceItem->setData(Qt::UserRole, QVariant(pixmap));
+ pieceItem->setData(Qt::UserRole+1, location);
+ pieceItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable
+ | Qt::ItemIsDragEnabled);
+}
+
+void PiecesList::startDrag(Qt::DropActions /*supportedActions*/)
+{
+ QListWidgetItem *item = currentItem();
+
+ QByteArray itemData;
+ QDataStream dataStream(&itemData, QIODevice::WriteOnly);
+ QPixmap pixmap = qVariantValue<QPixmap>(item->data(Qt::UserRole));
+ QPoint location = item->data(Qt::UserRole+1).toPoint();
+
+ dataStream << pixmap << location;
+
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setData("image/x-puzzle-piece", itemData);
+
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2));
+ drag->setPixmap(pixmap);
+
+ if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
+ delete takeItem(row(item));
+}
diff --git a/examples/draganddrop/puzzle/pieceslist.h b/examples/draganddrop/puzzle/pieceslist.h
new file mode 100644
index 0000000..26685e3
--- /dev/null
+++ b/examples/draganddrop/puzzle/pieceslist.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PIECESLIST_H
+#define PIECESLIST_H
+
+#include <QListWidget>
+
+class PiecesList : public QListWidget
+{
+ Q_OBJECT
+
+public:
+ PiecesList(QWidget *parent = 0);
+ void addPiece(QPixmap pixmap, QPoint location);
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event);
+ void dropEvent(QDropEvent *event);
+ void startDrag(Qt::DropActions supportedActions);
+};
+
+#endif
diff --git a/examples/draganddrop/puzzle/puzzle.pro b/examples/draganddrop/puzzle/puzzle.pro
new file mode 100644
index 0000000..26d2350
--- /dev/null
+++ b/examples/draganddrop/puzzle/puzzle.pro
@@ -0,0 +1,20 @@
+HEADERS = mainwindow.h \
+ pieceslist.h \
+ puzzlewidget.h
+RESOURCES = puzzle.qrc
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ pieceslist.cpp \
+ puzzlewidget.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/puzzle
+sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.jpg
+sources.path = $$[QT_INSTALL_EXAMPLES]/draganddrop/puzzle
+INSTALLS += target sources
+
+wince*: {
+ addFile.sources = example.jpg
+ addFile.path = .
+ DEPLOYMENT += addFile
+}
diff --git a/examples/draganddrop/puzzle/puzzle.qrc b/examples/draganddrop/puzzle/puzzle.qrc
new file mode 100644
index 0000000..4076cec
--- /dev/null
+++ b/examples/draganddrop/puzzle/puzzle.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/images">
+ <file>example.jpg</file>
+</qresource>
+</RCC>
diff --git a/examples/draganddrop/puzzle/puzzlewidget.cpp b/examples/draganddrop/puzzle/puzzlewidget.cpp
new file mode 100644
index 0000000..8548db5
--- /dev/null
+++ b/examples/draganddrop/puzzle/puzzlewidget.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "puzzlewidget.h"
+
+PuzzleWidget::PuzzleWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ setAcceptDrops(true);
+ setMinimumSize(400, 400);
+ setMaximumSize(400, 400);
+}
+
+void PuzzleWidget::clear()
+{
+ pieceLocations.clear();
+ piecePixmaps.clear();
+ pieceRects.clear();
+ highlightedRect = QRect();
+ inPlace = 0;
+ update();
+}
+
+void PuzzleWidget::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasFormat("image/x-puzzle-piece"))
+ event->accept();
+ else
+ event->ignore();
+}
+
+void PuzzleWidget::dragLeaveEvent(QDragLeaveEvent *event)
+{
+ QRect updateRect = highlightedRect;
+ highlightedRect = QRect();
+ update(updateRect);
+ event->accept();
+}
+
+void PuzzleWidget::dragMoveEvent(QDragMoveEvent *event)
+{
+ QRect updateRect = highlightedRect.unite(targetSquare(event->pos()));
+
+ if (event->mimeData()->hasFormat("image/x-puzzle-piece")
+ && findPiece(targetSquare(event->pos())) == -1) {
+
+ highlightedRect = targetSquare(event->pos());
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ highlightedRect = QRect();
+ event->ignore();
+ }
+
+ update(updateRect);
+}
+
+void PuzzleWidget::dropEvent(QDropEvent *event)
+{
+ if (event->mimeData()->hasFormat("image/x-puzzle-piece")
+ && findPiece(targetSquare(event->pos())) == -1) {
+
+ QByteArray pieceData = event->mimeData()->data("image/x-puzzle-piece");
+ QDataStream dataStream(&pieceData, QIODevice::ReadOnly);
+ QRect square = targetSquare(event->pos());
+ QPixmap pixmap;
+ QPoint location;
+ dataStream >> pixmap >> location;
+
+ pieceLocations.append(location);
+ piecePixmaps.append(pixmap);
+ pieceRects.append(square);
+
+ highlightedRect = QRect();
+ update(square);
+
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+
+ if (location == QPoint(square.x()/80, square.y()/80)) {
+ inPlace++;
+ if (inPlace == 25)
+ emit puzzleCompleted();
+ }
+ } else {
+ highlightedRect = QRect();
+ event->ignore();
+ }
+}
+
+int PuzzleWidget::findPiece(const QRect &pieceRect) const
+{
+ for (int i = 0; i < pieceRects.size(); ++i) {
+ if (pieceRect == pieceRects[i]) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+void PuzzleWidget::mousePressEvent(QMouseEvent *event)
+{
+ QRect square = targetSquare(event->pos());
+ int found = findPiece(square);
+
+ if (found == -1)
+ return;
+
+ QPoint location = pieceLocations[found];
+ QPixmap pixmap = piecePixmaps[found];
+ pieceLocations.removeAt(found);
+ piecePixmaps.removeAt(found);
+ pieceRects.removeAt(found);
+
+ if (location == QPoint(square.x()/80, square.y()/80))
+ inPlace--;
+
+ update(square);
+
+ QByteArray itemData;
+ QDataStream dataStream(&itemData, QIODevice::WriteOnly);
+
+ dataStream << pixmap << location;
+
+ QMimeData *mimeData = new QMimeData;
+ mimeData->setData("image/x-puzzle-piece", itemData);
+
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(mimeData);
+ drag->setHotSpot(event->pos() - square.topLeft());
+ drag->setPixmap(pixmap);
+
+ if (!(drag->exec(Qt::MoveAction) == Qt::MoveAction)) {
+ pieceLocations.insert(found, location);
+ piecePixmaps.insert(found, pixmap);
+ pieceRects.insert(found, square);
+ update(targetSquare(event->pos()));
+
+ if (location == QPoint(square.x()/80, square.y()/80))
+ inPlace++;
+ }
+}
+
+void PuzzleWidget::paintEvent(QPaintEvent *event)
+{
+ QPainter painter;
+ painter.begin(this);
+ painter.fillRect(event->rect(), Qt::white);
+
+ if (highlightedRect.isValid()) {
+ painter.setBrush(QColor("#ffcccc"));
+ painter.setPen(Qt::NoPen);
+ painter.drawRect(highlightedRect.adjusted(0, 0, -1, -1));
+ }
+
+ for (int i = 0; i < pieceRects.size(); ++i) {
+ painter.drawPixmap(pieceRects[i], piecePixmaps[i]);
+ }
+ painter.end();
+}
+
+const QRect PuzzleWidget::targetSquare(const QPoint &position) const
+{
+ return QRect(position.x()/80 * 80, position.y()/80 * 80, 80, 80);
+}
diff --git a/examples/draganddrop/puzzle/puzzlewidget.h b/examples/draganddrop/puzzle/puzzlewidget.h
new file mode 100644
index 0000000..312e25f
--- /dev/null
+++ b/examples/draganddrop/puzzle/puzzlewidget.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PUZZLEWIDGET_H
+#define PUZZLEWIDGET_H
+
+#include <QList>
+#include <QPoint>
+#include <QPixmap>
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+class QDragEnterEvent;
+class QDropEvent;
+class QMouseEvent;
+QT_END_NAMESPACE
+
+class PuzzleWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ PuzzleWidget(QWidget *parent = 0);
+ void clear();
+
+signals:
+ void puzzleCompleted();
+
+protected:
+ void dragEnterEvent(QDragEnterEvent *event);
+ void dragLeaveEvent(QDragLeaveEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event);
+ void dropEvent(QDropEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void paintEvent(QPaintEvent *event);
+
+private:
+ int findPiece(const QRect &pieceRect) const;
+ const QRect targetSquare(const QPoint &position) const;
+
+ QList<QPixmap> piecePixmaps;
+ QList<QRect> pieceRects;
+ QList<QPoint> pieceLocations;
+ QRect highlightedRect;
+ int inPlace;
+};
+
+#endif
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 0000000..2c4fc81
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,43 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ desktop \
+ dialogs \
+ draganddrop \
+ graphicsview \
+ ipc \
+ itemviews \
+ layouts \
+ linguist \
+ mainwindows \
+ network \
+ painting \
+ qtconcurrent \
+ richtext \
+ sql \
+ threads \
+ tools \
+ tutorials \
+ widgets \
+ uitools \
+ xml \
+ script
+
+contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon
+contains(QT_CONFIG, webkit): SUBDIRS += webkit
+embedded:SUBDIRS += qws
+!wince*: {
+ !contains(QT_EDITION, Console):contains(QT_BUILD_PARTS, tools):SUBDIRS += designer
+ contains(QT_BUILD_PARTS, tools):SUBDIRS += assistant qtestlib help
+} else {
+ contains(QT_BUILD_PARTS, tools):SUBDIRS += qtestlib
+}
+contains(QT_CONFIG, opengl): SUBDIRS += opengl
+contains(QT_CONFIG, dbus): SUBDIRS += dbus
+win32:!contains(QT_EDITION, OpenSource|Console):SUBDIRS += activeqt
+contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns
+contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows
+
+# install
+sources.files = README *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]
+INSTALLS += sources
diff --git a/examples/graphicsview/README b/examples/graphicsview/README
new file mode 100644
index 0000000..6c38c18
--- /dev/null
+++ b/examples/graphicsview/README
@@ -0,0 +1,40 @@
+Qt is provided with a comprehensive canvas through the GraphicsView
+classes.
+
+These examples demonstrate the fundamental aspects of canvas programming
+with Qt.
+
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro
new file mode 100644
index 0000000..a166882
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.pro
@@ -0,0 +1,12 @@
+HEADERS = layoutitem.h \
+ window.h
+SOURCES = layoutitem.cpp \
+ main.cpp \
+ window.cpp
+RESOURCES = basicgraphicslayouts.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/basicgraphicslayouts
+sources.files = $$SOURCES $$HEADERS $$RESOURCES basicgraphicslayouts.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/basicgraphicslayouts
+INSTALLS += target sources
diff --git a/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.qrc b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.qrc
new file mode 100644
index 0000000..fbe2efa
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/basicgraphicslayouts.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource>
+ <file>images/block.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/graphicsview/basicgraphicslayouts/images/block.png b/examples/graphicsview/basicgraphicslayouts/images/block.png
new file mode 100644
index 0000000..4c72a3f
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/images/block.png
Binary files differ
diff --git a/examples/graphicsview/basicgraphicslayouts/layoutitem.cpp b/examples/graphicsview/basicgraphicslayouts/layoutitem.cpp
new file mode 100644
index 0000000..8216b6e
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/layoutitem.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "layoutitem.h"
+
+//! [0]
+LayoutItem::LayoutItem(QGraphicsItem *parent/* = 0*/)
+ : QGraphicsWidget(parent)
+{
+ pix = new QPixmap(QLatin1String(":/images/block.png"));
+ // Do not allow a size smaller than the pixmap with two frames around it.
+ setMinimumSize(pix->size() + QSize(12, 12));
+}
+//! [0]
+
+LayoutItem::~LayoutItem()
+{
+ delete pix;
+}
+
+//! [1]
+void LayoutItem::paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget /*= 0*/)
+{
+ Q_UNUSED(widget);
+ Q_UNUSED(option);
+
+ QRectF frame(QPointF(0,0), geometry().size());
+ qreal w = pix->width();
+ qreal h = pix->height();
+ QGradientStops stops;
+//! [1]
+
+//! [2]
+ // paint a background rect (with gradient)
+ QLinearGradient gradient(frame.topLeft(), frame.topLeft() + QPointF(200,200));
+ stops << QGradientStop(0.0, QColor(60, 60, 60));
+ stops << QGradientStop(frame.height()/2/frame.height(), QColor(102, 176, 54));
+
+ //stops << QGradientStop(((frame.height() + h)/2 )/frame.height(), QColor(157, 195, 55));
+ stops << QGradientStop(1.0, QColor(215, 215, 215));
+ gradient.setStops(stops);
+ painter->setBrush(QBrush(gradient));
+ painter->drawRoundedRect(frame, 10.0, 10.0);
+
+ // paint a rect around the pixmap (with gradient)
+ QPointF pixpos = frame.center() - (QPointF(w, h)/2);
+ QRectF innerFrame(pixpos, QSizeF(w, h));
+ innerFrame.adjust(-4, -4, +4, +4);
+ gradient.setStart(innerFrame.topLeft());
+ gradient.setFinalStop(innerFrame.bottomRight());
+ stops.clear();
+ stops << QGradientStop(0.0, QColor(215, 255, 200));
+ stops << QGradientStop(0.5, QColor(102, 176, 54));
+ stops << QGradientStop(1.0, QColor(0, 0, 0));
+ gradient.setStops(stops);
+ painter->setBrush(QBrush(gradient));
+ painter->drawRoundedRect(innerFrame, 10.0, 10.0);
+ painter->drawPixmap(pixpos, *pix);
+}
+//! [2]
diff --git a/examples/graphicsview/basicgraphicslayouts/layoutitem.h b/examples/graphicsview/basicgraphicslayouts/layoutitem.h
new file mode 100644
index 0000000..cbda636
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/layoutitem.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef LAYOUTITEM_H
+#define LAYOUTITEM_H
+#include <QtGui>
+
+//! [0]
+class LayoutItem : public QGraphicsWidget
+{
+ Q_OBJECT
+
+public:
+ LayoutItem(QGraphicsItem *parent = 0);
+ ~LayoutItem();
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = 0);
+
+private:
+ QPixmap *pix;
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/basicgraphicslayouts/main.cpp b/examples/graphicsview/basicgraphicslayouts/main.cpp
new file mode 100644
index 0000000..720f6ff
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "window.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QGraphicsScene scene;
+
+ Window *window = new Window;
+ scene.addItem(window);
+ QGraphicsView view(&scene);
+ view.resize(600, 600);
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/graphicsview/basicgraphicslayouts/window.cpp b/examples/graphicsview/basicgraphicslayouts/window.cpp
new file mode 100644
index 0000000..afa98eb
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/window.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "window.h"
+#include "layoutitem.h"
+
+Window::Window(QGraphicsWidget *parent) : QGraphicsWidget(parent, Qt::Window)
+{
+//! [0]
+ QGraphicsLinearLayout *windowLayout = new QGraphicsLinearLayout(Qt::Vertical);
+ QGraphicsLinearLayout *linear = new QGraphicsLinearLayout(windowLayout);
+ LayoutItem *item = new LayoutItem;
+ linear->addItem(item);
+ linear->setStretchFactor(item, 1);
+//! [0]
+
+//! [1]
+ item = new LayoutItem;
+ linear->addItem(item);
+ linear->setStretchFactor(item, 3);
+ windowLayout->addItem(linear);
+//! [1]
+
+//! [2]
+ QGraphicsGridLayout *grid = new QGraphicsGridLayout(windowLayout);
+ item = new LayoutItem;
+ grid->addItem(item, 0, 0, 4, 1);
+ item = new LayoutItem;
+ item->setMaximumHeight(item->minimumHeight());
+ grid->addItem(item, 0, 1, 2, 1, Qt::AlignVCenter);
+ item = new LayoutItem;
+ item->setMaximumHeight(item->minimumHeight());
+ grid->addItem(item, 2, 1, 2, 1, Qt::AlignVCenter);
+ item = new LayoutItem;
+ grid->addItem(item, 0, 2);
+ item = new LayoutItem;
+ grid->addItem(item, 1, 2);
+ item = new LayoutItem;
+ grid->addItem(item, 2, 2);
+ item = new LayoutItem;
+ grid->addItem(item, 3, 2);
+ windowLayout->addItem(grid);
+//! [2]
+
+//! [3]
+ setLayout(windowLayout);
+ setWindowTitle(tr("Basic Graphics Layouts Example"));
+//! [3]
+
+}
+
+
+
diff --git a/examples/graphicsview/basicgraphicslayouts/window.h b/examples/graphicsview/basicgraphicslayouts/window.h
new file mode 100644
index 0000000..0ecde8a
--- /dev/null
+++ b/examples/graphicsview/basicgraphicslayouts/window.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WINDOW_H
+#define WINDOW_H
+
+#include <QtGui/QGraphicsWidget>
+
+//! [0]
+class Window : public QGraphicsWidget {
+ Q_OBJECT
+
+public:
+ Window(QGraphicsWidget *parent = 0);
+
+};
+//! [0]
+
+#endif //WINDOW_H
+
diff --git a/examples/graphicsview/collidingmice/collidingmice.pro b/examples/graphicsview/collidingmice/collidingmice.pro
new file mode 100644
index 0000000..77543b5
--- /dev/null
+++ b/examples/graphicsview/collidingmice/collidingmice.pro
@@ -0,0 +1,14 @@
+HEADERS += \
+ mouse.h
+SOURCES += \
+ main.cpp \
+ mouse.cpp
+
+RESOURCES += \
+ mice.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/collidingmice
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS collidingmice.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/collidingmice
+INSTALLS += target sources
diff --git a/examples/graphicsview/collidingmice/images/cheese.jpg b/examples/graphicsview/collidingmice/images/cheese.jpg
new file mode 100644
index 0000000..dea5795
--- /dev/null
+++ b/examples/graphicsview/collidingmice/images/cheese.jpg
Binary files differ
diff --git a/examples/graphicsview/collidingmice/main.cpp b/examples/graphicsview/collidingmice/main.cpp
new file mode 100644
index 0000000..4a44481
--- /dev/null
+++ b/examples/graphicsview/collidingmice/main.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mouse.h"
+
+#include <QtGui>
+
+#include <math.h>
+
+static const int MouseCount = 7;
+
+//! [0]
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
+//! [0]
+
+//! [1]
+ QGraphicsScene scene;
+ scene.setSceneRect(-300, -300, 600, 600);
+//! [1] //! [2]
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+//! [2]
+
+//! [3]
+ for (int i = 0; i < MouseCount; ++i) {
+ Mouse *mouse = new Mouse;
+ mouse->setPos(::sin((i * 6.28) / MouseCount) * 200,
+ ::cos((i * 6.28) / MouseCount) * 200);
+ scene.addItem(mouse);
+ }
+//! [3]
+
+//! [4]
+ QGraphicsView view(&scene);
+ view.setRenderHint(QPainter::Antialiasing);
+ view.setBackgroundBrush(QPixmap(":/images/cheese.jpg"));
+//! [4] //! [5]
+ view.setCacheMode(QGraphicsView::CacheBackground);
+ view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ view.setDragMode(QGraphicsView::ScrollHandDrag);
+//! [5] //! [6]
+ view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice"));
+ view.resize(400, 300);
+ view.show();
+
+ return app.exec();
+}
+//! [6]
diff --git a/examples/graphicsview/collidingmice/mice.qrc b/examples/graphicsview/collidingmice/mice.qrc
new file mode 100644
index 0000000..accdb4d
--- /dev/null
+++ b/examples/graphicsview/collidingmice/mice.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>images/cheese.jpg</file>
+ </qresource>
+</RCC>
diff --git a/examples/graphicsview/collidingmice/mouse.cpp b/examples/graphicsview/collidingmice/mouse.cpp
new file mode 100644
index 0000000..1d10574
--- /dev/null
+++ b/examples/graphicsview/collidingmice/mouse.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mouse.h"
+
+#include <QGraphicsScene>
+#include <QPainter>
+#include <QStyleOption>
+
+#include <math.h>
+
+static const double Pi = 3.14159265358979323846264338327950288419717;
+static double TwoPi = 2.0 * Pi;
+
+static qreal normalizeAngle(qreal angle)
+{
+ while (angle < 0)
+ angle += TwoPi;
+ while (angle > TwoPi)
+ angle -= TwoPi;
+ return angle;
+}
+
+//! [0]
+Mouse::Mouse()
+ : angle(0), speed(0), mouseEyeDirection(0),
+ color(qrand() % 256, qrand() % 256, qrand() % 256)
+{
+ rotate(qrand() % (360 * 16));
+ startTimer(1000 / 33);
+}
+//! [0]
+
+//! [1]
+QRectF Mouse::boundingRect() const
+{
+ qreal adjust = 0.5;
+ return QRectF(-18 - adjust, -22 - adjust,
+ 36 + adjust, 60 + adjust);
+}
+//! [1]
+
+//! [2]
+QPainterPath Mouse::shape() const
+{
+ QPainterPath path;
+ path.addRect(-10, -20, 20, 40);
+ return path;
+}
+//! [2]
+
+//! [3]
+void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ // Body
+ painter->setBrush(color);
+ painter->drawEllipse(-10, -20, 20, 40);
+
+ // Eyes
+ painter->setBrush(Qt::white);
+ painter->drawEllipse(-10, -17, 8, 8);
+ painter->drawEllipse(2, -17, 8, 8);
+
+ // Nose
+ painter->setBrush(Qt::black);
+ painter->drawEllipse(QRectF(-2, -22, 4, 4));
+
+ // Pupils
+ painter->drawEllipse(QRectF(-8.0 + mouseEyeDirection, -17, 4, 4));
+ painter->drawEllipse(QRectF(4.0 + mouseEyeDirection, -17, 4, 4));
+
+ // Ears
+ painter->setBrush(scene()->collidingItems(this).isEmpty() ? Qt::darkYellow : Qt::red);
+ painter->drawEllipse(-17, -12, 16, 16);
+ painter->drawEllipse(1, -12, 16, 16);
+
+ // Tail
+ QPainterPath path(QPointF(0, 20));
+ path.cubicTo(-5, 22, -5, 22, 0, 25);
+ path.cubicTo(5, 27, 5, 32, 0, 30);
+ path.cubicTo(-5, 32, -5, 42, 0, 35);
+ painter->setBrush(Qt::NoBrush);
+ painter->drawPath(path);
+}
+//! [3]
+
+//! [4]
+void Mouse::timerEvent(QTimerEvent *)
+{
+//! [4]
+ // Don't move too far away
+//! [5]
+ QLineF lineToCenter(QPointF(0, 0), mapFromScene(0, 0));
+ if (lineToCenter.length() > 150) {
+ qreal angleToCenter = ::acos(lineToCenter.dx() / lineToCenter.length());
+ if (lineToCenter.dy() < 0)
+ angleToCenter = TwoPi - angleToCenter;
+ angleToCenter = normalizeAngle((Pi - angleToCenter) + Pi / 2);
+
+ if (angleToCenter < Pi && angleToCenter > Pi / 4) {
+ // Rotate left
+ angle += (angle < -Pi / 2) ? 0.25 : -0.25;
+ } else if (angleToCenter >= Pi && angleToCenter < (Pi + Pi / 2 + Pi / 4)) {
+ // Rotate right
+ angle += (angle < Pi / 2) ? 0.25 : -0.25;
+ }
+ } else if (::sin(angle) < 0) {
+ angle += 0.25;
+ } else if (::sin(angle) > 0) {
+ angle -= 0.25;
+//! [5] //! [6]
+ }
+//! [6]
+
+ // Try not to crash with any other mice
+//! [7]
+ QList<QGraphicsItem *> dangerMice = scene()->items(QPolygonF()
+ << mapToScene(0, 0)
+ << mapToScene(-30, -50)
+ << mapToScene(30, -50));
+ foreach (QGraphicsItem *item, dangerMice) {
+ if (item == this)
+ continue;
+
+ QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0));
+ qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length());
+ if (lineToMouse.dy() < 0)
+ angleToMouse = TwoPi - angleToMouse;
+ angleToMouse = normalizeAngle((Pi - angleToMouse) + Pi / 2);
+
+ if (angleToMouse >= 0 && angleToMouse < Pi / 2) {
+ // Rotate right
+ angle += 0.5;
+ } else if (angleToMouse <= TwoPi && angleToMouse > (TwoPi - Pi / 2)) {
+ // Rotate left
+ angle -= 0.5;
+//! [7] //! [8]
+ }
+//! [8] //! [9]
+ }
+//! [9]
+
+ // Add some random movement
+//! [10]
+ if (dangerMice.size() > 1 && (qrand() % 10) == 0) {
+ if (qrand() % 1)
+ angle += (qrand() % 100) / 500.0;
+ else
+ angle -= (qrand() % 100) / 500.0;
+ }
+//! [10]
+
+//! [11]
+ speed += (-50 + qrand() % 100) / 100.0;
+
+ qreal dx = ::sin(angle) * 10;
+ mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5;
+
+ rotate(dx);
+ setPos(mapToParent(0, -(3 + sin(speed) * 3)));
+}
+//! [11]
diff --git a/examples/graphicsview/collidingmice/mouse.h b/examples/graphicsview/collidingmice/mouse.h
new file mode 100644
index 0000000..832ea53
--- /dev/null
+++ b/examples/graphicsview/collidingmice/mouse.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MOUSE_H
+#define MOUSE_H
+
+#include <QGraphicsItem>
+#include <QObject>
+
+//! [0]
+class Mouse : public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+
+public:
+ Mouse();
+
+ QRectF boundingRect() const;
+ QPainterPath shape() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget);
+
+protected:
+ void timerEvent(QTimerEvent *event);
+
+private:
+ qreal angle;
+ qreal speed;
+ qreal mouseEyeDirection;
+ QColor color;
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/diagramscene/arrow.cpp b/examples/graphicsview/diagramscene/arrow.cpp
new file mode 100644
index 0000000..0bc2ca8
--- /dev/null
+++ b/examples/graphicsview/diagramscene/arrow.cpp
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "arrow.h"
+#include <math.h>
+
+const qreal Pi = 3.14;
+
+//! [0]
+Arrow::Arrow(DiagramItem *startItem, DiagramItem *endItem,
+ QGraphicsItem *parent, QGraphicsScene *scene)
+ : QGraphicsLineItem(parent, scene)
+{
+ myStartItem = startItem;
+ myEndItem = endItem;
+ setFlag(QGraphicsItem::ItemIsSelectable, true);
+ myColor = Qt::black;
+ setPen(QPen(myColor, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+}
+//! [0]
+
+//! [1]
+QRectF Arrow::boundingRect() const
+{
+ qreal extra = (pen().width() + 20) / 2.0;
+
+ return QRectF(line().p1(), QSizeF(line().p2().x() - line().p1().x(),
+ line().p2().y() - line().p1().y()))
+ .normalized()
+ .adjusted(-extra, -extra, extra, extra);
+}
+//! [1]
+
+//! [2]
+QPainterPath Arrow::shape() const
+{
+ QPainterPath path = QGraphicsLineItem::shape();
+ path.addPolygon(arrowHead);
+ return path;
+}
+//! [2]
+
+//! [3]
+void Arrow::updatePosition()
+{
+ QLineF line(mapFromItem(myStartItem, 0, 0), mapFromItem(myEndItem, 0, 0));
+ setLine(line);
+}
+//! [3]
+
+//! [4]
+void Arrow::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
+ QWidget *)
+{
+ if (myStartItem->collidesWithItem(myEndItem))
+ return;
+
+ QPen myPen = pen();
+ myPen.setColor(myColor);
+ qreal arrowSize = 20;
+ painter->setPen(myPen);
+ painter->setBrush(myColor);
+//! [4] //! [5]
+
+ QLineF centerLine(myStartItem->pos(), myEndItem->pos());
+ QPolygonF endPolygon = myEndItem->polygon();
+ QPointF p1 = endPolygon.first() + myEndItem->pos();
+ QPointF p2;
+ QPointF intersectPoint;
+ QLineF polyLine;
+ for (int i = 1; i < endPolygon.count(); ++i) {
+ p2 = endPolygon.at(i) + myEndItem->pos();
+ polyLine = QLineF(p1, p2);
+ QLineF::IntersectType intersectType =
+ polyLine.intersect(centerLine, &intersectPoint);
+ if (intersectType == QLineF::BoundedIntersection)
+ break;
+ p1 = p2;
+ }
+
+ setLine(QLineF(intersectPoint, myStartItem->pos()));
+//! [5] //! [6]
+
+ double angle = ::acos(line().dx() / line().length());
+ if (line().dy() >= 0)
+ angle = (Pi * 2) - angle;
+
+ QPointF arrowP1 = line().p1() + QPointF(sin(angle + Pi / 3) * arrowSize,
+ cos(angle + Pi / 3) * arrowSize);
+ QPointF arrowP2 = line().p1() + QPointF(sin(angle + Pi - Pi / 3) * arrowSize,
+ cos(angle + Pi - Pi / 3) * arrowSize);
+
+ arrowHead.clear();
+ arrowHead << line().p1() << arrowP1 << arrowP2;
+//! [6] //! [7]
+ painter->drawLine(line());
+ painter->drawPolygon(arrowHead);
+ if (isSelected()) {
+ painter->setPen(QPen(myColor, 1, Qt::DashLine));
+ QLineF myLine = line();
+ myLine.translate(0, 4.0);
+ painter->drawLine(myLine);
+ myLine.translate(0,-8.0);
+ painter->drawLine(myLine);
+ }
+}
+//! [7]
diff --git a/examples/graphicsview/diagramscene/arrow.h b/examples/graphicsview/diagramscene/arrow.h
new file mode 100644
index 0000000..f624eb1
--- /dev/null
+++ b/examples/graphicsview/diagramscene/arrow.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ARROW_H
+#define ARROW_H
+
+#include <QGraphicsLineItem>
+
+#include "diagramitem.h"
+
+QT_BEGIN_NAMESPACE
+class QGraphicsPolygonItem;
+class QGraphicsLineItem;
+class QGraphicsScene;
+class QRectF;
+class QGraphicsSceneMouseEvent;
+class QPainterPath;
+QT_END_NAMESPACE
+
+//! [0]
+class Arrow : public QGraphicsLineItem
+{
+public:
+ enum { Type = UserType + 4 };
+
+ Arrow(DiagramItem *startItem, DiagramItem *endItem,
+ QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
+
+ int type() const
+ { return Type; }
+ QRectF boundingRect() const;
+ QPainterPath shape() const;
+ void setColor(const QColor &color)
+ { myColor = color; }
+ DiagramItem *startItem() const
+ { return myStartItem; }
+ DiagramItem *endItem() const
+ { return myEndItem; }
+
+
+public slots:
+ void updatePosition();
+
+protected:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
+ QWidget *widget = 0);
+
+private:
+ DiagramItem *myStartItem;
+ DiagramItem *myEndItem;
+ QColor myColor;
+ QPolygonF arrowHead;
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/diagramscene/diagramitem.cpp b/examples/graphicsview/diagramscene/diagramitem.cpp
new file mode 100644
index 0000000..b31f6b5
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramitem.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "diagramitem.h"
+#include "arrow.h"
+
+//! [0]
+DiagramItem::DiagramItem(DiagramType diagramType, QMenu *contextMenu,
+ QGraphicsItem *parent, QGraphicsScene *scene)
+ : QGraphicsPolygonItem(parent, scene)
+{
+ myDiagramType = diagramType;
+ myContextMenu = contextMenu;
+
+ QPainterPath path;
+ switch (myDiagramType) {
+ case StartEnd:
+ path.moveTo(200, 50);
+ path.arcTo(150, 0, 50, 50, 0, 90);
+ path.arcTo(50, 0, 50, 50, 90, 90);
+ path.arcTo(50, 50, 50, 50, 180, 90);
+ path.arcTo(150, 50, 50, 50, 270, 90);
+ path.lineTo(200, 25);
+ myPolygon = path.toFillPolygon();
+ break;
+ case Conditional:
+ myPolygon << QPointF(-100, 0) << QPointF(0, 100)
+ << QPointF(100, 0) << QPointF(0, -100)
+ << QPointF(-100, 0);
+ break;
+ case Step:
+ myPolygon << QPointF(-100, -100) << QPointF(100, -100)
+ << QPointF(100, 100) << QPointF(-100, 100)
+ << QPointF(-100, -100);
+ break;
+ default:
+ myPolygon << QPointF(-120, -80) << QPointF(-70, 80)
+ << QPointF(120, 80) << QPointF(70, -80)
+ << QPointF(-120, -80);
+ break;
+ }
+ setPolygon(myPolygon);
+ setFlag(QGraphicsItem::ItemIsMovable, true);
+ setFlag(QGraphicsItem::ItemIsSelectable, true);
+}
+//! [0]
+
+//! [1]
+void DiagramItem::removeArrow(Arrow *arrow)
+{
+ int index = arrows.indexOf(arrow);
+
+ if (index != -1)
+ arrows.removeAt(index);
+}
+//! [1]
+
+//! [2]
+void DiagramItem::removeArrows()
+{
+ foreach (Arrow *arrow, arrows) {
+ arrow->startItem()->removeArrow(arrow);
+ arrow->endItem()->removeArrow(arrow);
+ scene()->removeItem(arrow);
+ delete arrow;
+ }
+}
+//! [2]
+
+//! [3]
+void DiagramItem::addArrow(Arrow *arrow)
+{
+ arrows.append(arrow);
+}
+//! [3]
+
+//! [4]
+QPixmap DiagramItem::image() const
+{
+ QPixmap pixmap(250, 250);
+ pixmap.fill(Qt::transparent);
+ QPainter painter(&pixmap);
+ painter.setPen(QPen(Qt::black, 8));
+ painter.translate(125, 125);
+ painter.drawPolyline(myPolygon);
+
+ return pixmap;
+}
+//! [4]
+
+//! [5]
+void DiagramItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
+{
+ scene()->clearSelection();
+ setSelected(true);
+ myContextMenu->exec(event->screenPos());
+}
+//! [5]
+
+//! [6]
+QVariant DiagramItem::itemChange(GraphicsItemChange change,
+ const QVariant &value)
+{
+ if (change == QGraphicsItem::ItemPositionChange) {
+ foreach (Arrow *arrow, arrows) {
+ arrow->updatePosition();
+ }
+ }
+
+ return value;
+}
+//! [6]
diff --git a/examples/graphicsview/diagramscene/diagramitem.h b/examples/graphicsview/diagramscene/diagramitem.h
new file mode 100644
index 0000000..5409f20
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramitem.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIAGRAMITEM_H
+#define DIAGRAMITEM_H
+
+#include <QGraphicsPixmapItem>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+class QPixmap;
+class QGraphicsItem;
+class QGraphicsScene;
+class QTextEdit;
+class QGraphicsSceneMouseEvent;
+class QMenu;
+class QGraphicsSceneContextMenuEvent;
+class QPainter;
+class QStyleOptionGraphicsItem;
+class QWidget;
+class QPolygonF;
+QT_END_NAMESPACE
+
+class Arrow;
+
+//! [0]
+class DiagramItem : public QGraphicsPolygonItem
+{
+public:
+ enum { Type = UserType + 15 };
+ enum DiagramType { Step, Conditional, StartEnd, Io };
+
+ DiagramItem(DiagramType diagramType, QMenu *contextMenu,
+ QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
+
+ void removeArrow(Arrow *arrow);
+ void removeArrows();
+ DiagramType diagramType() const
+ { return myDiagramType; }
+ QPolygonF polygon() const
+ { return myPolygon; }
+ void addArrow(Arrow *arrow);
+ QPixmap image() const;
+ int type() const
+ { return Type;}
+
+protected:
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+
+private:
+ DiagramType myDiagramType;
+ QPolygonF myPolygon;
+ QMenu *myContextMenu;
+ QList<Arrow *> arrows;
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/diagramscene/diagramscene.cpp b/examples/graphicsview/diagramscene/diagramscene.cpp
new file mode 100644
index 0000000..8065ec5
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramscene.cpp
@@ -0,0 +1,241 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "diagramscene.h"
+#include "arrow.h"
+
+//! [0]
+DiagramScene::DiagramScene(QMenu *itemMenu, QObject *parent)
+ : QGraphicsScene(parent)
+{
+ myItemMenu = itemMenu;
+ myMode = MoveItem;
+ myItemType = DiagramItem::Step;
+ line = 0;
+ textItem = 0;
+ myItemColor = Qt::white;
+ myTextColor = Qt::black;
+ myLineColor = Qt::black;
+}
+//! [0]
+
+//! [1]
+void DiagramScene::setLineColor(const QColor &color)
+{
+ myLineColor = color;
+ if (isItemChange(Arrow::Type)) {
+ Arrow *item =
+ qgraphicsitem_cast<Arrow *>(selectedItems().first());
+ item->setColor(myLineColor);
+ update();
+ }
+}
+//! [1]
+
+//! [2]
+void DiagramScene::setTextColor(const QColor &color)
+{
+ myTextColor = color;
+ if (isItemChange(DiagramTextItem::Type)) {
+ DiagramTextItem *item =
+ qgraphicsitem_cast<DiagramTextItem *>(selectedItems().first());
+ item->setDefaultTextColor(myTextColor);
+ }
+}
+//! [2]
+
+//! [3]
+void DiagramScene::setItemColor(const QColor &color)
+{
+ myItemColor = color;
+ if (isItemChange(DiagramItem::Type)) {
+ DiagramItem *item =
+ qgraphicsitem_cast<DiagramItem *>(selectedItems().first());
+ item->setBrush(myItemColor);
+ }
+}
+//! [3]
+
+//! [4]
+void DiagramScene::setFont(const QFont &font)
+{
+ myFont = font;
+
+ if (isItemChange(DiagramTextItem::Type)) {
+ QGraphicsTextItem *item =
+ qgraphicsitem_cast<DiagramTextItem *>(selectedItems().first());
+ //At this point the selection can change so the first selected item might not be a DiagramTextItem
+ if (item)
+ item->setFont(myFont);
+ }
+}
+//! [4]
+
+void DiagramScene::setMode(Mode mode)
+{
+ myMode = mode;
+}
+
+void DiagramScene::setItemType(DiagramItem::DiagramType type)
+{
+ myItemType = type;
+}
+
+//! [5]
+void DiagramScene::editorLostFocus(DiagramTextItem *item)
+{
+ QTextCursor cursor = item->textCursor();
+ cursor.clearSelection();
+ item->setTextCursor(cursor);
+
+ if (item->toPlainText().isEmpty()) {
+ removeItem(item);
+ item->deleteLater();
+ }
+}
+//! [5]
+
+//! [6]
+void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
+{
+ if (mouseEvent->button() != Qt::LeftButton)
+ return;
+
+ DiagramItem *item;
+ switch (myMode) {
+ case InsertItem:
+ item = new DiagramItem(myItemType, myItemMenu);
+ item->setBrush(myItemColor);
+ addItem(item);
+ item->setPos(mouseEvent->scenePos());
+ emit itemInserted(item);
+ break;
+//! [6] //! [7]
+ case InsertLine:
+ line = new QGraphicsLineItem(QLineF(mouseEvent->scenePos(),
+ mouseEvent->scenePos()));
+ line->setPen(QPen(myLineColor, 2));
+ addItem(line);
+ break;
+//! [7] //! [8]
+ case InsertText:
+ textItem = new DiagramTextItem();
+ textItem->setFont(myFont);
+ textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
+ textItem->setZValue(1000.0);
+ connect(textItem, SIGNAL(lostFocus(DiagramTextItem *)),
+ this, SLOT(editorLostFocus(DiagramTextItem *)));
+ connect(textItem, SIGNAL(selectedChange(QGraphicsItem *)),
+ this, SIGNAL(itemSelected(QGraphicsItem *)));
+ addItem(textItem);
+ textItem->setDefaultTextColor(myTextColor);
+ textItem->setPos(mouseEvent->scenePos());
+ emit textInserted(textItem);
+//! [8] //! [9]
+ default:
+ ;
+ }
+ QGraphicsScene::mousePressEvent(mouseEvent);
+}
+//! [9]
+
+//! [10]
+void DiagramScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
+{
+ if (myMode == InsertLine && line != 0) {
+ QLineF newLine(line->line().p1(), mouseEvent->scenePos());
+ line->setLine(newLine);
+ } else if (myMode == MoveItem) {
+ QGraphicsScene::mouseMoveEvent(mouseEvent);
+ }
+}
+//! [10]
+
+//! [11]
+void DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
+{
+ if (line != 0 && myMode == InsertLine) {
+ QList<QGraphicsItem *> startItems = items(line->line().p1());
+ if (startItems.count() && startItems.first() == line)
+ startItems.removeFirst();
+ QList<QGraphicsItem *> endItems = items(line->line().p2());
+ if (endItems.count() && endItems.first() == line)
+ endItems.removeFirst();
+
+ removeItem(line);
+ delete line;
+//! [11] //! [12]
+
+ if (startItems.count() > 0 && endItems.count() > 0 &&
+ startItems.first()->type() == DiagramItem::Type &&
+ endItems.first()->type() == DiagramItem::Type &&
+ startItems.first() != endItems.first()) {
+ DiagramItem *startItem =
+ qgraphicsitem_cast<DiagramItem *>(startItems.first());
+ DiagramItem *endItem =
+ qgraphicsitem_cast<DiagramItem *>(endItems.first());
+ Arrow *arrow = new Arrow(startItem, endItem);
+ arrow->setColor(myLineColor);
+ startItem->addArrow(arrow);
+ endItem->addArrow(arrow);
+ arrow->setZValue(-1000.0);
+ addItem(arrow);
+ arrow->updatePosition();
+ }
+ }
+//! [12] //! [13]
+ line = 0;
+ QGraphicsScene::mouseReleaseEvent(mouseEvent);
+}
+//! [13]
+
+//! [14]
+bool DiagramScene::isItemChange(int type)
+{
+ foreach (QGraphicsItem *item, selectedItems()) {
+ if (item->type() == type)
+ return true;
+ }
+ return false;
+}
+//! [14]
diff --git a/examples/graphicsview/diagramscene/diagramscene.h b/examples/graphicsview/diagramscene/diagramscene.h
new file mode 100644
index 0000000..e33ee4f
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramscene.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIAGRAMSCENE_H
+#define DIAGRAMSCENE_H
+
+#include <QGraphicsScene>
+#include "diagramitem.h"
+#include "diagramtextitem.h"
+
+QT_BEGIN_NAMESPACE
+class QGraphicsSceneMouseEvent;
+class QMenu;
+class QPointF;
+class QGraphicsLineItem;
+class QFont;
+class QGraphicsTextItem;
+class QColor;
+QT_END_NAMESPACE
+
+//! [0]
+class DiagramScene : public QGraphicsScene
+{
+ Q_OBJECT
+
+public:
+ enum Mode { InsertItem, InsertLine, InsertText, MoveItem };
+
+ DiagramScene(QMenu *itemMenu, QObject *parent = 0);
+ QFont font() const
+ { return myFont; }
+ QColor textColor() const
+ { return myTextColor; }
+ QColor itemColor() const
+ { return myItemColor; }
+ QColor lineColor() const
+ { return myLineColor; }
+ void setLineColor(const QColor &color);
+ void setTextColor(const QColor &color);
+ void setItemColor(const QColor &color);
+ void setFont(const QFont &font);
+
+public slots:
+ void setMode(Mode mode);
+ void setItemType(DiagramItem::DiagramType type);
+ void editorLostFocus(DiagramTextItem *item);
+
+signals:
+ void itemInserted(DiagramItem *item);
+ void textInserted(QGraphicsTextItem *item);
+ void itemSelected(QGraphicsItem *item);
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
+
+private:
+ bool isItemChange(int type);
+
+ DiagramItem::DiagramType myItemType;
+ QMenu *myItemMenu;
+ Mode myMode;
+ bool leftButtonDown;
+ QPointF startPoint;
+ QGraphicsLineItem *line;
+ QFont myFont;
+ DiagramTextItem *textItem;
+ QColor myTextColor;
+ QColor myItemColor;
+ QColor myLineColor;
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/diagramscene/diagramscene.pro b/examples/graphicsview/diagramscene/diagramscene.pro
new file mode 100644
index 0000000..fe261bd
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramscene.pro
@@ -0,0 +1,20 @@
+HEADERS = mainwindow.h \
+ diagramitem.h \
+ diagramscene.h \
+ arrow.h \
+ diagramtextitem.h
+SOURCES = mainwindow.cpp \
+ diagramitem.cpp \
+ main.cpp \
+ arrow.cpp \
+ diagramtextitem.cpp \
+ diagramscene.cpp
+RESOURCES = diagramscene.qrc
+
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/diagramscene
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS diagramscene.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/diagramscene
+INSTALLS += target sources
+
diff --git a/examples/graphicsview/diagramscene/diagramscene.qrc b/examples/graphicsview/diagramscene/diagramscene.qrc
new file mode 100644
index 0000000..a111584
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramscene.qrc
@@ -0,0 +1,20 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/pointer.png</file>
+ <file>images/linepointer.png</file>
+ <file>images/textpointer.png</file>
+ <file>images/bold.png</file>
+ <file>images/italic.png</file>
+ <file>images/underline.png</file>
+ <file>images/floodfill.png</file>
+ <file>images/bringtofront.png</file>
+ <file>images/delete.png</file>
+ <file>images/sendtoback.png</file>
+ <file>images/linecolor.png</file>
+ <file>images/background1.png</file>
+ <file>images/background2.png</file>
+ <file>images/background3.png</file>
+ <file>images/background4.png</file>
+</qresource>
+</RCC>
+
diff --git a/examples/graphicsview/diagramscene/diagramtextitem.cpp b/examples/graphicsview/diagramscene/diagramtextitem.cpp
new file mode 100644
index 0000000..008b70f
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramtextitem.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "diagramtextitem.h"
+#include "diagramscene.h"
+
+//! [0]
+DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, QGraphicsScene *scene)
+ : QGraphicsTextItem(parent, scene)
+{
+ setFlag(QGraphicsItem::ItemIsMovable);
+ setFlag(QGraphicsItem::ItemIsSelectable);
+}
+//! [0]
+
+//! [1]
+QVariant DiagramTextItem::itemChange(GraphicsItemChange change,
+ const QVariant &value)
+{
+ if (change == QGraphicsItem::ItemSelectedHasChanged)
+ emit selectedChange(this);
+ return value;
+}
+//! [1]
+
+//! [2]
+void DiagramTextItem::focusOutEvent(QFocusEvent *event)
+{
+ setTextInteractionFlags(Qt::NoTextInteraction);
+ emit lostFocus(this);
+ QGraphicsTextItem::focusOutEvent(event);
+}
+//! [2]
+
+//! [5]
+void DiagramTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (textInteractionFlags() == Qt::NoTextInteraction)
+ setTextInteractionFlags(Qt::TextEditorInteraction);
+ QGraphicsTextItem::mouseDoubleClickEvent(event);
+}
+//! [5]
diff --git a/examples/graphicsview/diagramscene/diagramtextitem.h b/examples/graphicsview/diagramscene/diagramtextitem.h
new file mode 100644
index 0000000..6f0ddcb
--- /dev/null
+++ b/examples/graphicsview/diagramscene/diagramtextitem.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIAGRAMTEXTITEM_H
+#define DIAGRAMTEXTITEM_H
+
+#include <QGraphicsTextItem>
+#include <QPen>
+
+QT_BEGIN_NAMESPACE
+class QFocusEvent;
+class QGraphicsItem;
+class QGraphicsScene;
+class QGraphicsSceneMouseEvent;
+QT_END_NAMESPACE
+
+//! [0]
+class DiagramTextItem : public QGraphicsTextItem
+{
+ Q_OBJECT
+
+public:
+ enum { Type = UserType + 3 };
+
+ DiagramTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
+
+ int type() const
+ { return Type; }
+
+signals:
+ void lostFocus(DiagramTextItem *item);
+ void selectedChange(QGraphicsItem *item);
+
+protected:
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+ void focusOutEvent(QFocusEvent *event);
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/diagramscene/images/background1.png b/examples/graphicsview/diagramscene/images/background1.png
new file mode 100644
index 0000000..0f93c6b
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/background1.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/background2.png b/examples/graphicsview/diagramscene/images/background2.png
new file mode 100644
index 0000000..1e293db
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/background2.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/background3.png b/examples/graphicsview/diagramscene/images/background3.png
new file mode 100644
index 0000000..3db4f8e
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/background3.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/background4.png b/examples/graphicsview/diagramscene/images/background4.png
new file mode 100644
index 0000000..9c1f3bf
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/background4.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/bold.png b/examples/graphicsview/diagramscene/images/bold.png
new file mode 100644
index 0000000..986e65e
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/bold.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/bringtofront.png b/examples/graphicsview/diagramscene/images/bringtofront.png
new file mode 100644
index 0000000..bda2757
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/bringtofront.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/delete.png b/examples/graphicsview/diagramscene/images/delete.png
new file mode 100644
index 0000000..df2a147
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/delete.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/floodfill.png b/examples/graphicsview/diagramscene/images/floodfill.png
new file mode 100644
index 0000000..54c0dae
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/floodfill.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/italic.png b/examples/graphicsview/diagramscene/images/italic.png
new file mode 100644
index 0000000..9a438b5
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/italic.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/linecolor.png b/examples/graphicsview/diagramscene/images/linecolor.png
new file mode 100644
index 0000000..98a821f
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/linecolor.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/linepointer.png b/examples/graphicsview/diagramscene/images/linepointer.png
new file mode 100644
index 0000000..66933d4
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/linepointer.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/pointer.png b/examples/graphicsview/diagramscene/images/pointer.png
new file mode 100644
index 0000000..0b0b0aa
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/pointer.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/sendtoback.png b/examples/graphicsview/diagramscene/images/sendtoback.png
new file mode 100644
index 0000000..5aa3b0a
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/sendtoback.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/textpointer.png b/examples/graphicsview/diagramscene/images/textpointer.png
new file mode 100644
index 0000000..b25832c
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/textpointer.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/images/underline.png b/examples/graphicsview/diagramscene/images/underline.png
new file mode 100644
index 0000000..9b8209f
--- /dev/null
+++ b/examples/graphicsview/diagramscene/images/underline.png
Binary files differ
diff --git a/examples/graphicsview/diagramscene/main.cpp b/examples/graphicsview/diagramscene/main.cpp
new file mode 100644
index 0000000..4e03074
--- /dev/null
+++ b/examples/graphicsview/diagramscene/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+int main(int argv, char *args[])
+{
+ Q_INIT_RESOURCE(diagramscene);
+
+ QApplication app(argv, args);
+ MainWindow mainWindow;
+ mainWindow.setGeometry(100, 100, 800, 500);
+ mainWindow.show();
+
+ return app.exec();
+}
diff --git a/examples/graphicsview/diagramscene/mainwindow.cpp b/examples/graphicsview/diagramscene/mainwindow.cpp
new file mode 100644
index 0000000..b536a7a
--- /dev/null
+++ b/examples/graphicsview/diagramscene/mainwindow.cpp
@@ -0,0 +1,651 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QLabel>
+
+#include "mainwindow.h"
+#include "diagramitem.h"
+#include "diagramscene.h"
+#include "diagramtextitem.h"
+
+const int InsertTextButton = 10;
+
+//! [0]
+MainWindow::MainWindow()
+{
+ createActions();
+ createToolBox();
+ createMenus();
+
+ scene = new DiagramScene(itemMenu);
+ scene->setSceneRect(QRectF(0, 0, 5000, 5000));
+ connect(scene, SIGNAL(itemInserted(DiagramItem *)),
+ this, SLOT(itemInserted(DiagramItem *)));
+ connect(scene, SIGNAL(textInserted(QGraphicsTextItem *)),
+ this, SLOT(textInserted(QGraphicsTextItem *)));
+ connect(scene, SIGNAL(itemSelected(QGraphicsItem *)),
+ this, SLOT(itemSelected(QGraphicsItem *)));
+ createToolbars();
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addWidget(toolBox);
+ view = new QGraphicsView(scene);
+ layout->addWidget(view);
+
+ QWidget *widget = new QWidget;
+ widget->setLayout(layout);
+
+ setCentralWidget(widget);
+ setWindowTitle(tr("Diagramscene"));
+}
+//! [0]
+
+//! [1]
+void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button)
+{
+ QList<QAbstractButton *> buttons = backgroundButtonGroup->buttons();
+ foreach (QAbstractButton *myButton, buttons) {
+ if (myButton != button)
+ button->setChecked(false);
+ }
+ QString text = button->text();
+ if (text == tr("Blue Grid"))
+ scene->setBackgroundBrush(QPixmap(":/images/background1.png"));
+ else if (text == tr("White Grid"))
+ scene->setBackgroundBrush(QPixmap(":/images/background2.png"));
+ else if (text == tr("Gray Grid"))
+ scene->setBackgroundBrush(QPixmap(":/images/background3.png"));
+ else
+ scene->setBackgroundBrush(QPixmap(":/images/background4.png"));
+
+ scene->update();
+ view->update();
+}
+//! [1]
+
+//! [2]
+void MainWindow::buttonGroupClicked(int id)
+{
+ QList<QAbstractButton *> buttons = buttonGroup->buttons();
+ foreach (QAbstractButton *button, buttons) {
+ if (buttonGroup->button(id) != button)
+ button->setChecked(false);
+ }
+ if (id == InsertTextButton) {
+ scene->setMode(DiagramScene::InsertText);
+ } else {
+ scene->setItemType(DiagramItem::DiagramType(id));
+ scene->setMode(DiagramScene::InsertItem);
+ }
+}
+//! [2]
+
+//! [3]
+void MainWindow::deleteItem()
+{
+ foreach (QGraphicsItem *item, scene->selectedItems()) {
+ if (item->type() == DiagramItem::Type) {
+ qgraphicsitem_cast<DiagramItem *>(item)->removeArrows();
+ }
+ scene->removeItem(item);
+ }
+}
+//! [3]
+
+//! [4]
+void MainWindow::pointerGroupClicked(int)
+{
+ scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
+}
+//! [4]
+
+//! [5]
+void MainWindow::bringToFront()
+{
+ if (scene->selectedItems().isEmpty())
+ return;
+
+ QGraphicsItem *selectedItem = scene->selectedItems().first();
+ QList<QGraphicsItem *> overlapItems = selectedItem->collidingItems();
+
+ qreal zValue = 0;
+ foreach (QGraphicsItem *item, overlapItems) {
+ if (item->zValue() >= zValue &&
+ item->type() == DiagramItem::Type)
+ zValue = item->zValue() + 0.1;
+ }
+ selectedItem->setZValue(zValue);
+}
+//! [5]
+
+//! [6]
+void MainWindow::sendToBack()
+{
+ if (scene->selectedItems().isEmpty())
+ return;
+
+ QGraphicsItem *selectedItem = scene->selectedItems().first();
+ QList<QGraphicsItem *> overlapItems = selectedItem->collidingItems();
+
+ qreal zValue = 0;
+ foreach (QGraphicsItem *item, overlapItems) {
+ if (item->zValue() <= zValue &&
+ item->type() == DiagramItem::Type)
+ zValue = item->zValue() - 0.1;
+ }
+ selectedItem->setZValue(zValue);
+}
+//! [6]
+
+//! [7]
+void MainWindow::itemInserted(DiagramItem *item)
+{
+ pointerTypeGroup->button(int(DiagramScene::MoveItem))->setChecked(true);
+ scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
+ buttonGroup->button(int(item->diagramType()))->setChecked(false);
+}
+//! [7]
+
+//! [8]
+void MainWindow::textInserted(QGraphicsTextItem *)
+{
+ buttonGroup->button(InsertTextButton)->setChecked(false);
+ scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
+}
+//! [8]
+
+//! [9]
+void MainWindow::currentFontChanged(const QFont &)
+{
+ handleFontChange();
+}
+//! [9]
+
+//! [10]
+void MainWindow::fontSizeChanged(const QString &)
+{
+ handleFontChange();
+}
+//! [10]
+
+//! [11]
+void MainWindow::sceneScaleChanged(const QString &scale)
+{
+ double newScale = scale.left(scale.indexOf(tr("%"))).toDouble() / 100.0;
+ QMatrix oldMatrix = view->matrix();
+ view->resetMatrix();
+ view->translate(oldMatrix.dx(), oldMatrix.dy());
+ view->scale(newScale, newScale);
+}
+//! [11]
+
+//! [12]
+void MainWindow::textColorChanged()
+{
+ textAction = qobject_cast<QAction *>(sender());
+ fontColorToolButton->setIcon(createColorToolButtonIcon(
+ ":/images/textpointer.png",
+ qVariantValue<QColor>(textAction->data())));
+ textButtonTriggered();
+}
+//! [12]
+
+//! [13]
+void MainWindow::itemColorChanged()
+{
+ fillAction = qobject_cast<QAction *>(sender());
+ fillColorToolButton->setIcon(createColorToolButtonIcon(
+ ":/images/floodfill.png",
+ qVariantValue<QColor>(fillAction->data())));
+ fillButtonTriggered();
+}
+//! [13]
+
+//! [14]
+void MainWindow::lineColorChanged()
+{
+ lineAction = qobject_cast<QAction *>(sender());
+ lineColorToolButton->setIcon(createColorToolButtonIcon(
+ ":/images/linecolor.png",
+ qVariantValue<QColor>(lineAction->data())));
+ lineButtonTriggered();
+}
+//! [14]
+
+//! [15]
+void MainWindow::textButtonTriggered()
+{
+ scene->setTextColor(qVariantValue<QColor>(textAction->data()));
+}
+//! [15]
+
+//! [16]
+void MainWindow::fillButtonTriggered()
+{
+ scene->setItemColor(qVariantValue<QColor>(fillAction->data()));
+}
+//! [16]
+
+//! [17]
+void MainWindow::lineButtonTriggered()
+{
+ scene->setLineColor(qVariantValue<QColor>(lineAction->data()));
+}
+//! [17]
+
+//! [18]
+void MainWindow::handleFontChange()
+{
+ QFont font = fontCombo->currentFont();
+ font.setPointSize(fontSizeCombo->currentText().toInt());
+ font.setWeight(boldAction->isChecked() ? QFont::Bold : QFont::Normal);
+ font.setItalic(italicAction->isChecked());
+ font.setUnderline(underlineAction->isChecked());
+
+ scene->setFont(font);
+}
+//! [18]
+
+//! [19]
+void MainWindow::itemSelected(QGraphicsItem *item)
+{
+ DiagramTextItem *textItem =
+ qgraphicsitem_cast<DiagramTextItem *>(item);
+
+ QFont font = textItem->font();
+ QColor color = textItem->defaultTextColor();
+ fontCombo->setCurrentFont(font);
+ fontSizeCombo->setEditText(QString().setNum(font.pointSize()));
+ boldAction->setChecked(font.weight() == QFont::Bold);
+ italicAction->setChecked(font.italic());
+ underlineAction->setChecked(font.underline());
+}
+//! [19]
+
+//! [20]
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About Diagram Scene"),
+ tr("The <b>Diagram Scene</b> example shows "
+ "use of the graphics framework."));
+}
+//! [20]
+
+//! [21]
+void MainWindow::createToolBox()
+{
+ buttonGroup = new QButtonGroup;
+ buttonGroup->setExclusive(false);
+ connect(buttonGroup, SIGNAL(buttonClicked(int)),
+ this, SLOT(buttonGroupClicked(int)));
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(createCellWidget(tr("Conditional"),
+ DiagramItem::Conditional), 0, 0);
+ layout->addWidget(createCellWidget(tr("Process"),
+ DiagramItem::Step),0, 1);
+ layout->addWidget(createCellWidget(tr("Input/Output"),
+ DiagramItem::Io), 1, 0);
+//! [21]
+
+ QToolButton *textButton = new QToolButton;
+ textButton->setCheckable(true);
+ buttonGroup->addButton(textButton, InsertTextButton);
+ textButton->setIcon(QIcon(QPixmap(":/images/textpointer.png")
+ .scaled(30, 30)));
+ textButton->setIconSize(QSize(50, 50));
+ QGridLayout *textLayout = new QGridLayout;
+ textLayout->addWidget(textButton, 0, 0, Qt::AlignHCenter);
+ textLayout->addWidget(new QLabel(tr("Text")), 1, 0, Qt::AlignCenter);
+ QWidget *textWidget = new QWidget;
+ textWidget->setLayout(textLayout);
+ layout->addWidget(textWidget, 1, 1);
+
+ layout->setRowStretch(3, 10);
+ layout->setColumnStretch(2, 10);
+
+ QWidget *itemWidget = new QWidget;
+ itemWidget->setLayout(layout);
+
+ backgroundButtonGroup = new QButtonGroup;
+ connect(backgroundButtonGroup, SIGNAL(buttonClicked(QAbstractButton *)),
+ this, SLOT(backgroundButtonGroupClicked(QAbstractButton *)));
+
+ QGridLayout *backgroundLayout = new QGridLayout;
+ backgroundLayout->addWidget(createBackgroundCellWidget(tr("Blue Grid"),
+ ":/images/background1.png"), 0, 0);
+ backgroundLayout->addWidget(createBackgroundCellWidget(tr("White Grid"),
+ ":/images/background2.png"), 0, 1);
+ backgroundLayout->addWidget(createBackgroundCellWidget(tr("Gray Grid"),
+ ":/images/background3.png"), 1, 0);
+ backgroundLayout->addWidget(createBackgroundCellWidget(tr("No Grid"),
+ ":/images/background4.png"), 1, 1);
+
+ backgroundLayout->setRowStretch(2, 10);
+ backgroundLayout->setColumnStretch(2, 10);
+
+ QWidget *backgroundWidget = new QWidget;
+ backgroundWidget->setLayout(backgroundLayout);
+
+
+//! [22]
+ toolBox = new QToolBox;
+ toolBox->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Ignored));
+ toolBox->setMinimumWidth(itemWidget->sizeHint().width());
+ toolBox->addItem(itemWidget, tr("Basic Flowchart Shapes"));
+ toolBox->addItem(backgroundWidget, tr("Backgrounds"));
+}
+//! [22]
+
+//! [23]
+void MainWindow::createActions()
+{
+ toFrontAction = new QAction(QIcon(":/images/bringtofront.png"),
+ tr("Bring to &Front"), this);
+ toFrontAction->setShortcut(tr("Ctrl+F"));
+ toFrontAction->setStatusTip(tr("Bring item to front"));
+ connect(toFrontAction, SIGNAL(triggered()),
+ this, SLOT(bringToFront()));
+//! [23]
+
+ sendBackAction = new QAction(QIcon(":/images/sendtoback.png"),
+ tr("Send to &Back"), this);
+ sendBackAction->setShortcut(tr("Ctrl+B"));
+ sendBackAction->setStatusTip(tr("Send item to back"));
+ connect(sendBackAction, SIGNAL(triggered()),
+ this, SLOT(sendToBack()));
+
+ deleteAction = new QAction(QIcon(":/images/delete.png"),
+ tr("&Delete"), this);
+ deleteAction->setShortcut(tr("Delete"));
+ deleteAction->setStatusTip(tr("Delete item from diagram"));
+ connect(deleteAction, SIGNAL(triggered()),
+ this, SLOT(deleteItem()));
+
+ exitAction = new QAction(tr("E&xit"), this);
+ exitAction->setShortcut(tr("Ctrl+X"));
+ exitAction->setStatusTip(tr("Quit Scenediagram example"));
+ connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
+
+ boldAction = new QAction(tr("Bold"), this);
+ boldAction->setCheckable(true);
+ QPixmap pixmap(":/images/bold.png");
+ boldAction->setIcon(QIcon(pixmap));
+ boldAction->setShortcut(tr("Ctrl+B"));
+ connect(boldAction, SIGNAL(triggered()),
+ this, SLOT(handleFontChange()));
+
+ italicAction = new QAction(QIcon(":/images/italic.png"),
+ tr("Italic"), this);
+ italicAction->setCheckable(true);
+ italicAction->setShortcut(tr("Ctrl+I"));
+ connect(italicAction, SIGNAL(triggered()),
+ this, SLOT(handleFontChange()));
+
+ underlineAction = new QAction(QIcon(":/images/underline.png"),
+ tr("Underline"), this);
+ underlineAction->setCheckable(true);
+ underlineAction->setShortcut(tr("Ctrl+U"));
+ connect(underlineAction, SIGNAL(triggered()),
+ this, SLOT(handleFontChange()));
+
+ aboutAction = new QAction(tr("A&bout"), this);
+ aboutAction->setShortcut(tr("Ctrl+B"));
+ connect(aboutAction, SIGNAL(triggered()),
+ this, SLOT(about()));
+}
+
+//! [24]
+void MainWindow::createMenus()
+{
+ fileMenu = menuBar()->addMenu(tr("&File"));
+ fileMenu->addAction(exitAction);
+
+ itemMenu = menuBar()->addMenu(tr("&Item"));
+ itemMenu->addAction(deleteAction);
+ itemMenu->addSeparator();
+ itemMenu->addAction(toFrontAction);
+ itemMenu->addAction(sendBackAction);
+
+ aboutMenu = menuBar()->addMenu(tr("&Help"));
+ aboutMenu->addAction(aboutAction);
+}
+//! [24]
+
+//! [25]
+void MainWindow::createToolbars()
+{
+//! [25]
+ editToolBar = addToolBar(tr("Edit"));
+ editToolBar->addAction(deleteAction);
+ editToolBar->addAction(toFrontAction);
+ editToolBar->addAction(sendBackAction);
+
+ fontCombo = new QFontComboBox();
+ fontSizeCombo = new QComboBox();
+ connect(fontCombo, SIGNAL(currentFontChanged(const QFont &)),
+ this, SLOT(currentFontChanged(const QFont &)));
+
+ fontSizeCombo = new QComboBox;
+ fontSizeCombo->setEditable(true);
+ for (int i = 8; i < 30; i = i + 2)
+ fontSizeCombo->addItem(QString().setNum(i));
+ QIntValidator *validator = new QIntValidator(2, 64, this);
+ fontSizeCombo->setValidator(validator);
+ connect(fontSizeCombo, SIGNAL(currentIndexChanged(const QString &)),
+ this, SLOT(fontSizeChanged(const QString &)));
+
+ fontColorToolButton = new QToolButton;
+ fontColorToolButton->setPopupMode(QToolButton::MenuButtonPopup);
+ fontColorToolButton->setMenu(createColorMenu(SLOT(textColorChanged()),
+ Qt::black));
+ textAction = fontColorToolButton->menu()->defaultAction();
+ fontColorToolButton->setIcon(createColorToolButtonIcon(
+ ":/images/textpointer.png", Qt::black));
+ fontColorToolButton->setAutoFillBackground(true);
+ connect(fontColorToolButton, SIGNAL(clicked()),
+ this, SLOT(textButtonTriggered()));
+
+//! [26]
+ fillColorToolButton = new QToolButton;
+ fillColorToolButton->setPopupMode(QToolButton::MenuButtonPopup);
+ fillColorToolButton->setMenu(createColorMenu(SLOT(itemColorChanged()),
+ Qt::white));
+ fillAction = fillColorToolButton->menu()->defaultAction();
+ fillColorToolButton->setIcon(createColorToolButtonIcon(
+ ":/images/floodfill.png", Qt::white));
+ connect(fillColorToolButton, SIGNAL(clicked()),
+ this, SLOT(fillButtonTriggered()));
+//! [26]
+
+ lineColorToolButton = new QToolButton;
+ lineColorToolButton->setPopupMode(QToolButton::MenuButtonPopup);
+ lineColorToolButton->setMenu(createColorMenu(SLOT(lineColorChanged()),
+ Qt::black));
+ lineAction = lineColorToolButton->menu()->defaultAction();
+ lineColorToolButton->setIcon(createColorToolButtonIcon(
+ ":/images/linecolor.png", Qt::black));
+ connect(lineColorToolButton, SIGNAL(clicked()),
+ this, SLOT(lineButtonTriggered()));
+
+ textToolBar = addToolBar(tr("Font"));
+ textToolBar->addWidget(fontCombo);
+ textToolBar->addWidget(fontSizeCombo);
+ textToolBar->addAction(boldAction);
+ textToolBar->addAction(italicAction);
+ textToolBar->addAction(underlineAction);
+
+ colorToolBar = addToolBar(tr("Color"));
+ colorToolBar->addWidget(fontColorToolButton);
+ colorToolBar->addWidget(fillColorToolButton);
+ colorToolBar->addWidget(lineColorToolButton);
+
+ QToolButton *pointerButton = new QToolButton;
+ pointerButton->setCheckable(true);
+ pointerButton->setChecked(true);
+ pointerButton->setIcon(QIcon(":/images/pointer.png"));
+ QToolButton *linePointerButton = new QToolButton;
+ linePointerButton->setCheckable(true);
+ linePointerButton->setIcon(QIcon(":/images/linepointer.png"));
+
+ pointerTypeGroup = new QButtonGroup;
+ pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem));
+ pointerTypeGroup->addButton(linePointerButton,
+ int(DiagramScene::InsertLine));
+ connect(pointerTypeGroup, SIGNAL(buttonClicked(int)),
+ this, SLOT(pointerGroupClicked(int)));
+
+ sceneScaleCombo = new QComboBox;
+ QStringList scales;
+ scales << tr("50%") << tr("75%") << tr("100%") << tr("125%") << tr("150%");
+ sceneScaleCombo->addItems(scales);
+ sceneScaleCombo->setCurrentIndex(2);
+ connect(sceneScaleCombo, SIGNAL(currentIndexChanged(const QString &)),
+ this, SLOT(sceneScaleChanged(const QString &)));
+
+ pointerToolbar = addToolBar(tr("Pointer type"));
+ pointerToolbar->addWidget(pointerButton);
+ pointerToolbar->addWidget(linePointerButton);
+ pointerToolbar->addWidget(sceneScaleCombo);
+//! [27]
+}
+//! [27]
+
+//! [28]
+QWidget *MainWindow::createBackgroundCellWidget(const QString &text,
+ const QString &image)
+{
+ QToolButton *button = new QToolButton;
+ button->setText(text);
+ button->setIcon(QIcon(image));
+ button->setIconSize(QSize(50, 50));
+ button->setCheckable(true);
+ backgroundButtonGroup->addButton(button);
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(button, 0, 0, Qt::AlignHCenter);
+ layout->addWidget(new QLabel(text), 1, 0, Qt::AlignCenter);
+
+ QWidget *widget = new QWidget;
+ widget->setLayout(layout);
+
+ return widget;
+}
+//! [28]
+
+//! [29]
+QWidget *MainWindow::createCellWidget(const QString &text,
+ DiagramItem::DiagramType type)
+{
+
+ DiagramItem item(type, itemMenu);
+ QIcon icon(item.image());
+
+ QToolButton *button = new QToolButton;
+ button->setIcon(icon);
+ button->setIconSize(QSize(50, 50));
+ button->setCheckable(true);
+ buttonGroup->addButton(button, int(type));
+
+ QGridLayout *layout = new QGridLayout;
+ layout->addWidget(button, 0, 0, Qt::AlignHCenter);
+ layout->addWidget(new QLabel(text), 1, 0, Qt::AlignCenter);
+
+ QWidget *widget = new QWidget;
+ widget->setLayout(layout);
+
+ return widget;
+}
+//! [29]
+
+//! [30]
+QMenu *MainWindow::createColorMenu(const char *slot, QColor defaultColor)
+{
+ QList<QColor> colors;
+ colors << Qt::black << Qt::white << Qt::red << Qt::blue << Qt::yellow;
+ QStringList names;
+ names << tr("black") << tr("white") << tr("red") << tr("blue")
+ << tr("yellow");
+
+ QMenu *colorMenu = new QMenu;
+ for (int i = 0; i < colors.count(); ++i) {
+ QAction *action = new QAction(names.at(i), this);
+ action->setData(colors.at(i));
+ action->setIcon(createColorIcon(colors.at(i)));
+ connect(action, SIGNAL(triggered()),
+ this, slot);
+ colorMenu->addAction(action);
+ if (colors.at(i) == defaultColor) {
+ colorMenu->setDefaultAction(action);
+ }
+ }
+ return colorMenu;
+}
+//! [30]
+
+//! [31]
+QIcon MainWindow::createColorToolButtonIcon(const QString &imageFile,
+ QColor color)
+{
+ QPixmap pixmap(50, 80);
+ pixmap.fill(Qt::transparent);
+ QPainter painter(&pixmap);
+ QPixmap image(imageFile);
+ QRect target(0, 0, 50, 60);
+ QRect source(0, 0, 42, 42);
+ painter.fillRect(QRect(0, 60, 50, 80), color);
+ painter.drawPixmap(target, image, source);
+
+ return QIcon(pixmap);
+}
+//! [31]
+
+//! [32]
+QIcon MainWindow::createColorIcon(QColor color)
+{
+ QPixmap pixmap(20, 20);
+ QPainter painter(&pixmap);
+ painter.setPen(Qt::NoPen);
+ painter.fillRect(QRect(0, 0, 20, 20), color);
+
+ return QIcon(pixmap);
+}
+//! [32]
diff --git a/examples/graphicsview/diagramscene/mainwindow.h b/examples/graphicsview/diagramscene/mainwindow.h
new file mode 100644
index 0000000..e4dae4f
--- /dev/null
+++ b/examples/graphicsview/diagramscene/mainwindow.h
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include "diagramitem.h"
+
+class DiagramScene;
+
+QT_BEGIN_NAMESPACE
+class QAction;
+class QToolBox;
+class QSpinBox;
+class QComboBox;
+class QFontComboBox;
+class QButtonGroup;
+class QLineEdit;
+class QGraphicsTextItem;
+class QFont;
+class QToolButton;
+class QAbstractButton;
+class QGraphicsView;
+QT_END_NAMESPACE
+
+//! [0]
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+
+private slots:
+ void backgroundButtonGroupClicked(QAbstractButton *button);
+ void buttonGroupClicked(int id);
+ void deleteItem();
+ void pointerGroupClicked(int id);
+ void bringToFront();
+ void sendToBack();
+ void itemInserted(DiagramItem *item);
+ void textInserted(QGraphicsTextItem *item);
+ void currentFontChanged(const QFont &font);
+ void fontSizeChanged(const QString &size);
+ void sceneScaleChanged(const QString &scale);
+ void textColorChanged();
+ void itemColorChanged();
+ void lineColorChanged();
+ void textButtonTriggered();
+ void fillButtonTriggered();
+ void lineButtonTriggered();
+ void handleFontChange();
+ void itemSelected(QGraphicsItem *item);
+ void about();
+
+private:
+ void createToolBox();
+ void createActions();
+ void createMenus();
+ void createToolbars();
+ QWidget *createBackgroundCellWidget(const QString &text,
+ const QString &image);
+ QWidget *createCellWidget(const QString &text,
+ DiagramItem::DiagramType type);
+ QMenu *createColorMenu(const char *slot, QColor defaultColor);
+ QIcon createColorToolButtonIcon(const QString &image, QColor color);
+ QIcon createColorIcon(QColor color);
+
+ DiagramScene *scene;
+ QGraphicsView *view;
+
+ QAction *exitAction;
+ QAction *addAction;
+ QAction *deleteAction;
+
+ QAction *toFrontAction;
+ QAction *sendBackAction;
+ QAction *aboutAction;
+
+ QMenu *fileMenu;
+ QMenu *itemMenu;
+ QMenu *aboutMenu;
+
+ QToolBar *textToolBar;
+ QToolBar *editToolBar;
+ QToolBar *colorToolBar;
+ QToolBar *pointerToolbar;
+
+ QComboBox *sceneScaleCombo;
+ QComboBox *itemColorCombo;
+ QComboBox *textColorCombo;
+ QComboBox *fontSizeCombo;
+ QFontComboBox *fontCombo;
+
+ QToolBox *toolBox;
+ QButtonGroup *buttonGroup;
+ QButtonGroup *pointerTypeGroup;
+ QButtonGroup *backgroundButtonGroup;
+ QToolButton *fontColorToolButton;
+ QToolButton *fillColorToolButton;
+ QToolButton *lineColorToolButton;
+ QAction *boldAction;
+ QAction *underlineAction;
+ QAction *italicAction;
+ QAction *textAction;
+ QAction *fillAction;
+ QAction *lineAction;
+};
+//! [0]
+
+#endif
diff --git a/examples/graphicsview/dragdroprobot/coloritem.cpp b/examples/graphicsview/dragdroprobot/coloritem.cpp
new file mode 100644
index 0000000..2d6b145
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/coloritem.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "coloritem.h"
+
+ColorItem::ColorItem()
+ : color(qrand() % 256, qrand() % 256, qrand() % 256)
+{
+ setToolTip(QString("QColor(%1, %2, %3)\n%4")
+ .arg(color.red()).arg(color.green()).arg(color.blue())
+ .arg("Click and drag this color onto the robot!"));
+ setCursor(Qt::OpenHandCursor);
+}
+
+QRectF ColorItem::boundingRect() const
+{
+ return QRectF(-15.5, -15.5, 34, 34);
+}
+
+void ColorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(Qt::darkGray);
+ painter->drawEllipse(-12, -12, 30, 30);
+ painter->setPen(QPen(Qt::black, 1));
+ painter->setBrush(QBrush(color));
+ painter->drawEllipse(-15, -15, 30, 30);
+}
+
+void ColorItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (event->button() != Qt::LeftButton) {
+ event->ignore();
+ return;
+ }
+
+ setCursor(Qt::ClosedHandCursor);
+}
+
+void ColorItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (QLineF(event->screenPos(), event->buttonDownScreenPos(Qt::LeftButton))
+ .length() < QApplication::startDragDistance()) {
+ return;
+ }
+
+ QDrag *drag = new QDrag(event->widget());
+ QMimeData *mime = new QMimeData;
+ drag->setMimeData(mime);
+
+ static int n = 0;
+ if (n++ > 2 && (qrand() % 3) == 0) {
+ QImage image(":/images/head.png");
+ mime->setImageData(image);
+
+ drag->setPixmap(QPixmap::fromImage(image).scaled(30, 40));
+ drag->setHotSpot(QPoint(15, 30));
+ } else {
+ mime->setColorData(color);
+ mime->setText(QString("#%1%2%3")
+ .arg(color.red(), 2, 16, QLatin1Char('0'))
+ .arg(color.green(), 2, 16, QLatin1Char('0'))
+ .arg(color.blue(), 2, 16, QLatin1Char('0')));
+
+ QPixmap pixmap(34, 34);
+ pixmap.fill(Qt::white);
+
+ QPainter painter(&pixmap);
+ painter.translate(15, 15);
+ painter.setRenderHint(QPainter::Antialiasing);
+ paint(&painter, 0, 0);
+ painter.end();
+
+ pixmap.setMask(pixmap.createHeuristicMask());
+
+ drag->setPixmap(pixmap);
+ drag->setHotSpot(QPoint(15, 20));
+ }
+
+ drag->exec();
+ setCursor(Qt::OpenHandCursor);
+}
+
+void ColorItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
+{
+ setCursor(Qt::OpenHandCursor);
+}
diff --git a/examples/graphicsview/dragdroprobot/coloritem.h b/examples/graphicsview/dragdroprobot/coloritem.h
new file mode 100644
index 0000000..67b2c70
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/coloritem.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef COLORITEM_H
+#define COLORITEM_H
+
+#include <QGraphicsItem>
+
+class ColorItem : public QGraphicsItem
+{
+public:
+ ColorItem();
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+private:
+ QColor color;
+};
+
+#endif
diff --git a/examples/graphicsview/dragdroprobot/dragdroprobot.pro b/examples/graphicsview/dragdroprobot/dragdroprobot.pro
new file mode 100644
index 0000000..769e54a
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/dragdroprobot.pro
@@ -0,0 +1,18 @@
+HEADERS += \
+ coloritem.h \
+ robot.h
+
+SOURCES += \
+ coloritem.cpp \
+ main.cpp \
+ robot.cpp
+
+RESOURCES += \
+ robot.qrc
+
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/dragdroprobot
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS dragdroprobot.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/dragdroprobot
+INSTALLS += target sources
diff --git a/examples/graphicsview/dragdroprobot/images/head.png b/examples/graphicsview/dragdroprobot/images/head.png
new file mode 100644
index 0000000..1e520e0
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/images/head.png
Binary files differ
diff --git a/examples/graphicsview/dragdroprobot/main.cpp b/examples/graphicsview/dragdroprobot/main.cpp
new file mode 100644
index 0000000..204305e
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/main.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "coloritem.h"
+#include "robot.h"
+
+#include <math.h>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
+
+ QGraphicsScene scene(-200, -200, 400, 400);
+
+ for (int i = 0; i < 10; ++i) {
+ ColorItem *item = new ColorItem;
+ item->setPos(::sin((i * 6.28) / 10.0) * 150,
+ ::cos((i * 6.28) / 10.0) * 150);
+
+ scene.addItem(item);
+ }
+
+ Robot *robot = new Robot;
+ robot->scale(1.2, 1.2);
+ robot->setPos(0, -20);
+ scene.addItem(robot);
+
+ QGraphicsView view(&scene);
+ view.setRenderHint(QPainter::Antialiasing);
+ view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ view.setBackgroundBrush(QColor(230, 200, 167));
+ view.setWindowTitle("Drag and Drop Robot");
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/graphicsview/dragdroprobot/robot.cpp b/examples/graphicsview/dragdroprobot/robot.cpp
new file mode 100644
index 0000000..c6d8c44
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/robot.cpp
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "robot.h"
+
+RobotPart::RobotPart(QGraphicsItem *parent)
+ : QGraphicsItem(parent), color(Qt::lightGray), dragOver(false)
+{
+ setAcceptDrops(true);
+}
+
+void RobotPart::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
+{
+ if (event->mimeData()->hasColor()
+ || (qgraphicsitem_cast<RobotHead *>(this) && event->mimeData()->hasImage())) {
+ event->setAccepted(true);
+ dragOver = true;
+ update();
+ } else {
+ event->setAccepted(false);
+ }
+}
+
+void RobotPart::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
+{
+ Q_UNUSED(event);
+ dragOver = false;
+ update();
+}
+
+void RobotPart::dropEvent(QGraphicsSceneDragDropEvent *event)
+{
+ dragOver = false;
+ if (event->mimeData()->hasColor())
+ color = qVariantValue<QColor>(event->mimeData()->colorData());
+ else if (event->mimeData()->hasImage())
+ pixmap = qVariantValue<QPixmap>(event->mimeData()->imageData());
+ update();
+}
+
+RobotHead::RobotHead(QGraphicsItem *parent)
+ : RobotPart(parent)
+{
+}
+
+QRectF RobotHead::boundingRect() const
+{
+ return QRectF(-15, -50, 30, 50);
+}
+
+void RobotHead::paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ if (pixmap.isNull()) {
+ painter->setBrush(dragOver ? color.light(130) : color);
+ painter->drawRoundedRect(-10, -30, 20, 30, 25, 25, Qt::RelativeSize);
+ painter->setBrush(Qt::white);
+ painter->drawEllipse(-7, -3 - 20, 7, 7);
+ painter->drawEllipse(0, -3 - 20, 7, 7);
+ painter->setBrush(Qt::black);
+ painter->drawEllipse(-5, -1 - 20, 2, 2);
+ painter->drawEllipse(2, -1 - 20, 2, 2);
+ painter->setPen(QPen(Qt::black, 2));
+ painter->setBrush(Qt::NoBrush);
+ painter->drawArc(-6, -2 - 20, 12, 15, 190 * 16, 160 * 16);
+ } else {
+ painter->scale(.2272, .2824);
+ painter->drawPixmap(QPointF(-15 * 4.4, -50 * 3.54), pixmap);
+ }
+}
+
+int RobotHead::type() const
+{
+ return Type;
+}
+
+RobotTorso::RobotTorso(QGraphicsItem *parent)
+ : RobotPart(parent)
+{
+}
+
+QRectF RobotTorso::boundingRect() const
+{
+ return QRectF(-30, -20, 60, 60);
+}
+
+void RobotTorso::paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->setBrush(dragOver ? color.light(130) : color);
+ painter->drawRoundedRect(-20, -20, 40, 60, 25, 25, Qt::RelativeSize);
+ painter->drawEllipse(-25, -20, 20, 20);
+ painter->drawEllipse(5, -20, 20, 20);
+ painter->drawEllipse(-20, 22, 20, 20);
+ painter->drawEllipse(0, 22, 20, 20);
+}
+
+RobotLimb::RobotLimb(QGraphicsItem *parent)
+ : RobotPart(parent)
+{
+}
+
+QRectF RobotLimb::boundingRect() const
+{
+ return QRectF(-5, -5, 40, 10);
+}
+
+void RobotLimb::paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->setBrush(dragOver ? color.light(130) : color);
+ painter->drawRoundedRect(boundingRect(), 50, 50, Qt::RelativeSize);
+ painter->drawEllipse(-5, -5, 10, 10);
+}
+
+Robot::Robot()
+{
+ QGraphicsItem *torsoItem = new RobotTorso(this);
+ QGraphicsItem *headItem = new RobotHead(torsoItem);
+ QGraphicsItem *upperLeftArmItem = new RobotLimb(torsoItem);
+ QGraphicsItem *lowerLeftArmItem = new RobotLimb(upperLeftArmItem);
+ QGraphicsItem *upperRightArmItem = new RobotLimb(torsoItem);
+ QGraphicsItem *lowerRightArmItem = new RobotLimb(upperRightArmItem);
+ QGraphicsItem *upperRightLegItem = new RobotLimb(torsoItem);
+ QGraphicsItem *lowerRightLegItem = new RobotLimb(upperRightLegItem);
+ QGraphicsItem *upperLeftLegItem = new RobotLimb(torsoItem);
+ QGraphicsItem *lowerLeftLegItem = new RobotLimb(upperLeftLegItem);
+
+ headItem->setPos(0, -18);
+ upperLeftArmItem->setPos(-15, -10);
+ lowerLeftArmItem->setPos(30, 0);
+ upperRightArmItem->setPos(15, -10);
+ lowerRightArmItem->setPos(30, 0);
+ upperRightLegItem->setPos(10, 32);
+ lowerRightLegItem->setPos(30, 0);
+ upperLeftLegItem->setPos(-10, 32);
+ lowerLeftLegItem->setPos(30, 0);
+
+ timeLine = new QTimeLine;
+
+ QGraphicsItemAnimation *headAnimation = new QGraphicsItemAnimation;
+ headAnimation->setItem(headItem);
+ headAnimation->setTimeLine(timeLine);
+ headAnimation->setRotationAt(0, 20);
+ headAnimation->setRotationAt(1, -20);
+ headAnimation->setScaleAt(1, 1.1, 1.1);
+
+ QGraphicsItemAnimation *upperLeftArmAnimation = new QGraphicsItemAnimation;
+ upperLeftArmAnimation->setItem(upperLeftArmItem);
+ upperLeftArmAnimation->setTimeLine(timeLine);
+ upperLeftArmAnimation->setRotationAt(0, 190);
+ upperLeftArmAnimation->setRotationAt(1, 180);
+
+ QGraphicsItemAnimation *lowerLeftArmAnimation = new QGraphicsItemAnimation;
+ lowerLeftArmAnimation->setItem(lowerLeftArmItem);
+ lowerLeftArmAnimation->setTimeLine(timeLine);
+ lowerLeftArmAnimation->setRotationAt(0, 50);
+ lowerLeftArmAnimation->setRotationAt(1, 10);
+
+ QGraphicsItemAnimation *upperRightArmAnimation = new QGraphicsItemAnimation;
+ upperRightArmAnimation->setItem(upperRightArmItem);
+ upperRightArmAnimation->setTimeLine(timeLine);
+ upperRightArmAnimation->setRotationAt(0, 300);
+ upperRightArmAnimation->setRotationAt(1, 310);
+
+ QGraphicsItemAnimation *lowerRightArmAnimation = new QGraphicsItemAnimation;
+ lowerRightArmAnimation->setItem(lowerRightArmItem);
+ lowerRightArmAnimation->setTimeLine(timeLine);
+ lowerRightArmAnimation->setRotationAt(0, 0);
+ lowerRightArmAnimation->setRotationAt(1, -70);
+
+ QGraphicsItemAnimation *upperLeftLegAnimation = new QGraphicsItemAnimation;
+ upperLeftLegAnimation->setItem(upperLeftLegItem);
+ upperLeftLegAnimation->setTimeLine(timeLine);
+ upperLeftLegAnimation->setRotationAt(0, 150);
+ upperLeftLegAnimation->setRotationAt(1, 80);
+
+ QGraphicsItemAnimation *lowerLeftLegAnimation = new QGraphicsItemAnimation;
+ lowerLeftLegAnimation->setItem(lowerLeftLegItem);
+ lowerLeftLegAnimation->setTimeLine(timeLine);
+ lowerLeftLegAnimation->setRotationAt(0, 70);
+ lowerLeftLegAnimation->setRotationAt(1, 10);
+
+ QGraphicsItemAnimation *upperRightLegAnimation = new QGraphicsItemAnimation;
+ upperRightLegAnimation->setItem(upperRightLegItem);
+ upperRightLegAnimation->setTimeLine(timeLine);
+ upperRightLegAnimation->setRotationAt(0, 40);
+ upperRightLegAnimation->setRotationAt(1, 120);
+
+ QGraphicsItemAnimation *lowerRightLegAnimation = new QGraphicsItemAnimation;
+ lowerRightLegAnimation->setItem(lowerRightLegItem);
+ lowerRightLegAnimation->setTimeLine(timeLine);
+ lowerRightLegAnimation->setRotationAt(0, 10);
+ lowerRightLegAnimation->setRotationAt(1, 50);
+
+ QGraphicsItemAnimation *torsoAnimation = new QGraphicsItemAnimation;
+ torsoAnimation->setItem(torsoItem);
+ torsoAnimation->setTimeLine(timeLine);
+ torsoAnimation->setRotationAt(0, 5);
+ torsoAnimation->setRotationAt(1, -20);
+
+ timeLine->setUpdateInterval(1000 / 25);
+ timeLine->setCurveShape(QTimeLine::SineCurve);
+ timeLine->setLoopCount(0);
+ timeLine->setDuration(2000);
+ timeLine->start();
+}
+
+Robot::~Robot()
+{
+ delete timeLine;
+}
+
+QRectF Robot::boundingRect() const
+{
+ return QRectF();
+}
+
+void Robot::paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(painter);
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+}
diff --git a/examples/graphicsview/dragdroprobot/robot.h b/examples/graphicsview/dragdroprobot/robot.h
new file mode 100644
index 0000000..c0b6d14
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/robot.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ROBOT_H
+#define ROBOT_H
+
+#include <QGraphicsItem>
+
+QT_BEGIN_NAMESPACE
+class QGraphicsSceneMouseEvent;
+class QTimeLine;
+QT_END_NAMESPACE
+
+class RobotPart : public QGraphicsItem
+{
+public:
+ RobotPart(QGraphicsItem *parent = 0);
+
+protected:
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
+ void dropEvent(QGraphicsSceneDragDropEvent *event);
+
+ QPixmap pixmap;
+ QColor color;
+ bool dragOver;
+};
+
+class RobotHead : public RobotPart
+{
+public:
+ RobotHead(QGraphicsItem *parent = 0);
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+ enum { Type = UserType + 1 };
+ int type() const;
+};
+
+class RobotTorso : public RobotPart
+{
+public:
+ RobotTorso(QGraphicsItem *parent = 0);
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+};
+
+class RobotLimb : public RobotPart
+{
+public:
+ RobotLimb(QGraphicsItem *parent = 0);
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+};
+
+class Robot : public RobotPart
+{
+public:
+ Robot();
+ ~Robot();
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+
+private:
+ QTimeLine *timeLine;
+};
+
+#endif
diff --git a/examples/graphicsview/dragdroprobot/robot.qrc b/examples/graphicsview/dragdroprobot/robot.qrc
new file mode 100644
index 0000000..b0969d2
--- /dev/null
+++ b/examples/graphicsview/dragdroprobot/robot.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/" >
+ <file>images/head.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/graphicsview/elasticnodes/edge.cpp b/examples/graphicsview/elasticnodes/edge.cpp
new file mode 100644
index 0000000..4018c25
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/edge.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QPainter>
+
+#include "edge.h"
+#include "node.h"
+
+#include <math.h>
+
+static const double Pi = 3.14159265358979323846264338327950288419717;
+static double TwoPi = 2.0 * Pi;
+
+Edge::Edge(Node *sourceNode, Node *destNode)
+ : arrowSize(10)
+{
+ setAcceptedMouseButtons(0);
+ source = sourceNode;
+ dest = destNode;
+ source->addEdge(this);
+ dest->addEdge(this);
+ adjust();
+}
+
+Edge::~Edge()
+{
+}
+
+Node *Edge::sourceNode() const
+{
+ return source;
+}
+
+void Edge::setSourceNode(Node *node)
+{
+ source = node;
+ adjust();
+}
+
+Node *Edge::destNode() const
+{
+ return dest;
+}
+
+void Edge::setDestNode(Node *node)
+{
+ dest = node;
+ adjust();
+}
+
+void Edge::adjust()
+{
+ if (!source || !dest)
+ return;
+
+ QLineF line(mapFromItem(source, 0, 0), mapFromItem(dest, 0, 0));
+ qreal length = line.length();
+ QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length);
+
+ prepareGeometryChange();
+ sourcePoint = line.p1() + edgeOffset;
+ destPoint = line.p2() - edgeOffset;
+}
+
+QRectF Edge::boundingRect() const
+{
+ if (!source || !dest)
+ return QRectF();
+
+ qreal penWidth = 1;
+ qreal extra = (penWidth + arrowSize) / 2.0;
+
+ return QRectF(sourcePoint, QSizeF(destPoint.x() - sourcePoint.x(),
+ destPoint.y() - sourcePoint.y()))
+ .normalized()
+ .adjusted(-extra, -extra, extra, extra);
+}
+
+void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ if (!source || !dest)
+ return;
+
+ // Draw the line itself
+ QLineF line(sourcePoint, destPoint);
+ painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+ painter->drawLine(line);
+
+ // Draw the arrows if there's enough room
+ double angle = ::acos(line.dx() / line.length());
+ if (line.dy() >= 0)
+ angle = TwoPi - angle;
+
+ QPointF sourceArrowP1 = sourcePoint + QPointF(sin(angle + Pi / 3) * arrowSize,
+ cos(angle + Pi / 3) * arrowSize);
+ QPointF sourceArrowP2 = sourcePoint + QPointF(sin(angle + Pi - Pi / 3) * arrowSize,
+ cos(angle + Pi - Pi / 3) * arrowSize);
+ QPointF destArrowP1 = destPoint + QPointF(sin(angle - Pi / 3) * arrowSize,
+ cos(angle - Pi / 3) * arrowSize);
+ QPointF destArrowP2 = destPoint + QPointF(sin(angle - Pi + Pi / 3) * arrowSize,
+ cos(angle - Pi + Pi / 3) * arrowSize);
+
+ painter->setBrush(Qt::black);
+ painter->drawPolygon(QPolygonF() << line.p1() << sourceArrowP1 << sourceArrowP2);
+ painter->drawPolygon(QPolygonF() << line.p2() << destArrowP1 << destArrowP2);
+}
diff --git a/examples/graphicsview/elasticnodes/edge.h b/examples/graphicsview/elasticnodes/edge.h
new file mode 100644
index 0000000..9078870
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/edge.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EDGE_H
+#define EDGE_H
+
+#include <QGraphicsItem>
+
+class Node;
+
+class Edge : public QGraphicsItem
+{
+public:
+ Edge(Node *sourceNode, Node *destNode);
+ ~Edge();
+
+ Node *sourceNode() const;
+ void setSourceNode(Node *node);
+
+ Node *destNode() const;
+ void setDestNode(Node *node);
+
+ void adjust();
+
+ enum { Type = UserType + 2 };
+ int type() const { return Type; }
+
+protected:
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+private:
+ Node *source, *dest;
+
+ QPointF sourcePoint;
+ QPointF destPoint;
+ qreal arrowSize;
+};
+
+#endif
diff --git a/examples/graphicsview/elasticnodes/elasticnodes.pro b/examples/graphicsview/elasticnodes/elasticnodes.pro
new file mode 100644
index 0000000..77ca706
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/elasticnodes.pro
@@ -0,0 +1,16 @@
+HEADERS += \
+ edge.h \
+ node.h \
+ graphwidget.h
+
+SOURCES += \
+ edge.cpp \
+ main.cpp \
+ node.cpp \
+ graphwidget.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/elasticnodes
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS elasticnodes.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/elasticnodes
+INSTALLS += target sources
diff --git a/examples/graphicsview/elasticnodes/graphwidget.cpp b/examples/graphicsview/elasticnodes/graphwidget.cpp
new file mode 100644
index 0000000..5c5029c
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/graphwidget.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "graphwidget.h"
+#include "edge.h"
+#include "node.h"
+
+#include <QDebug>
+#include <QGraphicsScene>
+#include <QWheelEvent>
+
+#include <math.h>
+
+GraphWidget::GraphWidget()
+ : timerId(0)
+{
+ QGraphicsScene *scene = new QGraphicsScene(this);
+ scene->setItemIndexMethod(QGraphicsScene::NoIndex);
+ scene->setSceneRect(-200, -200, 400, 400);
+ setScene(scene);
+ setCacheMode(CacheBackground);
+ setViewportUpdateMode(BoundingRectViewportUpdate);
+ setRenderHint(QPainter::Antialiasing);
+ setTransformationAnchor(AnchorUnderMouse);
+ setResizeAnchor(AnchorViewCenter);
+
+ Node *node1 = new Node(this);
+ Node *node2 = new Node(this);
+ Node *node3 = new Node(this);
+ Node *node4 = new Node(this);
+ centerNode = new Node(this);
+ Node *node6 = new Node(this);
+ Node *node7 = new Node(this);
+ Node *node8 = new Node(this);
+ Node *node9 = new Node(this);
+ scene->addItem(node1);
+ scene->addItem(node2);
+ scene->addItem(node3);
+ scene->addItem(node4);
+ scene->addItem(centerNode);
+ scene->addItem(node6);
+ scene->addItem(node7);
+ scene->addItem(node8);
+ scene->addItem(node9);
+ scene->addItem(new Edge(node1, node2));
+ scene->addItem(new Edge(node2, node3));
+ scene->addItem(new Edge(node2, centerNode));
+ scene->addItem(new Edge(node3, node6));
+ scene->addItem(new Edge(node4, node1));
+ scene->addItem(new Edge(node4, centerNode));
+ scene->addItem(new Edge(centerNode, node6));
+ scene->addItem(new Edge(centerNode, node8));
+ scene->addItem(new Edge(node6, node9));
+ scene->addItem(new Edge(node7, node4));
+ scene->addItem(new Edge(node8, node7));
+ scene->addItem(new Edge(node9, node8));
+
+ node1->setPos(-50, -50);
+ node2->setPos(0, -50);
+ node3->setPos(50, -50);
+ node4->setPos(-50, 0);
+ centerNode->setPos(0, 0);
+ node6->setPos(50, 0);
+ node7->setPos(-50, 50);
+ node8->setPos(0, 50);
+ node9->setPos(50, 50);
+
+ scale(qreal(0.8), qreal(0.8));
+ setMinimumSize(400, 400);
+ setWindowTitle(tr("Elastic Nodes"));
+}
+
+void GraphWidget::itemMoved()
+{
+ if (!timerId)
+ timerId = startTimer(1000 / 25);
+}
+
+void GraphWidget::keyPressEvent(QKeyEvent *event)
+{
+ switch (event->key()) {
+ case Qt::Key_Up:
+ centerNode->moveBy(0, -20);
+ break;
+ case Qt::Key_Down:
+ centerNode->moveBy(0, 20);
+ break;
+ case Qt::Key_Left:
+ centerNode->moveBy(-20, 0);
+ break;
+ case Qt::Key_Right:
+ centerNode->moveBy(20, 0);
+ break;
+ case Qt::Key_Plus:
+ scaleView(qreal(1.2));
+ break;
+ case Qt::Key_Minus:
+ scaleView(1 / qreal(1.2));
+ break;
+ case Qt::Key_Space:
+ case Qt::Key_Enter:
+ foreach (QGraphicsItem *item, scene()->items()) {
+ if (qgraphicsitem_cast<Node *>(item))
+ item->setPos(-150 + qrand() % 300, -150 + qrand() % 300);
+ }
+ break;
+ default:
+ QGraphicsView::keyPressEvent(event);
+ }
+}
+
+void GraphWidget::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+
+ QList<Node *> nodes;
+ foreach (QGraphicsItem *item, scene()->items()) {
+ if (Node *node = qgraphicsitem_cast<Node *>(item))
+ nodes << node;
+ }
+
+ foreach (Node *node, nodes)
+ node->calculateForces();
+
+ bool itemsMoved = false;
+ foreach (Node *node, nodes) {
+ if (node->advance())
+ itemsMoved = true;
+ }
+
+ if (!itemsMoved) {
+ killTimer(timerId);
+ timerId = 0;
+ }
+}
+
+void GraphWidget::wheelEvent(QWheelEvent *event)
+{
+ scaleView(pow((double)2, -event->delta() / 240.0));
+}
+
+void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
+{
+ Q_UNUSED(rect);
+
+ // Shadow
+ QRectF sceneRect = this->sceneRect();
+ QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
+ QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
+ if (rightShadow.intersects(rect) || rightShadow.contains(rect))
+ painter->fillRect(rightShadow, Qt::darkGray);
+ if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
+ painter->fillRect(bottomShadow, Qt::darkGray);
+
+ // Fill
+ QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
+ gradient.setColorAt(0, Qt::white);
+ gradient.setColorAt(1, Qt::lightGray);
+ painter->fillRect(rect.intersect(sceneRect), gradient);
+ painter->setBrush(Qt::NoBrush);
+ painter->drawRect(sceneRect);
+
+ // Text
+ QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
+ sceneRect.width() - 4, sceneRect.height() - 4);
+ QString message(tr("Click and drag the nodes around, and zoom with the mouse "
+ "wheel or the '+' and '-' keys"));
+
+ QFont font = painter->font();
+ font.setBold(true);
+ font.setPointSize(14);
+ painter->setFont(font);
+ painter->setPen(Qt::lightGray);
+ painter->drawText(textRect.translated(2, 2), message);
+ painter->setPen(Qt::black);
+ painter->drawText(textRect, message);
+}
+
+void GraphWidget::scaleView(qreal scaleFactor)
+{
+ qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
+ if (factor < 0.07 || factor > 100)
+ return;
+
+ scale(scaleFactor, scaleFactor);
+}
diff --git a/examples/graphicsview/elasticnodes/graphwidget.h b/examples/graphicsview/elasticnodes/graphwidget.h
new file mode 100644
index 0000000..2c86c76
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/graphwidget.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GRAPHWIDGET_H
+#define GRAPHWIDGET_H
+
+#include <QtGui/QGraphicsView>
+
+class Node;
+
+class GraphWidget : public QGraphicsView
+{
+ Q_OBJECT
+
+public:
+ GraphWidget();
+
+ void itemMoved();
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+ void timerEvent(QTimerEvent *event);
+ void wheelEvent(QWheelEvent *event);
+ void drawBackground(QPainter *painter, const QRectF &rect);
+
+ void scaleView(qreal scaleFactor);
+
+private:
+ int timerId;
+ Node *centerNode;
+};
+
+#endif
diff --git a/examples/graphicsview/elasticnodes/main.cpp b/examples/graphicsview/elasticnodes/main.cpp
new file mode 100644
index 0000000..8043d58
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "graphwidget.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
+
+ GraphWidget widget;
+ widget.show();
+ return app.exec();
+}
diff --git a/examples/graphicsview/elasticnodes/node.cpp b/examples/graphicsview/elasticnodes/node.cpp
new file mode 100644
index 0000000..6942fa0
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/node.cpp
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGraphicsScene>
+#include <QGraphicsSceneMouseEvent>
+#include <QPainter>
+#include <QStyleOption>
+
+#include "edge.h"
+#include "node.h"
+#include "graphwidget.h"
+
+Node::Node(GraphWidget *graphWidget)
+ : graph(graphWidget)
+{
+ setFlag(ItemIsMovable);
+ setCacheMode(DeviceCoordinateCache);
+ setZValue(1);
+}
+
+void Node::addEdge(Edge *edge)
+{
+ edgeList << edge;
+ edge->adjust();
+}
+
+QList<Edge *> Node::edges() const
+{
+ return edgeList;
+}
+
+void Node::calculateForces()
+{
+ if (!scene() || scene()->mouseGrabberItem() == this) {
+ newPos = pos();
+ return;
+ }
+
+ // Sum up all forces pushing this item away
+ qreal xvel = 0;
+ qreal yvel = 0;
+ foreach (QGraphicsItem *item, scene()->items()) {
+ Node *node = qgraphicsitem_cast<Node *>(item);
+ if (!node)
+ continue;
+
+ QLineF line(mapFromItem(node, 0, 0), QPointF(0, 0));
+ qreal dx = line.dx();
+ qreal dy = line.dy();
+ double l = 2.0 * (dx * dx + dy * dy);
+ if (l > 0) {
+ xvel += (dx * 150.0) / l;
+ yvel += (dy * 150.0) / l;
+ }
+ }
+
+ // Now subtract all forces pulling items together
+ double weight = (edgeList.size() + 1) * 10;
+ foreach (Edge *edge, edgeList) {
+ QPointF pos;
+ if (edge->sourceNode() == this)
+ pos = mapFromItem(edge->destNode(), 0, 0);
+ else
+ pos = mapFromItem(edge->sourceNode(), 0, 0);
+ xvel += pos.x() / weight;
+ yvel += pos.y() / weight;
+ }
+
+ if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1)
+ xvel = yvel = 0;
+
+ QRectF sceneRect = scene()->sceneRect();
+ newPos = pos() + QPointF(xvel, yvel);
+ newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10));
+ newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10));
+}
+
+bool Node::advance()
+{
+ if (newPos == pos())
+ return false;
+
+ setPos(newPos);
+ return true;
+}
+
+QRectF Node::boundingRect() const
+{
+ qreal adjust = 2;
+ return QRectF(-10 - adjust, -10 - adjust,
+ 23 + adjust, 23 + adjust);
+}
+
+QPainterPath Node::shape() const
+{
+ QPainterPath path;
+ path.addEllipse(-10, -10, 20, 20);
+ return path;
+}
+
+void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
+{
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(Qt::darkGray);
+ painter->drawEllipse(-7, -7, 20, 20);
+
+ QRadialGradient gradient(-3, -3, 10);
+ if (option->state & QStyle::State_Sunken) {
+ gradient.setCenter(3, 3);
+ gradient.setFocalPoint(3, 3);
+ gradient.setColorAt(1, QColor(Qt::yellow).light(120));
+ gradient.setColorAt(0, QColor(Qt::darkYellow).light(120));
+ } else {
+ gradient.setColorAt(0, Qt::yellow);
+ gradient.setColorAt(1, Qt::darkYellow);
+ }
+ painter->setBrush(gradient);
+ painter->setPen(QPen(Qt::black, 0));
+ painter->drawEllipse(-10, -10, 20, 20);
+}
+
+QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
+{
+ switch (change) {
+ case ItemPositionHasChanged:
+ foreach (Edge *edge, edgeList)
+ edge->adjust();
+ graph->itemMoved();
+ break;
+ default:
+ break;
+ };
+
+ return QGraphicsItem::itemChange(change, value);
+}
+
+void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ update();
+ QGraphicsItem::mousePressEvent(event);
+}
+
+void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ update();
+ QGraphicsItem::mouseReleaseEvent(event);
+}
diff --git a/examples/graphicsview/elasticnodes/node.h b/examples/graphicsview/elasticnodes/node.h
new file mode 100644
index 0000000..42309c4
--- /dev/null
+++ b/examples/graphicsview/elasticnodes/node.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef NODE_H
+#define NODE_H
+
+#include <QGraphicsItem>
+#include <QList>
+
+class Edge;
+class GraphWidget;
+QT_BEGIN_NAMESPACE
+class QGraphicsSceneMouseEvent;
+QT_END_NAMESPACE
+
+class Node : public QGraphicsItem
+{
+public:
+ Node(GraphWidget *graphWidget);
+
+ void addEdge(Edge *edge);
+ QList<Edge *> edges() const;
+
+ enum { Type = UserType + 1 };
+ int type() const { return Type; }
+
+ void calculateForces();
+ bool advance();
+
+ QRectF boundingRect() const;
+ QPainterPath shape() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+protected:
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+private:
+ QList<Edge *> edgeList;
+ QPointF newPos;
+ GraphWidget *graph;
+};
+
+#endif
diff --git a/examples/graphicsview/graphicsview.pro b/examples/graphicsview/graphicsview.pro
new file mode 100644
index 0000000..66eb0b4
--- /dev/null
+++ b/examples/graphicsview/graphicsview.pro
@@ -0,0 +1,18 @@
+TEMPLATE = \
+ subdirs
+SUBDIRS = \
+ elasticnodes \
+ collidingmice \
+ diagramscene \
+ dragdroprobot \
+ padnavigator \
+ basicgraphicslayouts
+
+contains(QT_CONFIG, qt3support):SUBDIRS += portedcanvas portedasteroids
+contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= dragdroprobot
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS graphicsview.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview
+INSTALLS += target sources
diff --git a/examples/graphicsview/padnavigator/backside.ui b/examples/graphicsview/padnavigator/backside.ui
new file mode 100644
index 0000000..afa488c
--- /dev/null
+++ b/examples/graphicsview/padnavigator/backside.ui
@@ -0,0 +1,208 @@
+<ui version="4.0" >
+ <class>BackSide</class>
+ <widget class="QWidget" name="BackSide" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>378</width>
+ <height>385</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>BackSide</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Settings</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Title:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="hostName" >
+ <property name="text" >
+ <string>Pad Navigator Example</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Modified:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Extent</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QSlider" name="horizontalSlider" >
+ <property name="value" >
+ <number>42</number>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox" >
+ <property name="value" >
+ <number>42</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QDateTimeEdit" name="dateTimeEdit" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Other input</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QTreeWidget" name="treeWidget" >
+ <column>
+ <property name="text" >
+ <string>Widgets On Graphics View</string>
+ </property>
+ </column>
+ <item>
+ <property name="text" >
+ <string>QGraphicsProxyWidget</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsWidget</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QObject</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsItem</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsGridLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLinearLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>groupBox</tabstop>
+ <tabstop>hostName</tabstop>
+ <tabstop>dateTimeEdit</tabstop>
+ <tabstop>horizontalSlider</tabstop>
+ <tabstop>spinBox</tabstop>
+ <tabstop>groupBox_2</tabstop>
+ <tabstop>treeWidget</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>horizontalSlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>spinBox</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>184</x>
+ <y>125</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>275</x>
+ <y>127</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>horizontalSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>272</x>
+ <y>114</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>190</x>
+ <y>126</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/graphicsview/padnavigator/images/artsfftscope.png b/examples/graphicsview/padnavigator/images/artsfftscope.png
new file mode 100644
index 0000000..4db003f
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/artsfftscope.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/blue_angle_swirl.jpg b/examples/graphicsview/padnavigator/images/blue_angle_swirl.jpg
new file mode 100644
index 0000000..5bf0deb
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/blue_angle_swirl.jpg
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/kontact_contacts.png b/examples/graphicsview/padnavigator/images/kontact_contacts.png
new file mode 100644
index 0000000..6fb4cc8
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/kontact_contacts.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/kontact_journal.png b/examples/graphicsview/padnavigator/images/kontact_journal.png
new file mode 100644
index 0000000..b1fedb6
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/kontact_journal.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/kontact_mail.png b/examples/graphicsview/padnavigator/images/kontact_mail.png
new file mode 100644
index 0000000..672f8fa
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/kontact_mail.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/kontact_notes.png b/examples/graphicsview/padnavigator/images/kontact_notes.png
new file mode 100644
index 0000000..229bf73
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/kontact_notes.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/kopeteavailable.png b/examples/graphicsview/padnavigator/images/kopeteavailable.png
new file mode 100644
index 0000000..2eaf41a
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/kopeteavailable.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/metacontact_online.png b/examples/graphicsview/padnavigator/images/metacontact_online.png
new file mode 100644
index 0000000..6a398dd
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/metacontact_online.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/images/minitools.png b/examples/graphicsview/padnavigator/images/minitools.png
new file mode 100644
index 0000000..0248c9d
--- /dev/null
+++ b/examples/graphicsview/padnavigator/images/minitools.png
Binary files differ
diff --git a/examples/graphicsview/padnavigator/main.cpp b/examples/graphicsview/padnavigator/main.cpp
new file mode 100644
index 0000000..dc5ff0c
--- /dev/null
+++ b/examples/graphicsview/padnavigator/main.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#ifndef QT_NO_OPENGL
+# include <QtOpenGL>
+#endif
+
+#include "panel.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Q_INIT_RESOURCE(padnavigator);
+
+ Panel panel(3, 3);
+ panel.setFocus();
+ panel.show();
+
+ return app.exec();
+}
diff --git a/examples/graphicsview/padnavigator/padnavigator.pro b/examples/graphicsview/padnavigator/padnavigator.pro
new file mode 100644
index 0000000..0d094c6
--- /dev/null
+++ b/examples/graphicsview/padnavigator/padnavigator.pro
@@ -0,0 +1,24 @@
+HEADERS += \
+ panel.h \
+ roundrectitem.h \
+ splashitem.h
+
+SOURCES += \
+ panel.cpp \
+ roundrectitem.cpp \
+ splashitem.cpp \
+ main.cpp
+
+RESOURCES += \
+ padnavigator.qrc
+
+FORMS += \
+ backside.ui
+
+contains(QT_CONFIG, opengl):QT += opengl
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/padnavigator
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS padnavigator.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/padnavigator
+INSTALLS += target sources
diff --git a/examples/graphicsview/padnavigator/padnavigator.qrc b/examples/graphicsview/padnavigator/padnavigator.qrc
new file mode 100644
index 0000000..30ee8e1
--- /dev/null
+++ b/examples/graphicsview/padnavigator/padnavigator.qrc
@@ -0,0 +1,14 @@
+<RCC>
+ <qresource>
+ <file>images/blue_angle_swirl.jpg</file>
+ <file>images/artsfftscope.png</file>
+ <file>images/kontact_contacts.png</file>
+ <file>images/kontact_journal.png</file>
+ <file>images/kontact_mail.png</file>
+ <file>images/kontact_notes.png</file>
+ <file>images/kopeteavailable.png</file>
+ <file>images/metacontact_online.png</file>
+ <file>images/minitools.png</file>
+ <file>images/blue_angle_swirl.jpg</file>
+ </qresource>
+</RCC>
diff --git a/examples/graphicsview/padnavigator/panel.cpp b/examples/graphicsview/padnavigator/panel.cpp
new file mode 100644
index 0000000..28a3cb4
--- /dev/null
+++ b/examples/graphicsview/padnavigator/panel.cpp
@@ -0,0 +1,238 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "panel.h"
+#include "roundrectitem.h"
+#include "splashitem.h"
+#include "ui_backside.h"
+
+#ifndef QT_NO_OPENGL
+#include <QtOpenGL/QtOpenGL>
+#else
+#endif
+#include <QtGui/QtGui>
+
+#include <math.h>
+
+Panel::Panel(int width, int height)
+ : selectedX(0),
+ selectedY(0),
+ width(width),
+ height(height),
+ flipped(false),
+ flipLeft(true)
+{
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setCacheMode(CacheBackground);
+ setViewportUpdateMode(FullViewportUpdate);
+ setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform
+ | QPainter::TextAntialiasing);
+ setBackgroundBrush(QPixmap(":/images/blue_angle_swirl.jpg"));
+#ifndef QT_NO_OPENGL
+ setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+#endif
+ setMinimumSize(50, 50);
+
+ selectionTimeLine = new QTimeLine(150, this);
+ flipTimeLine = new QTimeLine(500, this);
+
+ QRectF bounds((-width / 2.0) * 150, (-height / 2.0) * 150, width * 150, height * 150);
+
+ scene = new QGraphicsScene(bounds, this);
+ scene->setItemIndexMethod(QGraphicsScene::NoIndex);
+ setScene(scene);
+
+ baseItem = new RoundRectItem(bounds, QColor(226, 255, 92, 64));
+ scene->addItem(baseItem);
+
+ QWidget *embed = new QWidget;
+ ui = new Ui_BackSide;
+ ui->setupUi(embed);
+ ui->hostName->setFocus();
+
+ backItem = new RoundRectItem(bounds, embed->palette().window(), embed);
+ backItem->setTransform(QTransform().rotate(180, Qt::YAxis));
+ backItem->setParentItem(baseItem);
+
+ selectionItem = new RoundRectItem(QRectF(-60, -60, 120, 120), Qt::gray);
+ selectionItem->setParentItem(baseItem);
+ selectionItem->setZValue(-1);
+ selectionItem->setPos(posForLocation(0, 0));
+ startPos = selectionItem->pos();
+
+ grid = new QGraphicsItem **[height];
+
+ for (int y = 0; y < height; ++y) {
+ grid[y] = new QGraphicsItem *[width];
+
+ for (int x = 0; x < width; ++x) {
+ RoundRectItem *item = new RoundRectItem(QRectF(-54, -54, 108, 108),
+ QColor(214, 240, 110, 128));
+ item->setPos(posForLocation(x, y));
+
+ item->setParentItem(baseItem);
+ item->setFlag(QGraphicsItem::ItemIsFocusable);
+ grid[y][x] = item;
+
+ switch (qrand() % 9) {
+ case 0: item->setPixmap(QPixmap(":/images/kontact_contacts.png")); break;
+ case 1: item->setPixmap(QPixmap(":/images/kontact_journal.png")); break;
+ case 2: item->setPixmap(QPixmap(":/images/kontact_notes.png")); break;
+ case 3: item->setPixmap(QPixmap(":/images/kopeteavailable.png")); break;
+ case 4: item->setPixmap(QPixmap(":/images/metacontact_online.png")); break;
+ case 5: item->setPixmap(QPixmap(":/images/minitools.png")); break;
+ case 6: item->setPixmap(QPixmap(":/images/kontact_journal.png")); break;
+ case 7: item->setPixmap(QPixmap(":/images/kontact_contacts.png")); break;
+ case 8: item->setPixmap(QPixmap(":/images/kopeteavailable.png")); break;
+ default:
+ break;
+ }
+
+ connect(item, SIGNAL(activated()), this, SLOT(flip()));
+ }
+ }
+
+ grid[0][0]->setFocus();
+
+ connect(backItem, SIGNAL(activated()),
+ this, SLOT(flip()));
+ connect(selectionTimeLine, SIGNAL(valueChanged(qreal)),
+ this, SLOT(updateSelectionStep(qreal)));
+ connect(flipTimeLine, SIGNAL(valueChanged(qreal)),
+ this, SLOT(updateFlipStep(qreal)));
+
+ splash = new SplashItem;
+ splash->setZValue(5);
+ splash->setPos(-splash->rect().width() / 2, scene->sceneRect().top());
+ scene->addItem(splash);
+
+ splash->grabKeyboard();
+
+ updateSelectionStep(0);
+
+ setWindowTitle(tr("Pad Navigator Example"));
+}
+
+Panel::~Panel()
+{
+ for (int y = 0; y < height; ++y)
+ delete [] grid[y];
+ delete [] grid;
+}
+
+void Panel::keyPressEvent(QKeyEvent *event)
+{
+ if (splash->isVisible() || event->key() == Qt::Key_Return || flipped) {
+ QGraphicsView::keyPressEvent(event);
+ return;
+ }
+
+ selectedX = (selectedX + width + (event->key() == Qt::Key_Right) - (event->key() == Qt::Key_Left)) % width;
+ selectedY = (selectedY + height + (event->key() == Qt::Key_Down) - (event->key() == Qt::Key_Up)) % height;
+ grid[selectedY][selectedX]->setFocus();
+
+ selectionTimeLine->stop();
+ startPos = selectionItem->pos();
+ endPos = posForLocation(selectedX, selectedY);
+ selectionTimeLine->start();
+}
+
+void Panel::resizeEvent(QResizeEvent *event)
+{
+ QGraphicsView::resizeEvent(event);
+ fitInView(scene->sceneRect(), Qt::KeepAspectRatio);
+}
+
+void Panel::updateSelectionStep(qreal val)
+{
+ QPointF newPos(startPos.x() + (endPos - startPos).x() * val,
+ startPos.y() + (endPos - startPos).y() * val);
+ selectionItem->setPos(newPos);
+
+ QTransform transform;
+ yrot = newPos.x() / 6.0;
+ xrot = newPos.y() / 6.0;
+ transform.rotate(newPos.x() / 6.0, Qt::YAxis);
+ transform.rotate(newPos.y() / 6.0, Qt::XAxis);
+ baseItem->setTransform(transform);
+}
+
+void Panel::updateFlipStep(qreal val)
+{
+ qreal finalxrot = xrot - xrot * val;
+ qreal finalyrot;
+ if (flipLeft)
+ finalyrot = yrot - yrot * val - 180 * val;
+ else
+ finalyrot = yrot - yrot * val + 180 * val;
+ QTransform transform;
+ transform.rotate(finalyrot, Qt::YAxis);
+ transform.rotate(finalxrot, Qt::XAxis);
+ qreal scale = 1 - sin(3.14 * val) * 0.3;
+ transform.scale(scale, scale);
+ baseItem->setTransform(transform);
+ if (val == 0)
+ grid[selectedY][selectedX]->setFocus();
+}
+
+void Panel::flip()
+{
+ if (flipTimeLine->state() == QTimeLine::Running)
+ return;
+
+ if (flipTimeLine->currentValue() == 0) {
+ flipTimeLine->setDirection(QTimeLine::Forward);
+ flipTimeLine->start();
+ flipped = true;
+ flipLeft = selectionItem->pos().x() < 0;
+ } else {
+ flipTimeLine->setDirection(QTimeLine::Backward);
+ flipTimeLine->start();
+ flipped = false;
+ }
+}
+
+QPointF Panel::posForLocation(int x, int y) const
+{
+ return QPointF(x * 150, y * 150)
+ - QPointF((width - 1) * 75, (height - 1) * 75);
+}
diff --git a/examples/graphicsview/padnavigator/panel.h b/examples/graphicsview/padnavigator/panel.h
new file mode 100644
index 0000000..03876b7
--- /dev/null
+++ b/examples/graphicsview/padnavigator/panel.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qgraphicsview.h>
+
+QT_BEGIN_NAMESPACE
+class QTimeLine;
+class Ui_BackSide;
+QT_END_NAMESPACE;
+
+class RoundRectItem;
+
+class Panel : public QGraphicsView
+{
+ Q_OBJECT
+public:
+ Panel(int width, int height);
+ ~Panel();
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+ void resizeEvent(QResizeEvent *event);
+
+private Q_SLOTS:
+ void updateSelectionStep(qreal val);
+ void updateFlipStep(qreal val);
+ void flip();
+
+private:
+ QPointF posForLocation(int x, int y) const;
+
+ QGraphicsScene *scene;
+ RoundRectItem *selectionItem;
+ RoundRectItem *baseItem;
+ RoundRectItem *backItem;
+ QGraphicsWidget *splash;
+ QTimeLine *selectionTimeLine;
+ QTimeLine *flipTimeLine;
+ int selectedX, selectedY;
+
+ QGraphicsItem ***grid;
+
+ QPointF startPos;
+ QPointF endPos;
+ qreal xrot, yrot;
+ qreal xrot2, yrot2;
+
+ int width;
+ int height;
+ bool flipped;
+ bool flipLeft;
+
+ Ui_BackSide *ui;
+};
diff --git a/examples/graphicsview/padnavigator/roundrectitem.cpp b/examples/graphicsview/padnavigator/roundrectitem.cpp
new file mode 100644
index 0000000..c5dc35d
--- /dev/null
+++ b/examples/graphicsview/padnavigator/roundrectitem.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "roundrectitem.h"
+
+#include <QtGui/QtGui>
+
+RoundRectItem::RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget)
+ : QGraphicsRectItem(rect),
+ brush(brush),
+ timeLine(75),
+ lastVal(0),
+ opa(1),
+ proxyWidget(0)
+{
+ connect(&timeLine, SIGNAL(valueChanged(qreal)),
+ this, SLOT(updateValue(qreal)));
+
+ if (embeddedWidget) {
+ proxyWidget = new QGraphicsProxyWidget(this);
+ proxyWidget->setFocusPolicy(Qt::StrongFocus);
+ proxyWidget->setWidget(embeddedWidget);
+ proxyWidget->setGeometry(boundingRect().adjusted(25, 25, -25, -25));
+ }
+}
+
+void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ QTransform x = painter->worldTransform();
+
+ QLineF unit = x.map(QLineF(0, 0, 1, 1));
+ if (unit.p1().x() > unit.p2().x() || unit.p1().y() > unit.p2().y()) {
+ if (proxyWidget && proxyWidget->isVisible()) {
+ proxyWidget->hide();
+ proxyWidget->setGeometry(rect());
+ }
+ return;
+ }
+
+ if (proxyWidget && !proxyWidget->isVisible()) {
+ proxyWidget->show();
+ proxyWidget->setFocus();
+ }
+ if (proxyWidget && proxyWidget->pos() != QPoint())
+ proxyWidget->setGeometry(boundingRect().adjusted(25, 25, -25, -25));
+
+ painter->setOpacity(opacity());
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(QColor(0, 0, 0, 64));
+ painter->drawRoundRect(rect().translated(2, 2));
+
+ if (!proxyWidget) {
+ QLinearGradient gradient(rect().topLeft(), rect().bottomRight());
+ const QColor col = brush.color();
+ gradient.setColorAt(0, col);
+ gradient.setColorAt(1, col.dark(int(200 + lastVal * 50)));
+ painter->setBrush(gradient);
+ } else {
+ painter->setBrush(brush);
+ }
+
+ painter->setPen(QPen(Qt::black, 1));
+ painter->drawRoundRect(rect());
+ if (!pix.isNull()) {
+ painter->scale(1.95, 1.95);
+ painter->drawPixmap(-pix.width() / 2, -pix.height() / 2, pix);;
+ }
+}
+
+QRectF RoundRectItem::boundingRect() const
+{
+ qreal penW = 0.5;
+ qreal shadowW = 2.0;
+ return rect().adjusted(-penW, -penW, penW + shadowW, penW + shadowW);
+}
+
+void RoundRectItem::setPixmap(const QPixmap &pixmap)
+{
+ pix = pixmap;
+ if (scene() && isVisible())
+ update();
+}
+
+qreal RoundRectItem::opacity() const
+{
+ RoundRectItem *parent = parentItem() ? (RoundRectItem *)parentItem() : 0;
+ return opa + (parent ? parent->opacity() : 0);
+}
+
+void RoundRectItem::setOpacity(qreal opacity)
+{
+ opa = opacity;
+ update();
+}
+
+void RoundRectItem::keyPressEvent(QKeyEvent *event)
+{
+ if (event->isAutoRepeat() || event->key() != Qt::Key_Return
+ || (timeLine.state() == QTimeLine::Running && timeLine.direction() == QTimeLine::Forward)) {
+ QGraphicsRectItem::keyPressEvent(event);
+ return;
+ }
+
+ timeLine.stop();
+ timeLine.setDirection(QTimeLine::Forward);
+ timeLine.start();
+ emit activated();
+}
+
+void RoundRectItem::keyReleaseEvent(QKeyEvent *event)
+{
+ if (event->key() != Qt::Key_Return) {
+ QGraphicsRectItem::keyReleaseEvent(event);
+ return;
+ }
+ timeLine.stop();
+ timeLine.setDirection(QTimeLine::Backward);
+ timeLine.start();
+}
+
+void RoundRectItem::updateValue(qreal value)
+{
+ lastVal = value;
+ if (!proxyWidget)
+ setTransform(QTransform().scale(1 - value / 10.0, 1 - value / 10.0));
+}
diff --git a/examples/graphicsview/padnavigator/roundrectitem.h b/examples/graphicsview/padnavigator/roundrectitem.h
new file mode 100644
index 0000000..33e33d7
--- /dev/null
+++ b/examples/graphicsview/padnavigator/roundrectitem.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qobject.h>
+#include <QtCore/qtimeline.h>
+#include <QtGui/qgraphicsitem.h>
+#include <QtGui/qbrush.h>
+
+QT_BEGIN_NAMESPACE
+class QGraphicsProxyWidget;
+QT_END_NAMESPACE;
+
+class RoundRectItem : public QObject, public QGraphicsRectItem
+{
+ Q_OBJECT
+public:
+ RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget = 0);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
+ QRectF boundingRect() const;
+
+ void setPixmap(const QPixmap &pixmap);
+
+ qreal opacity() const;
+ void setOpacity(qreal opacity);
+
+Q_SIGNALS:
+ void activated();
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+ void keyReleaseEvent(QKeyEvent *event);
+
+private slots:
+ void updateValue(qreal value);
+
+private:
+ QBrush brush;
+ QPixmap pix;
+ QTimeLine timeLine;
+ qreal lastVal;
+ qreal opa;
+
+ QGraphicsProxyWidget *proxyWidget;
+};
diff --git a/examples/graphicsview/padnavigator/splashitem.cpp b/examples/graphicsview/padnavigator/splashitem.cpp
new file mode 100644
index 0000000..2a374bf
--- /dev/null
+++ b/examples/graphicsview/padnavigator/splashitem.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "splashitem.h"
+
+#include <QtGui/QtGui>
+
+SplashItem::SplashItem(QGraphicsItem *parent)
+ : QGraphicsWidget(parent)
+{
+ opacity = 1.0;
+
+
+ timeLine = new QTimeLine(350);
+ timeLine->setCurveShape(QTimeLine::EaseInCurve);
+ connect(timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(setValue(qreal)));
+
+ text = tr("Welcome to the Pad Navigator Example. You can use the"
+ " keyboard arrows to navigate the icons, and press enter"
+ " to activate an item. Please press any key to continue.");
+ resize(400, 175);
+}
+
+void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ painter->setOpacity(opacity);
+ painter->setPen(QPen(Qt::black, 2));
+ painter->setBrush(QColor(245, 245, 255, 220));
+ painter->setClipRect(rect());
+ painter->drawRoundRect(3, -100 + 3, 400 - 6, 250 - 6);
+
+ QRectF textRect = rect().adjusted(10, 10, -10, -10);
+ int flags = Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap;
+
+ QFont font;
+ font.setPixelSize(18);
+ painter->setPen(Qt::black);
+ painter->setFont(font);
+ painter->drawText(textRect, flags, text);
+}
+
+void SplashItem::keyPressEvent(QKeyEvent * /* event */)
+{
+ if (timeLine->state() == QTimeLine::NotRunning)
+ timeLine->start();
+}
+
+void SplashItem::setValue(qreal value)
+{
+ opacity = 1 - value;
+ setPos(x(), scene()->sceneRect().top() - rect().height() * value);
+ if (value == 1)
+ hide();
+}
diff --git a/examples/graphicsview/padnavigator/splashitem.h b/examples/graphicsview/padnavigator/splashitem.h
new file mode 100644
index 0000000..982bbe2
--- /dev/null
+++ b/examples/graphicsview/padnavigator/splashitem.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qobject.h>
+#include <QtCore/qtimeline.h>
+#include <QtGui/qgraphicswidget.h>
+
+class SplashItem : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ SplashItem(QGraphicsItem *parent = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+
+private Q_SLOTS:
+ void setValue(qreal value);
+
+private:
+ QTimeLine *timeLine;
+ QString text;
+ qreal opacity;
+};
diff --git a/examples/graphicsview/portedasteroids/animateditem.cpp b/examples/graphicsview/portedasteroids/animateditem.cpp
new file mode 100644
index 0000000..ac41fb5
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/animateditem.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "animateditem.h"
+
+#include <QtGui/qbitmap.h>
+#include <QtGui/qpainter.h>
+
+AnimatedPixmapItem::AnimatedPixmapItem(const QList<QPixmap> &animation,
+ QGraphicsScene *scene)
+ : QGraphicsItem(0, scene), currentFrame(0), vx(0), vy(0)
+{
+ for (int i = 0; i < animation.size(); ++i) {
+ QPixmap pixmap = animation.at(i);
+ Frame frame;
+ frame.pixmap = pixmap;
+ frame.shape = QPainterPath();
+ frame.boundingRect = pixmap.rect();
+ frames << frame;
+ }
+}
+
+void AnimatedPixmapItem::setFrame(int frame)
+{
+ if (!frames.isEmpty()) {
+ prepareGeometryChange();
+ currentFrame = frame % frames.size();
+ }
+}
+
+void AnimatedPixmapItem::advance(int phase)
+{
+ if (phase == 1)
+ moveBy(vx, vy);
+}
+
+QRectF AnimatedPixmapItem::boundingRect() const
+{
+ return frames.at(currentFrame).boundingRect;
+}
+
+QPainterPath AnimatedPixmapItem::shape() const
+{
+ const Frame &f = frames.at(currentFrame);
+ if (f.shape.isEmpty()) {
+ QPainterPath path;
+ path.addRegion(f.pixmap.createHeuristicMask());
+ const_cast<Frame &>(f).shape = path;
+ }
+ return f.shape;
+}
+
+void AnimatedPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/,
+ QWidget * /*widget*/)
+{
+ painter->drawPixmap(0, 0, frames.at(currentFrame).pixmap);
+}
diff --git a/examples/graphicsview/portedasteroids/animateditem.h b/examples/graphicsview/portedasteroids/animateditem.h
new file mode 100644
index 0000000..54e8e56
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/animateditem.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ANIMATEDPIXMAPITEM_H
+#define ANIMATEDPIXMAPITEM_H
+
+#include <QGraphicsItem>
+
+class AnimatedPixmapItem : public QGraphicsItem
+{
+public:
+ AnimatedPixmapItem(const QList<QPixmap> &animation, QGraphicsScene *scene = 0);
+
+ void setFrame(int frame);
+ inline int frame() const
+ { return currentFrame; }
+ inline int frameCount() const
+ { return frames.size(); }
+ inline QPixmap image(int frame) const
+ { return frames.isEmpty() ? QPixmap() : frames.at(frame % frames.size()).pixmap; }
+ inline void setVelocity(qreal xvel, qreal yvel)
+ { vx = xvel; vy = yvel; }
+ inline qreal xVelocity() const
+ { return vx; }
+ inline qreal yVelocity() const
+ { return vy; }
+
+ QRectF boundingRect() const;
+ QPainterPath shape() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ void advance(int phase);
+
+private:
+ struct Frame {
+ QPixmap pixmap;
+ QPainterPath shape;
+ QRectF boundingRect;
+ };
+
+ int currentFrame;
+ QList<Frame> frames;
+ qreal vx, vy;
+};
+
+#endif
diff --git a/examples/graphicsview/portedasteroids/bg.png b/examples/graphicsview/portedasteroids/bg.png
new file mode 100644
index 0000000..1201172
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/bg.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/ledmeter.cpp b/examples/graphicsview/portedasteroids/ledmeter.cpp
new file mode 100644
index 0000000..37aee26
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/ledmeter.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#include <qpainter.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <Q3Frame>
+#include "ledmeter.h"
+
+KALedMeter::KALedMeter( QWidget *parent ) : Q3Frame( parent )
+{
+ mCRanges.setAutoDelete( TRUE );
+ mRange = 100;
+ mCount = 20;
+ mCurrentCount = 0;
+ mValue = 0;
+ setMinimumWidth( mCount * 2 + frameWidth() );
+}
+
+void KALedMeter::setRange( int r )
+{
+ mRange = r;
+ if ( mRange < 1 )
+ mRange = 1;
+ setValue( mValue );
+ update();
+}
+
+void KALedMeter::setCount( int c )
+{
+ mCount = c;
+ if ( mCount < 1 )
+ mCount = 1;
+ setMinimumWidth( mCount * 2 + frameWidth() );
+ calcColorRanges();
+ setValue( mValue );
+ update();
+}
+
+void KALedMeter::setValue( int v )
+{
+ mValue = v;
+ if ( mValue > mRange )
+ mValue = mRange;
+ else if ( mValue < 0 )
+ mValue = 0;
+ int c = ( mValue + mRange / mCount - 1 ) * mCount / mRange;
+ if ( c != mCurrentCount )
+ {
+ mCurrentCount = c;
+ update();
+ }
+}
+
+void KALedMeter::addColorRange( int pc, const QColor &c )
+{
+ ColorRange *cr = new ColorRange;
+ cr->mPc = pc;
+ cr->mColor = c;
+ mCRanges.append( cr );
+ calcColorRanges();
+}
+
+void KALedMeter::resizeEvent( QResizeEvent *e )
+{
+ Q3Frame::resizeEvent( e );
+ int w = ( width() - frameWidth() - 2 ) / mCount * mCount;
+ w += frameWidth() + 2;
+ setFrameRect( QRect( 0, 0, w, height() ) );
+}
+
+void KALedMeter::drawContents( QPainter *p )
+{
+ QRect b = contentsRect();
+
+ unsigned cidx = 0;
+ int ncol = mCount;
+ QColor col = colorGroup().foreground();
+
+ if ( !mCRanges.isEmpty() )
+ {
+ col = mCRanges.at( cidx )->mColor;
+ ncol = mCRanges.at( cidx )->mValue;
+ }
+ p->setBrush( col );
+ p->setPen( col );
+
+ int lw = b.width() / mCount;
+ int lx = b.left() + 1;
+ for ( int i = 0; i < mCurrentCount; i++, lx += lw )
+ {
+ if ( i > ncol )
+ {
+ if ( ++cidx < mCRanges.count() )
+ {
+ col = mCRanges.at( cidx )->mColor;
+ ncol = mCRanges.at( cidx )->mValue;
+ p->setBrush( col );
+ p->setPen( col );
+ }
+ }
+
+ p->drawRect( lx, b.top() + 1, lw - 1, b.height() - 2 );
+ }
+}
+
+void KALedMeter::calcColorRanges()
+{
+ int prev = 0;
+ ColorRange *cr;
+ for ( cr = mCRanges.first(); cr; cr = mCRanges.next() )
+ {
+ cr->mValue = prev + cr->mPc * mCount / 100;
+ prev = cr->mValue;
+ }
+}
+
diff --git a/examples/graphicsview/portedasteroids/ledmeter.h b/examples/graphicsview/portedasteroids/ledmeter.h
new file mode 100644
index 0000000..117b113
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/ledmeter.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __LEDMETER_H__
+#define __LEDMETER_H__
+
+#include <q3frame.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+
+
+class KALedMeter : public Q3Frame
+{
+ Q_OBJECT
+public:
+ KALedMeter( QWidget *parent );
+
+ int range() const { return mRange; }
+ void setRange( int r );
+
+ int count() const { return mCount; }
+ void setCount( int c );
+
+ int value () const { return mValue; }
+
+ void addColorRange( int pc, const QColor &c );
+
+public slots:
+ void setValue( int v );
+
+protected:
+ virtual void resizeEvent( QResizeEvent * );
+ virtual void drawContents( QPainter * );
+ void calcColorRanges();
+
+protected:
+ struct ColorRange
+ {
+ int mPc;
+ int mValue;
+ QColor mColor;
+ };
+
+ int mRange;
+ int mCount;
+ int mCurrentCount;
+ int mValue;
+ Q3PtrList<ColorRange> mCRanges;
+};
+
+#endif
diff --git a/examples/graphicsview/portedasteroids/main.cpp b/examples/graphicsview/portedasteroids/main.cpp
new file mode 100644
index 0000000..69b5fd5
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "toplevel.h"
+
+int main(int argc, char **argv)
+{
+ Q_INIT_RESOURCE(portedasteroids);
+
+ QApplication app(argc, argv);
+
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
+
+ KAstTopLevel topLevel;
+ topLevel.setWindowTitle("Ported Asteroids Game");
+ topLevel.show();
+
+ app.setQuitOnLastWindowClosed(true);
+ return app.exec();
+}
diff --git a/examples/graphicsview/portedasteroids/portedasteroids.pro b/examples/graphicsview/portedasteroids/portedasteroids.pro
new file mode 100644
index 0000000..1452e91
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/portedasteroids.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+INCLUDEPATH += .
+
+# Input
+HEADERS += ledmeter.h sprites.h toplevel.h view.h
+SOURCES += ledmeter.cpp main.cpp toplevel.cpp view.cpp
+#The following line was inserted by qt3to4
+QT += qt3support
+
+HEADERS += animateditem.h
+SOURCES += animateditem.cpp
+
+RESOURCES += portedasteroids.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/portedasteroids
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS portedasteroids.pro bg.png sounds sprites
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/portedasteroids
+INSTALLS += target sources
diff --git a/examples/graphicsview/portedasteroids/portedasteroids.qrc b/examples/graphicsview/portedasteroids/portedasteroids.qrc
new file mode 100644
index 0000000..1780828
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/portedasteroids.qrc
@@ -0,0 +1,163 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/trolltech/examples/graphicsview/portedasteroids">
+<file>bg.png</file>
+<file>sprites/bits/bits0000.png</file>
+<file>sprites/bits/bits0001.png</file>
+<file>sprites/bits/bits0002.png</file>
+<file>sprites/bits/bits0003.png</file>
+<file>sprites/bits/bits0004.png</file>
+<file>sprites/bits/bits0005.png</file>
+<file>sprites/bits/bits0006.png</file>
+<file>sprites/bits/bits0007.png</file>
+<file>sprites/bits/bits0008.png</file>
+<file>sprites/bits/bits0009.png</file>
+<file>sprites/bits/bits0010.png</file>
+<file>sprites/bits/bits0011.png</file>
+<file>sprites/bits/bits0012.png</file>
+<file>sprites/bits/bits0013.png</file>
+<file>sprites/bits/bits0014.png</file>
+<file>sprites/bits/bits0015.png</file>
+<file>sprites/ship/ship0000.png</file>
+<file>sprites/ship/ship0001.png</file>
+<file>sprites/ship/ship0002.png</file>
+<file>sprites/ship/ship0003.png</file>
+<file>sprites/ship/ship0004.png</file>
+<file>sprites/ship/ship0005.png</file>
+<file>sprites/ship/ship0006.png</file>
+<file>sprites/ship/ship0007.png</file>
+<file>sprites/ship/ship0008.png</file>
+<file>sprites/ship/ship0009.png</file>
+<file>sprites/ship/ship0010.png</file>
+<file>sprites/ship/ship0011.png</file>
+<file>sprites/ship/ship0012.png</file>
+<file>sprites/ship/ship0013.png</file>
+<file>sprites/ship/ship0014.png</file>
+<file>sprites/ship/ship0015.png</file>
+<file>sprites/ship/ship0016.png</file>
+<file>sprites/ship/ship0017.png</file>
+<file>sprites/ship/ship0018.png</file>
+<file>sprites/ship/ship0019.png</file>
+<file>sprites/ship/ship0020.png</file>
+<file>sprites/ship/ship0021.png</file>
+<file>sprites/ship/ship0022.png</file>
+<file>sprites/ship/ship0023.png</file>
+<file>sprites/ship/ship0024.png</file>
+<file>sprites/ship/ship0025.png</file>
+<file>sprites/ship/ship0026.png</file>
+<file>sprites/ship/ship0027.png</file>
+<file>sprites/ship/ship0028.png</file>
+<file>sprites/ship/ship0029.png</file>
+<file>sprites/ship/ship0030.png</file>
+<file>sprites/ship/ship0031.png</file>
+<file>sprites/rock1/rock10016.png</file>
+<file>sprites/rock1/rock10017.png</file>
+<file>sprites/rock1/rock10018.png</file>
+<file>sprites/rock1/rock10019.png</file>
+<file>sprites/rock1/rock10020.png</file>
+<file>sprites/rock1/rock10021.png</file>
+<file>sprites/rock1/rock10022.png</file>
+<file>sprites/rock1/rock10023.png</file>
+<file>sprites/rock1/rock10024.png</file>
+<file>sprites/rock1/rock10025.png</file>
+<file>sprites/rock1/rock10026.png</file>
+<file>sprites/rock1/rock10027.png</file>
+<file>sprites/rock1/rock10028.png</file>
+<file>sprites/rock1/rock10029.png</file>
+<file>sprites/rock1/rock10030.png</file>
+<file>sprites/rock1/rock10031.png</file>
+<file>sprites/rock1/rock10000.png</file>
+<file>sprites/rock1/rock10001.png</file>
+<file>sprites/rock1/rock10002.png</file>
+<file>sprites/rock1/rock10003.png</file>
+<file>sprites/rock1/rock10004.png</file>
+<file>sprites/rock1/rock10005.png</file>
+<file>sprites/rock1/rock10006.png</file>
+<file>sprites/rock1/rock10007.png</file>
+<file>sprites/rock1/rock10008.png</file>
+<file>sprites/rock1/rock10009.png</file>
+<file>sprites/rock1/rock10010.png</file>
+<file>sprites/rock1/rock10011.png</file>
+<file>sprites/rock1/rock10012.png</file>
+<file>sprites/rock1/rock10013.png</file>
+<file>sprites/rock1/rock10014.png</file>
+<file>sprites/rock1/rock10015.png</file>
+<file>sprites/rock2/rock20000.png</file>
+<file>sprites/rock2/rock20001.png</file>
+<file>sprites/rock2/rock20002.png</file>
+<file>sprites/rock2/rock20003.png</file>
+<file>sprites/rock2/rock20004.png</file>
+<file>sprites/rock2/rock20005.png</file>
+<file>sprites/rock2/rock20006.png</file>
+<file>sprites/rock2/rock20007.png</file>
+<file>sprites/rock2/rock20008.png</file>
+<file>sprites/rock2/rock20009.png</file>
+<file>sprites/rock2/rock20010.png</file>
+<file>sprites/rock2/rock20011.png</file>
+<file>sprites/rock2/rock20012.png</file>
+<file>sprites/rock2/rock20013.png</file>
+<file>sprites/rock2/rock20014.png</file>
+<file>sprites/rock2/rock20015.png</file>
+<file>sprites/rock2/rock20016.png</file>
+<file>sprites/rock2/rock20017.png</file>
+<file>sprites/rock2/rock20018.png</file>
+<file>sprites/rock2/rock20019.png</file>
+<file>sprites/rock2/rock20020.png</file>
+<file>sprites/rock2/rock20021.png</file>
+<file>sprites/rock2/rock20022.png</file>
+<file>sprites/rock2/rock20023.png</file>
+<file>sprites/rock2/rock20024.png</file>
+<file>sprites/rock2/rock20025.png</file>
+<file>sprites/rock2/rock20026.png</file>
+<file>sprites/rock2/rock20027.png</file>
+<file>sprites/rock2/rock20028.png</file>
+<file>sprites/rock2/rock20029.png</file>
+<file>sprites/rock2/rock20030.png</file>
+<file>sprites/rock2/rock20031.png</file>
+<file>sprites/rock3/rock30000.png</file>
+<file>sprites/rock3/rock30001.png</file>
+<file>sprites/rock3/rock30002.png</file>
+<file>sprites/rock3/rock30003.png</file>
+<file>sprites/rock3/rock30004.png</file>
+<file>sprites/rock3/rock30005.png</file>
+<file>sprites/rock3/rock30006.png</file>
+<file>sprites/rock3/rock30007.png</file>
+<file>sprites/rock3/rock30008.png</file>
+<file>sprites/rock3/rock30009.png</file>
+<file>sprites/rock3/rock30010.png</file>
+<file>sprites/rock3/rock30011.png</file>
+<file>sprites/rock3/rock30012.png</file>
+<file>sprites/rock3/rock30013.png</file>
+<file>sprites/rock3/rock30014.png</file>
+<file>sprites/rock3/rock30015.png</file>
+<file>sprites/rock3/rock30016.png</file>
+<file>sprites/rock3/rock30017.png</file>
+<file>sprites/rock3/rock30018.png</file>
+<file>sprites/rock3/rock30019.png</file>
+<file>sprites/rock3/rock30020.png</file>
+<file>sprites/rock3/rock30021.png</file>
+<file>sprites/rock3/rock30022.png</file>
+<file>sprites/rock3/rock30023.png</file>
+<file>sprites/rock3/rock30024.png</file>
+<file>sprites/rock3/rock30025.png</file>
+<file>sprites/rock3/rock30026.png</file>
+<file>sprites/rock3/rock30027.png</file>
+<file>sprites/rock3/rock30028.png</file>
+<file>sprites/rock3/rock30029.png</file>
+<file>sprites/rock3/rock30030.png</file>
+<file>sprites/rock3/rock30031.png</file>
+<file>sprites/missile/missile.png</file>
+<file>sprites/exhaust/exhaust.png</file>
+<file>sprites/powerups/shield.png</file>
+<file>sprites/powerups/shoot.png</file>
+<file>sprites/powerups/teleport.png</file>
+<file>sprites/powerups/brake.png</file>
+<file>sprites/powerups/energy.png</file>
+<file>sprites/shield/shield0000.png</file>
+<file>sprites/shield/shield0001.png</file>
+<file>sprites/shield/shield0002.png</file>
+<file>sprites/shield/shield0003.png</file>
+<file>sprites/shield/shield0004.png</file>
+<file>sprites/shield/shield0005.png</file>
+<file>sprites/shield/shield0006.png</file>
+</qresource>
+</RCC>
diff --git a/examples/graphicsview/portedasteroids/sounds/Explosion.wav b/examples/graphicsview/portedasteroids/sounds/Explosion.wav
new file mode 100644
index 0000000..7b140b1
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sounds/Explosion.wav
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites.h b/examples/graphicsview/portedasteroids/sprites.h
new file mode 100644
index 0000000..1483d68
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites.h
@@ -0,0 +1,170 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __SPRITES_H__
+#define __SPRITES_H__
+
+#include "animateditem.h"
+
+#define ID_ROCK_LARGE 1024
+#define ID_ROCK_MEDIUM 1025
+#define ID_ROCK_SMALL 1026
+
+#define ID_MISSILE 1030
+
+#define ID_BIT 1040
+#define ID_EXHAUST 1041
+
+#define ID_ENERGY_POWERUP 1310
+#define ID_TELEPORT_POWERUP 1311
+#define ID_BRAKE_POWERUP 1312
+#define ID_SHIELD_POWERUP 1313
+#define ID_SHOOT_POWERUP 1314
+
+#define ID_SHIP 1350
+#define ID_SHIELD 1351
+
+#define MAX_SHIELD_AGE 350
+#define MAX_POWERUP_AGE 500
+#define MAX_MISSILE_AGE 40
+
+class KMissile : public AnimatedPixmapItem
+{
+public:
+ KMissile( const QList<QPixmap> &s, QGraphicsScene *c ) : AnimatedPixmapItem( s, c )
+ { myAge = 0; }
+
+ virtual int type() const { return ID_MISSILE; }
+
+ void growOlder() { myAge++; }
+ bool expired() { return myAge > MAX_MISSILE_AGE; }
+
+private:
+ int myAge;
+};
+
+class KBit : public AnimatedPixmapItem
+{
+public:
+ KBit( const QList<QPixmap> &s, QGraphicsScene *c ) : AnimatedPixmapItem( s, c )
+ { death = 7; }
+
+ virtual int type() const { return ID_BIT; }
+
+ void setDeath( int d ) { death = d; }
+ void growOlder() { death--; }
+ bool expired() { return death <= 0; }
+
+private:
+ int death;
+};
+
+class KExhaust : public AnimatedPixmapItem
+{
+public:
+ KExhaust( const QList<QPixmap> &s, QGraphicsScene *c ) : AnimatedPixmapItem( s, c )
+ { death = 1; }
+
+ virtual int type() const { return ID_EXHAUST; }
+
+ void setDeath( int d ) { death = d; }
+ void growOlder() { death--; }
+ bool expired() { return death <= 0; }
+
+private:
+ int death;
+};
+
+class KPowerup : public AnimatedPixmapItem
+{
+public:
+ KPowerup( const QList<QPixmap> &s, QGraphicsScene *c, int t ) : AnimatedPixmapItem( s, c ),
+ myAge( 0 ), _type(t) { }
+
+ virtual int type() const { return _type; }
+
+ void growOlder() { myAge++; }
+ bool expired() const { return myAge > MAX_POWERUP_AGE; }
+
+protected:
+ int myAge;
+ int _type;
+};
+
+class KRock : public AnimatedPixmapItem
+{
+public:
+ KRock (const QList<QPixmap> &s, QGraphicsScene *c, int t, int sk, int st) : AnimatedPixmapItem( s, c )
+ { _type = t; skip = cskip = sk; step = st; }
+
+ void nextFrame()
+ {
+ if (cskip-- <= 0) {
+ setFrame( (frame()+step+frameCount())%frameCount() );
+ cskip = QABS(skip);
+ }
+ }
+
+ virtual int type() const { return _type; }
+
+private:
+ int _type;
+ int skip;
+ int cskip;
+ int step;
+};
+
+class KShield : public AnimatedPixmapItem
+{
+public:
+ KShield( QList<QPixmap> &s, QGraphicsScene *c )
+ : AnimatedPixmapItem( s, c ) {}
+
+ virtual int type() const { return ID_SHIELD; }
+};
+
+#endif
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits.ini b/examples/graphicsview/portedasteroids/sprites/bits/bits.ini
new file mode 100644
index 0000000..cb2976f
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=12
+Height=12
+Final_frame=16 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=bits.pov
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits.pov b/examples/graphicsview/portedasteroids/sprites/bits/bits.pov
new file mode 100644
index 0000000..9be7ccb
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits.pov
@@ -0,0 +1,31 @@
+
+#version 3.0
+global_settings { assumed_gamma 2.0 }
+
+#include "colors.inc"
+#include "textures.inc"
+#include "metals.inc"
+
+camera {
+ location <15, -15, -100>
+ look_at <0, 0, 0>
+}
+
+light_source { <50, 50, -50> colour White }
+light_source { <0, 0, -50> colour White }
+
+prism {
+ linear_sweep
+ linear_spline
+ 0,
+ 0.2,
+ 5,
+ <2, 0>, <0, 2>, <-1, 1>, <0, -3>, <2, 0>
+ texture { T_Silver_2A }
+
+ rotate <360*clock, 50, 30>
+ scale <20, 20, 20>
+}
+
+
+
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0000.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0000.png
new file mode 100644
index 0000000..5ec9d02
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0000.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0001.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0001.png
new file mode 100644
index 0000000..07b4012
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0001.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0002.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0002.png
new file mode 100644
index 0000000..8333792
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0002.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0003.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0003.png
new file mode 100644
index 0000000..9f1fc02
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0003.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0004.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0004.png
new file mode 100644
index 0000000..eb1cc09
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0004.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0005.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0005.png
new file mode 100644
index 0000000..149be63
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0005.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0006.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0006.png
new file mode 100644
index 0000000..4ac75c8
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0006.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0007.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0007.png
new file mode 100644
index 0000000..907241d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0007.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0008.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0008.png
new file mode 100644
index 0000000..1533268
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0008.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0009.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0009.png
new file mode 100644
index 0000000..05402ba
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0009.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0010.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0010.png
new file mode 100644
index 0000000..ca4f229
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0010.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0011.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0011.png
new file mode 100644
index 0000000..91913c0
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0011.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0012.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0012.png
new file mode 100644
index 0000000..e55d439
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0012.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0013.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0013.png
new file mode 100644
index 0000000..9c73436
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0013.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0014.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0014.png
new file mode 100644
index 0000000..f0463a2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0014.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/bits/bits0015.png b/examples/graphicsview/portedasteroids/sprites/bits/bits0015.png
new file mode 100644
index 0000000..bce35aa
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/bits/bits0015.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/exhaust/exhaust.png b/examples/graphicsview/portedasteroids/sprites/exhaust/exhaust.png
new file mode 100644
index 0000000..1d9bc33
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/exhaust/exhaust.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/missile/missile.png b/examples/graphicsview/portedasteroids/sprites/missile/missile.png
new file mode 100644
index 0000000..f1a83b2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/missile/missile.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/powerups/brake.png b/examples/graphicsview/portedasteroids/sprites/powerups/brake.png
new file mode 100644
index 0000000..5f65a11
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/powerups/brake.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/powerups/energy.png b/examples/graphicsview/portedasteroids/sprites/powerups/energy.png
new file mode 100644
index 0000000..4b40074
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/powerups/energy.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/powerups/shield.png b/examples/graphicsview/portedasteroids/sprites/powerups/shield.png
new file mode 100644
index 0000000..6ac6868
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/powerups/shield.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/powerups/shoot.png b/examples/graphicsview/portedasteroids/sprites/powerups/shoot.png
new file mode 100644
index 0000000..5e5bf08
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/powerups/shoot.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/powerups/teleport.png b/examples/graphicsview/portedasteroids/sprites/powerups/teleport.png
new file mode 100644
index 0000000..009c229
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/powerups/teleport.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock1.ini b/examples/graphicsview/portedasteroids/sprites/rock1/rock1.ini
new file mode 100644
index 0000000..e42fc76
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock1.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=48
+Height=48
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=rock1.pov
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock1.pov b/examples/graphicsview/portedasteroids/sprites/rock1/rock1.pov
new file mode 100644
index 0000000..58298c0
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock1.pov
@@ -0,0 +1,26 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+// #include "stones.inc"
+
+camera {
+ location <2,2,-6>
+ up <0, 1, 0>
+// right <4/3, 0, 0>
+ look_at <0,0,0>
+}
+
+object { light_source { <10, 5, -5> color red 1.1 green 1.1 blue 1.0 } }
+
+#declare Rock =
+mesh {
+ #include "rock.inc" /* collection of triangle or smooth_triangle data */
+}
+
+object {
+ Rock
+ texture { pigment {White} }
+ scale 1.9
+ rotate <60, 45, 360*clock>
+}
+
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10000.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10000.png
new file mode 100644
index 0000000..5fe70ef
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10000.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10001.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10001.png
new file mode 100644
index 0000000..ea66dac
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10001.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10002.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10002.png
new file mode 100644
index 0000000..cb55ed0
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10002.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10003.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10003.png
new file mode 100644
index 0000000..f82934c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10003.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10004.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10004.png
new file mode 100644
index 0000000..04efc2b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10004.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10005.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10005.png
new file mode 100644
index 0000000..b9c0d03
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10005.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10006.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10006.png
new file mode 100644
index 0000000..7f91267
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10006.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10007.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10007.png
new file mode 100644
index 0000000..b28f219
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10007.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10008.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10008.png
new file mode 100644
index 0000000..0153d4a
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10008.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10009.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10009.png
new file mode 100644
index 0000000..c04d827
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10009.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10010.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10010.png
new file mode 100644
index 0000000..c7d3c40
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10010.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10011.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10011.png
new file mode 100644
index 0000000..233dfce
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10011.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10012.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10012.png
new file mode 100644
index 0000000..ec7b5ba
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10012.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10013.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10013.png
new file mode 100644
index 0000000..22eac3a
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10013.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10014.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10014.png
new file mode 100644
index 0000000..ad1503d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10014.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10015.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10015.png
new file mode 100644
index 0000000..cec22e2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10015.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10016.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10016.png
new file mode 100644
index 0000000..c7a96cb
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10016.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10017.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10017.png
new file mode 100644
index 0000000..c8310bd
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10017.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10018.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10018.png
new file mode 100644
index 0000000..b8d436b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10018.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10019.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10019.png
new file mode 100644
index 0000000..e5d0799
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10019.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10020.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10020.png
new file mode 100644
index 0000000..440f8d0
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10020.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10021.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10021.png
new file mode 100644
index 0000000..de3d54d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10021.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10022.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10022.png
new file mode 100644
index 0000000..698056d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10022.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10023.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10023.png
new file mode 100644
index 0000000..4e6ba04
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10023.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10024.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10024.png
new file mode 100644
index 0000000..3b42850
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10024.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10025.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10025.png
new file mode 100644
index 0000000..6813936
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10025.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10026.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10026.png
new file mode 100644
index 0000000..4a2b171
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10026.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10027.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10027.png
new file mode 100644
index 0000000..30448fb
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10027.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10028.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10028.png
new file mode 100644
index 0000000..43ca1a9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10028.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10029.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10029.png
new file mode 100644
index 0000000..9d7e888
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10029.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10030.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10030.png
new file mode 100644
index 0000000..39b2ad2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10030.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock1/rock10031.png b/examples/graphicsview/portedasteroids/sprites/rock1/rock10031.png
new file mode 100644
index 0000000..257ec7b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock1/rock10031.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock2.ini b/examples/graphicsview/portedasteroids/sprites/rock2/rock2.ini
new file mode 100644
index 0000000..d50e6fa
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock2.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=32
+Height=32
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=rock2.pov
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock2.pov b/examples/graphicsview/portedasteroids/sprites/rock2/rock2.pov
new file mode 100644
index 0000000..2f37a20
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock2.pov
@@ -0,0 +1,26 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+// #include "stones.inc"
+
+camera {
+ location <2,2,-6>
+ up <0, 1, 0>
+// right <4/3, 0, 0>
+ look_at <0,0,0>
+}
+
+object { light_source { <10, 5, -5> color red 1.1 green 1.1 blue 1.0 } }
+
+#declare Rock =
+mesh {
+ #include "rock.inc" /* collection of triangle or smooth_triangle data */
+}
+
+object {
+ Rock
+ texture { pigment {White} }
+ scale 1.9
+ rotate <60, 30, 360*clock>
+}
+
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20000.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20000.png
new file mode 100644
index 0000000..5cb52bb
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20000.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20001.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20001.png
new file mode 100644
index 0000000..d765be1
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20001.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20002.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20002.png
new file mode 100644
index 0000000..84e2380
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20002.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20003.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20003.png
new file mode 100644
index 0000000..39772b8
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20003.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20004.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20004.png
new file mode 100644
index 0000000..b983079
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20004.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20005.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20005.png
new file mode 100644
index 0000000..70bb4d8
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20005.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20006.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20006.png
new file mode 100644
index 0000000..cf5c2f4
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20006.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20007.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20007.png
new file mode 100644
index 0000000..479c21d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20007.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20008.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20008.png
new file mode 100644
index 0000000..871abca
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20008.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20009.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20009.png
new file mode 100644
index 0000000..bc31fbb
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20009.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20010.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20010.png
new file mode 100644
index 0000000..1da9953
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20010.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20011.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20011.png
new file mode 100644
index 0000000..d542c6e
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20011.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20012.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20012.png
new file mode 100644
index 0000000..d104ff9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20012.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20013.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20013.png
new file mode 100644
index 0000000..e12943d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20013.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20014.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20014.png
new file mode 100644
index 0000000..dc7529c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20014.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20015.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20015.png
new file mode 100644
index 0000000..0b49c2c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20015.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20016.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20016.png
new file mode 100644
index 0000000..adbad98
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20016.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20017.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20017.png
new file mode 100644
index 0000000..5a8aeef
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20017.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20018.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20018.png
new file mode 100644
index 0000000..11c6af4
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20018.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20019.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20019.png
new file mode 100644
index 0000000..026b72b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20019.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20020.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20020.png
new file mode 100644
index 0000000..8bc7e20
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20020.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20021.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20021.png
new file mode 100644
index 0000000..e0a7626
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20021.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20022.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20022.png
new file mode 100644
index 0000000..5796e12
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20022.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20023.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20023.png
new file mode 100644
index 0000000..d2cf0c6
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20023.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20024.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20024.png
new file mode 100644
index 0000000..071ce21
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20024.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20025.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20025.png
new file mode 100644
index 0000000..ae8101d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20025.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20026.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20026.png
new file mode 100644
index 0000000..f2681d4
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20026.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20027.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20027.png
new file mode 100644
index 0000000..e83fd41
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20027.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20028.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20028.png
new file mode 100644
index 0000000..5621b4d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20028.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20029.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20029.png
new file mode 100644
index 0000000..aec4a34
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20029.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20030.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20030.png
new file mode 100644
index 0000000..89a8f5f
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20030.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock2/rock20031.png b/examples/graphicsview/portedasteroids/sprites/rock2/rock20031.png
new file mode 100644
index 0000000..69f5375
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock2/rock20031.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock3.ini b/examples/graphicsview/portedasteroids/sprites/rock3/rock3.ini
new file mode 100644
index 0000000..26a3cf9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock3.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=20
+Height=20
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=rock3.pov
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock3.pov b/examples/graphicsview/portedasteroids/sprites/rock3/rock3.pov
new file mode 100644
index 0000000..2f37a20
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock3.pov
@@ -0,0 +1,26 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+// #include "stones.inc"
+
+camera {
+ location <2,2,-6>
+ up <0, 1, 0>
+// right <4/3, 0, 0>
+ look_at <0,0,0>
+}
+
+object { light_source { <10, 5, -5> color red 1.1 green 1.1 blue 1.0 } }
+
+#declare Rock =
+mesh {
+ #include "rock.inc" /* collection of triangle or smooth_triangle data */
+}
+
+object {
+ Rock
+ texture { pigment {White} }
+ scale 1.9
+ rotate <60, 30, 360*clock>
+}
+
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30000.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30000.png
new file mode 100644
index 0000000..de1205a
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30000.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30001.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30001.png
new file mode 100644
index 0000000..12ebc00
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30001.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30002.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30002.png
new file mode 100644
index 0000000..ebb899e
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30002.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30003.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30003.png
new file mode 100644
index 0000000..1ff7a06
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30003.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30004.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30004.png
new file mode 100644
index 0000000..5b505bf
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30004.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30005.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30005.png
new file mode 100644
index 0000000..f9680dc
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30005.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30006.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30006.png
new file mode 100644
index 0000000..e29746a
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30006.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30007.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30007.png
new file mode 100644
index 0000000..f01baa6
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30007.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30008.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30008.png
new file mode 100644
index 0000000..cd10711
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30008.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30009.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30009.png
new file mode 100644
index 0000000..4f32955
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30009.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30010.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30010.png
new file mode 100644
index 0000000..bb61d54
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30010.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30011.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30011.png
new file mode 100644
index 0000000..8486e5a
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30011.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30012.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30012.png
new file mode 100644
index 0000000..d9ae419
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30012.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30013.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30013.png
new file mode 100644
index 0000000..ce69400
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30013.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30014.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30014.png
new file mode 100644
index 0000000..981e92c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30014.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30015.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30015.png
new file mode 100644
index 0000000..b8fb00c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30015.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30016.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30016.png
new file mode 100644
index 0000000..72bc42f
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30016.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30017.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30017.png
new file mode 100644
index 0000000..c89f358
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30017.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30018.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30018.png
new file mode 100644
index 0000000..e1ba724
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30018.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30019.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30019.png
new file mode 100644
index 0000000..5f004a7
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30019.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30020.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30020.png
new file mode 100644
index 0000000..58009bf
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30020.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30021.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30021.png
new file mode 100644
index 0000000..8d9549c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30021.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30022.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30022.png
new file mode 100644
index 0000000..1e8a1c2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30022.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30023.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30023.png
new file mode 100644
index 0000000..9b960d6
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30023.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30024.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30024.png
new file mode 100644
index 0000000..6c15f2b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30024.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30025.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30025.png
new file mode 100644
index 0000000..12b05da
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30025.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30026.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30026.png
new file mode 100644
index 0000000..16190e9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30026.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30027.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30027.png
new file mode 100644
index 0000000..a862501
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30027.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30028.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30028.png
new file mode 100644
index 0000000..e3e0c18
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30028.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30029.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30029.png
new file mode 100644
index 0000000..ec70b84
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30029.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30030.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30030.png
new file mode 100644
index 0000000..da48df1
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30030.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/rock3/rock30031.png b/examples/graphicsview/portedasteroids/sprites/rock3/rock30031.png
new file mode 100644
index 0000000..c1dc1b9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/rock3/rock30031.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0000.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0000.png
new file mode 100644
index 0000000..7233254
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0000.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0001.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0001.png
new file mode 100644
index 0000000..2b0bc9d
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0001.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0002.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0002.png
new file mode 100644
index 0000000..cdc0fe3
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0002.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0003.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0003.png
new file mode 100644
index 0000000..979ed5a
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0003.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0004.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0004.png
new file mode 100644
index 0000000..0bb93a2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0004.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0005.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0005.png
new file mode 100644
index 0000000..32210bd
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0005.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/shield/shield0006.png b/examples/graphicsview/portedasteroids/sprites/shield/shield0006.png
new file mode 100644
index 0000000..76c9920
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/shield/shield0006.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship.ini b/examples/graphicsview/portedasteroids/sprites/ship/ship.ini
new file mode 100644
index 0000000..479cc20
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=42
+Height=42
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=ship.pov
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship.pov b/examples/graphicsview/portedasteroids/sprites/ship/ship.pov
new file mode 100644
index 0000000..8f185cd
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship.pov
@@ -0,0 +1,128 @@
+
+#version 3.0
+global_settings { assumed_gamma 2.0 }
+
+#include "colors.inc"
+#include "textures.inc"
+#include "metals.inc"
+
+camera {
+ orthographic
+ up <0, 130, 0>
+ right <130, 0, 0>
+ location <0, 0, -130>
+ look_at <0, 0, 0>
+}
+
+light_source { <50, 25, -25> colour White }
+light_source { <0, 0, -100> colour Gray80 }
+
+#declare ShipColor = color red 1.0 green 1.0 blue 0.9
+
+#declare BaseTexture =
+texture {
+ pigment { ShipColor }
+}
+
+#declare Grubby =
+texture {
+ pigment {
+ bozo
+ color_map {
+ [0.0 color rgbt <1, 1, 1, 1>]
+ [0.8 color rgbt <0.9, 0.9, 0.9, 0.5>]
+ [1.0 color rgbt <0.8, 0.8, 0.8, 0.5>]
+ }
+ turbulence 2.0
+ scale 3
+ }
+}
+
+#declare ShipTexture =
+texture { BaseTexture }
+texture { Grubby }
+
+union {
+ cone {
+ <12, 0, 0>, 0.5
+ <11, 0, 0>, 1.0
+ texture { ShipTexture }
+ }
+ cone {
+ <11, 0, 0>, 1.0
+ <8, 0, 0>, 2.0
+ texture { ShipTexture }
+ }
+ cone {
+ <8, 0, 0>, 2.0
+ <3.5, 0, 0>, 3.8
+ texture { ShipTexture }
+ }
+ difference {
+ cone {
+ <8, 0, -0.01>, 2.0
+ <3.5, 0, -0.01>, 3.8
+ pigment { color Gray20 }
+ }
+ box {
+ <9, -4.0, -3.7>,
+ <2, 4.0, 10>
+ rotate <0, -18, 0>
+ }
+ box {
+ <6.5, -4.0, -8>,
+ <10, 4.0, 8>
+ }
+ box {
+ <2, -4.0, -8>,
+ <4.5, 4.0, 8>
+ }
+ }
+ cone {
+ <3.5, 0, 0>, 3.8
+ <2, 0, 0>, 4.0
+ texture { ShipTexture }
+ }
+ cylinder {
+ <2, 0, 0>,
+ <-9, 0, 0>,
+ 4.0
+ texture { ShipTexture }
+ }
+ cone {
+ <-9, 0, 0>, 4.0
+ <-10, 0, 0>, 3.5
+ texture { ShipTexture }
+ }
+ prism {
+ linear_sweep
+ linear_spline
+ 0,
+ 0.5,
+ 4,
+ <7.5, 0>, <-7.5, 10>, <-7.5, -10>, <7.5, 0>
+ rotate <90, 0, 0>
+ texture { T_Silver_2A }
+ texture { ShipTexture }
+ }
+ prism {
+ linear_sweep
+ linear_spline
+ -0.5,
+ 0.5,
+ 4,
+ <4, 0>, <-7.5, 5>, <-7.5, -5>, <4, 0>
+ pigment { color White }
+ }
+ cone {
+ <-12, 0, 0>, 3.0
+ <-10, 0, 0>, 2.0
+ texture { T_Silver_2A }
+ pigment { color Gray60 }
+ }
+
+ rotate <0, 0,-360*clock>
+ scale <5, 5, 5>
+}
+
+
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0000.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0000.png
new file mode 100644
index 0000000..a8f1bb3
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0000.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0001.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0001.png
new file mode 100644
index 0000000..861f130
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0001.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0002.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0002.png
new file mode 100644
index 0000000..418ced1
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0002.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0003.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0003.png
new file mode 100644
index 0000000..50a386b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0003.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0004.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0004.png
new file mode 100644
index 0000000..f2bc0bc
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0004.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0005.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0005.png
new file mode 100644
index 0000000..7280485
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0005.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0006.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0006.png
new file mode 100644
index 0000000..51d26e9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0006.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0007.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0007.png
new file mode 100644
index 0000000..682c042
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0007.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0008.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0008.png
new file mode 100644
index 0000000..003d7fa
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0008.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0009.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0009.png
new file mode 100644
index 0000000..538b879
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0009.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0010.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0010.png
new file mode 100644
index 0000000..17999cd
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0010.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0011.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0011.png
new file mode 100644
index 0000000..1a4bbe9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0011.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0012.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0012.png
new file mode 100644
index 0000000..2523d85
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0012.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0013.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0013.png
new file mode 100644
index 0000000..8bd5971
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0013.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0014.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0014.png
new file mode 100644
index 0000000..a164ab7
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0014.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0015.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0015.png
new file mode 100644
index 0000000..ca8e0b9
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0015.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0016.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0016.png
new file mode 100644
index 0000000..cfaf8c4
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0016.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0017.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0017.png
new file mode 100644
index 0000000..8049617
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0017.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0018.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0018.png
new file mode 100644
index 0000000..4a3421b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0018.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0019.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0019.png
new file mode 100644
index 0000000..786d375
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0019.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0020.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0020.png
new file mode 100644
index 0000000..bd4365c
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0020.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0021.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0021.png
new file mode 100644
index 0000000..eb358c1
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0021.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0022.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0022.png
new file mode 100644
index 0000000..eb865e1
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0022.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0023.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0023.png
new file mode 100644
index 0000000..3738ce2
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0023.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0024.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0024.png
new file mode 100644
index 0000000..a7c1adc
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0024.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0025.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0025.png
new file mode 100644
index 0000000..2ca3aae
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0025.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0026.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0026.png
new file mode 100644
index 0000000..4661ca5
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0026.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0027.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0027.png
new file mode 100644
index 0000000..f5c9203
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0027.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0028.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0028.png
new file mode 100644
index 0000000..08353d4
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0028.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0029.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0029.png
new file mode 100644
index 0000000..8685d31
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0029.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0030.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0030.png
new file mode 100644
index 0000000..78dd469
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0030.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/sprites/ship/ship0031.png b/examples/graphicsview/portedasteroids/sprites/ship/ship0031.png
new file mode 100644
index 0000000..6cd0643
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/sprites/ship/ship0031.png
Binary files differ
diff --git a/examples/graphicsview/portedasteroids/toplevel.cpp b/examples/graphicsview/portedasteroids/toplevel.cpp
new file mode 100644
index 0000000..1aecc84
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/toplevel.cpp
@@ -0,0 +1,543 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+// --- toplevel.cpp ---
+#include <q3accel.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlcdnumber.h>
+#include <qpushbutton.h>
+
+#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QShowEvent>
+#include <Q3Frame>
+#include <QPixmap>
+#include <QHideEvent>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
+
+#include "toplevel.h"
+#include "ledmeter.h"
+
+
+#define SB_SCORE 1
+#define SB_LEVEL 2
+#define SB_SHIPS 3
+
+struct SLevel
+{
+ int nrocks;
+ double rockSpeed;
+};
+
+#define MAX_LEVELS 16
+
+SLevel levels[MAX_LEVELS] =
+{
+ { 1, 0.4 },
+ { 1, 0.6 },
+ { 2, 0.5 },
+ { 2, 0.7 },
+ { 2, 0.8 },
+ { 3, 0.6 },
+ { 3, 0.7 },
+ { 3, 0.8 },
+ { 4, 0.6 },
+ { 4, 0.7 },
+ { 4, 0.8 },
+ { 5, 0.7 },
+ { 5, 0.8 },
+ { 5, 0.9 },
+ { 5, 1.0 }
+};
+
+const char *soundEvents[] =
+{
+ "ShipDestroyed",
+ "RockDestroyed",
+ 0
+};
+
+const char *soundDefaults[] =
+{
+ "Explosion.wav",
+ "ploop.wav",
+ 0
+};
+
+
+KAstTopLevel::KAstTopLevel( QWidget *parent, const char *name )
+ : Q3MainWindow( parent, name, 0 )
+{
+ QWidget *border = new QWidget( this );
+ border->setBackgroundColor( Qt::black );
+ setCentralWidget( border );
+
+ Q3VBoxLayout *borderLayout = new Q3VBoxLayout( border );
+ borderLayout->addStretch( 1 );
+
+ QWidget *mainWin = new QWidget( border );
+ mainWin->setFixedSize(640, 480);
+ borderLayout->addWidget( mainWin, 0, Qt::AlignHCenter );
+
+ borderLayout->addStretch( 1 );
+
+ view = new KAsteroidsView( mainWin );
+ view->setFocusPolicy( Qt::StrongFocus );
+ connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
+ connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
+ connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
+ connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );
+
+ Q3VBoxLayout *vb = new Q3VBoxLayout( mainWin );
+ Q3HBoxLayout *hb = new Q3HBoxLayout;
+ Q3HBoxLayout *hbd = new Q3HBoxLayout;
+ vb->addLayout( hb );
+
+ QFont labelFont( "helvetica", 24 );
+ QColorGroup grp( Qt::darkGreen, Qt::black, QColor( 128, 128, 128 ),
+ QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black );
+ QPalette pal( grp, grp, grp );
+
+ mainWin->setPalette( pal );
+
+ hb->addSpacing( 10 );
+
+ QLabel *label;
+ label = new QLabel( tr("Score"), mainWin );
+ label->setFont( labelFont );
+ label->setPalette( pal );
+ label->setFixedWidth( label->sizeHint().width() );
+ hb->addWidget( label );
+
+ scoreLCD = new QLCDNumber( 6, mainWin );
+ scoreLCD->setFrameStyle( Q3Frame::NoFrame );
+ scoreLCD->setSegmentStyle( QLCDNumber::Flat );
+ scoreLCD->setFixedWidth( 150 );
+ scoreLCD->setPalette( pal );
+ hb->addWidget( scoreLCD );
+ hb->addStretch( 10 );
+
+ label = new QLabel( tr("Level"), mainWin );
+ label->setFont( labelFont );
+ label->setPalette( pal );
+ label->setFixedWidth( label->sizeHint().width() );
+ hb->addWidget( label );
+
+ levelLCD = new QLCDNumber( 2, mainWin );
+ levelLCD->setFrameStyle( Q3Frame::NoFrame );
+ levelLCD->setSegmentStyle( QLCDNumber::Flat );
+ levelLCD->setFixedWidth( 70 );
+ levelLCD->setPalette( pal );
+ hb->addWidget( levelLCD );
+ hb->addStretch( 10 );
+
+ label = new QLabel( tr("Ships"), mainWin );
+ label->setFont( labelFont );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hb->addWidget( label );
+
+ shipsLCD = new QLCDNumber( 1, mainWin );
+ shipsLCD->setFrameStyle( Q3Frame::NoFrame );
+ shipsLCD->setSegmentStyle( QLCDNumber::Flat );
+ shipsLCD->setFixedWidth( 40 );
+ shipsLCD->setPalette( pal );
+ hb->addWidget( shipsLCD );
+
+ hb->addStrut( 30 );
+
+ vb->addWidget( view, 10 );
+
+// -- bottom layout:
+ vb->addLayout( hbd );
+
+ QFont smallFont( "helvetica", 14 );
+ hbd->addSpacing( 10 );
+
+ QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/";
+/*
+ label = new QLabel( tr( "T" ), mainWin );
+ label->setFont( smallFont );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ teleportsLCD = new QLCDNumber( 1, mainWin );
+ teleportsLCD->setFrameStyle( QFrame::NoFrame );
+ teleportsLCD->setSegmentStyle( QLCDNumber::Flat );
+ teleportsLCD->setPalette( pal );
+ teleportsLCD->setFixedHeight( 20 );
+ hbd->addWidget( teleportsLCD );
+
+ hbd->addSpacing( 10 );
+*/
+ QPixmap pm( sprites_prefix + "powerups/brake.png" );
+ label = new QLabel( mainWin );
+ label->setPixmap( pm );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ brakesLCD = new QLCDNumber( 1, mainWin );
+ brakesLCD->setFrameStyle( Q3Frame::NoFrame );
+ brakesLCD->setSegmentStyle( QLCDNumber::Flat );
+ brakesLCD->setPalette( pal );
+ brakesLCD->setFixedHeight( 20 );
+ hbd->addWidget( brakesLCD );
+
+ hbd->addSpacing( 10 );
+
+ pm.load( sprites_prefix + "powerups/shield.png" );
+ label = new QLabel( mainWin );
+ label->setPixmap( pm );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ shieldLCD = new QLCDNumber( 1, mainWin );
+ shieldLCD->setFrameStyle( Q3Frame::NoFrame );
+ shieldLCD->setSegmentStyle( QLCDNumber::Flat );
+ shieldLCD->setPalette( pal );
+ shieldLCD->setFixedHeight( 20 );
+ hbd->addWidget( shieldLCD );
+
+ hbd->addSpacing( 10 );
+
+ pm.load( sprites_prefix + "powerups/shoot.png" );
+ label = new QLabel( mainWin );
+ label->setPixmap( pm );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ shootLCD = new QLCDNumber( 1, mainWin );
+ shootLCD->setFrameStyle( Q3Frame::NoFrame );
+ shootLCD->setSegmentStyle( QLCDNumber::Flat );
+ shootLCD->setPalette( pal );
+ shootLCD->setFixedHeight( 20 );
+ hbd->addWidget( shootLCD );
+
+ hbd->addStretch( 1 );
+
+ label = new QLabel( tr( "Fuel" ), mainWin );
+ label->setFont( smallFont );
+ label->setFixedWidth( label->sizeHint().width() + 10 );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ powerMeter = new KALedMeter( mainWin );
+ powerMeter->setFrameStyle( Q3Frame::Box | Q3Frame::Plain );
+ powerMeter->setRange( MAX_POWER_LEVEL );
+ powerMeter->addColorRange( 10, Qt::darkRed );
+ powerMeter->addColorRange( 20, QColor(160, 96, 0) );
+ powerMeter->addColorRange( 70, Qt::darkGreen );
+ powerMeter->setCount( 40 );
+ powerMeter->setPalette( pal );
+ powerMeter->setFixedSize( 200, 12 );
+ hbd->addWidget( powerMeter );
+
+ shipsRemain = 3;
+ showHiscores = FALSE;
+
+ actions.insert( Qt::Key_Up, Thrust );
+ actions.insert( Qt::Key_Left, RotateLeft );
+ actions.insert( Qt::Key_Right, RotateRight );
+ actions.insert( Qt::Key_Space, Shoot );
+ actions.insert( Qt::Key_Z, Teleport );
+ actions.insert( Qt::Key_X, Brake );
+ actions.insert( Qt::Key_S, Shield );
+ actions.insert( Qt::Key_P, Pause );
+ actions.insert( Qt::Key_L, Launch );
+ actions.insert( Qt::Key_N, NewGame );
+
+ view->showText( tr( "Press N to start playing" ), Qt::yellow );
+}
+
+KAstTopLevel::~KAstTopLevel()
+{
+}
+
+void KAstTopLevel::playSound( const char * )
+{
+}
+
+void KAstTopLevel::keyPressEvent( QKeyEvent *event )
+{
+ if ( event->isAutoRepeat() || !actions.contains( event->key() ) )
+ {
+ event->ignore();
+ return;
+ }
+
+ Action a = actions[ event->key() ];
+
+ switch ( a )
+ {
+ case RotateLeft:
+ view->rotateLeft( TRUE );
+ break;
+
+ case RotateRight:
+ view->rotateRight( TRUE );
+ break;
+
+ case Thrust:
+ view->thrust( TRUE );
+ break;
+
+ case Shoot:
+ view->shoot( TRUE );
+ break;
+
+ case Shield:
+ view->setShield( TRUE );
+ break;
+
+ case Teleport:
+ view->teleport( TRUE );
+ break;
+
+ case Brake:
+ view->brake( TRUE );
+ break;
+
+ default:
+ event->ignore();
+ return;
+ }
+ event->accept();
+}
+
+void KAstTopLevel::keyReleaseEvent( QKeyEvent *event )
+{
+ if ( event->isAutoRepeat() || !actions.contains( event->key() ) )
+ {
+ event->ignore();
+ return;
+ }
+
+ Action a = actions[ event->key() ];
+
+ switch ( a )
+ {
+ case RotateLeft:
+ view->rotateLeft( FALSE );
+ break;
+
+ case RotateRight:
+ view->rotateRight( FALSE );
+ break;
+
+ case Thrust:
+ view->thrust( FALSE );
+ break;
+
+ case Shoot:
+ view->shoot( FALSE );
+ break;
+
+ case Brake:
+ view->brake( FALSE );
+ break;
+
+ case Shield:
+ view->setShield( FALSE );
+ break;
+
+ case Teleport:
+ view->teleport( FALSE );
+ break;
+
+ case Launch:
+ if ( waitShip )
+ {
+ view->newShip();
+ waitShip = FALSE;
+ view->hideText();
+ }
+ else
+ {
+ event->ignore();
+ return;
+ }
+ break;
+
+ case NewGame:
+ slotNewGame();
+ break;
+/*
+ case Pause:
+ {
+ view->pause( TRUE );
+ QMessageBox::information( this,
+ tr("KAsteroids is paused"),
+ tr("Paused") );
+ view->pause( FALSE );
+ }
+ break;
+*/
+ default:
+ event->ignore();
+ return;
+ }
+
+ event->accept();
+}
+
+void KAstTopLevel::showEvent( QShowEvent *e )
+{
+ Q3MainWindow::showEvent( e );
+ view->pause( FALSE );
+ view->setFocus();
+}
+
+void KAstTopLevel::hideEvent( QHideEvent *e )
+{
+ Q3MainWindow::hideEvent( e );
+ view->pause( TRUE );
+}
+
+void KAstTopLevel::slotNewGame()
+{
+ score = 0;
+ shipsRemain = SB_SHIPS;
+ scoreLCD->display( 0 );
+ level = 0;
+ levelLCD->display( level+1 );
+ shipsLCD->display( shipsRemain-1 );
+ view->newGame();
+ view->setRockSpeed( levels[0].rockSpeed );
+ view->addRocks( levels[0].nrocks );
+// view->showText( tr( "Press L to launch." ), yellow );
+ view->newShip();
+ waitShip = FALSE;
+ view->hideText();
+ isPaused = FALSE;
+}
+
+void KAstTopLevel::slotShipKilled()
+{
+ shipsRemain--;
+ shipsLCD->display( shipsRemain-1 );
+
+ playSound( "ShipDestroyed" );
+
+ if ( shipsRemain )
+ {
+ waitShip = TRUE;
+ view->showText( tr( "Ship Destroyed. Press L to launch."), Qt::yellow );
+ }
+ else
+ {
+ view->showText( tr("Game Over!"), Qt::red );
+ view->endGame();
+ doStats();
+// highscore->addEntry( score, level, showHiscores );
+ }
+}
+
+void KAstTopLevel::slotRockHit( int size )
+{
+ switch ( size )
+ {
+ case 0:
+ score += 10;
+ break;
+
+ case 1:
+ score += 20;
+ break;
+
+ default:
+ score += 40;
+ }
+
+ playSound( "RockDestroyed" );
+
+ scoreLCD->display( score );
+}
+
+void KAstTopLevel::slotRocksRemoved()
+{
+ level++;
+
+ if ( level >= MAX_LEVELS )
+ level = MAX_LEVELS - 1;
+
+ view->setRockSpeed( levels[level-1].rockSpeed );
+ view->addRocks( levels[level-1].nrocks );
+
+ levelLCD->display( level+1 );
+}
+
+void KAstTopLevel::doStats()
+{
+ QString r( "0.00" );
+ if ( view->shots() )
+ r = QString::number( (double)view->hits() / view->shots() * 100.0,
+ 'g', 2 );
+
+/* multi-line text broken in Qt 3
+ QString s = tr( "Game Over\n\nShots fired:\t%1\n Hit:\t%2\n Missed:\t%3\nHit ratio:\t%4 %\n\nPress N for a new game" )
+ .arg(view->shots()).arg(view->hits())
+ .arg(view->shots() - view->hits())
+ .arg(r);
+*/
+
+ view->showText( "Game Over. Press N for a new game.", Qt::yellow, FALSE );
+}
+
+void KAstTopLevel::slotUpdateVitals()
+{
+ brakesLCD->display( view->brakeCount() );
+ shieldLCD->display( view->shieldCount() );
+ shootLCD->display( view->shootCount() );
+// teleportsLCD->display( view->teleportCount() );
+ powerMeter->setValue( view->power() );
+}
diff --git a/examples/graphicsview/portedasteroids/toplevel.h b/examples/graphicsview/portedasteroids/toplevel.h
new file mode 100644
index 0000000..67781da
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/toplevel.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __KAST_TOPLEVEL_H__
+#define __KAST_TOPLEVEL_H__
+
+#include <q3mainwindow.h>
+#include <q3dict.h>
+#include <qmap.h>
+//Added by qt3to4:
+#include <QShowEvent>
+#include <QHideEvent>
+#include <QKeyEvent>
+
+#include "view.h"
+
+
+class KALedMeter;
+QT_BEGIN_NAMESPACE
+class QLCDNumber;
+QT_END_NAMESPACE
+
+class KAstTopLevel : public Q3MainWindow
+{
+ Q_OBJECT
+public:
+ KAstTopLevel( QWidget *parent=0, const char *name=0 );
+ virtual ~KAstTopLevel();
+
+private:
+ void playSound( const char *snd );
+ void readSoundMapping();
+ void doStats();
+
+protected:
+ virtual void showEvent( QShowEvent * );
+ virtual void hideEvent( QHideEvent * );
+ virtual void keyPressEvent( QKeyEvent *event );
+ virtual void keyReleaseEvent( QKeyEvent *event );
+
+private slots:
+ void slotNewGame();
+
+ void slotShipKilled();
+ void slotRockHit( int size );
+ void slotRocksRemoved();
+
+ void slotUpdateVitals();
+
+private:
+ KAsteroidsView *view;
+ QLCDNumber *scoreLCD;
+ QLCDNumber *levelLCD;
+ QLCDNumber *shipsLCD;
+
+ QLCDNumber *teleportsLCD;
+// QLCDNumber *bombsLCD;
+ QLCDNumber *brakesLCD;
+ QLCDNumber *shieldLCD;
+ QLCDNumber *shootLCD;
+ KALedMeter *powerMeter;
+
+ bool sound;
+ Q3Dict<QString> soundDict;
+
+ // waiting for user to press Enter to launch a ship
+ bool waitShip;
+ bool isPaused;
+
+ int shipsRemain;
+ int score;
+ int level;
+ bool showHiscores;
+
+ enum Action { Launch, Thrust, RotateLeft, RotateRight, Shoot, Teleport,
+ Brake, Shield, Pause, NewGame };
+
+ QMap<int,Action> actions;
+};
+
+#endif
+
diff --git a/examples/graphicsview/portedasteroids/view.cpp b/examples/graphicsview/portedasteroids/view.cpp
new file mode 100644
index 0000000..fc6956b
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/view.cpp
@@ -0,0 +1,967 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <qapplication.h>
+#include <qnamespace.h>
+#include <q3accel.h>
+#include <qmessagebox.h>
+#include <q3scrollview.h>
+#include <qdir.h>
+#include <QGraphicsItem>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QShowEvent>
+
+#include "view.h"
+
+#define IMG_BACKGROUND ":/trolltech/examples/graphicsview/portedasteroids/bg.png"
+
+#define REFRESH_DELAY 33
+#define SHIP_SPEED 0.3
+#define MISSILE_SPEED 10.0
+#define SHIP_STEPS 64
+#define ROTATE_RATE 2
+#define SHIELD_ON_COST 1
+#define SHIELD_HIT_COST 30
+#define BRAKE_ON_COST 4
+
+#define MAX_ROCK_SPEED 2.5
+#define MAX_POWERUP_SPEED 1.5
+#define MAX_SHIP_SPEED 12
+#define MAX_BRAKES 5
+#define MAX_SHIELDS 5
+#define MAX_FIREPOWER 5
+
+#define TEXT_SPEED 4
+
+#define PI_X_2 6.283185307
+#ifndef M_PI
+#define M_PI 3.141592654
+#endif
+
+static struct
+{
+ int id;
+ const char *path;
+ int frames;
+}
+kas_animations [] =
+{
+ { ID_ROCK_LARGE, "rock1/rock1%1.png", 32 },
+ { ID_ROCK_MEDIUM, "rock2/rock2%1.png", 32 },
+ { ID_ROCK_SMALL, "rock3/rock3%1.png", 32 },
+ { ID_SHIP, "ship/ship%1.png", 32 },
+ { ID_MISSILE, "missile/missile.png", 1 },
+ { ID_BIT, "bits/bits%1.png", 16 },
+ { ID_EXHAUST, "exhaust/exhaust.png", 1 },
+ { ID_ENERGY_POWERUP, "powerups/energy.png", 1 },
+// { ID_TELEPORT_POWERUP, "powerups/teleport%1.png", 12 },
+ { ID_BRAKE_POWERUP, "powerups/brake.png", 1 },
+ { ID_SHIELD_POWERUP, "powerups/shield.png", 1 },
+ { ID_SHOOT_POWERUP, "powerups/shoot.png", 1 },
+ { ID_SHIELD, "shield/shield%1.png", 6 },
+ { 0, 0, 0 }
+};
+
+KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name )
+ : QWidget( parent, name ),
+ field(0, 0, 640, 440),
+ view(&field,this)
+{
+ view.setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
+ view.setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
+ view.setCacheMode(QGraphicsView::CacheBackground);
+ view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ view.setOptimizationFlags(QGraphicsView::DontClipPainter
+ | QGraphicsView::DontSavePainterState
+ | QGraphicsView::DontAdjustForAntialiasing);
+ view.viewport()->setFocusProxy( this );
+ rocks.setAutoDelete( TRUE );
+ missiles.setAutoDelete( TRUE );
+ bits.setAutoDelete( TRUE );
+ powerups.setAutoDelete( TRUE );
+ exhaust.setAutoDelete( TRUE );
+
+ QPixmap pm( IMG_BACKGROUND );
+ field.setBackgroundBrush( pm );
+
+ textSprite = new QGraphicsTextItem( 0, &field );
+ QFont font( "helvetica", 18 );
+ textSprite->setFont( font );
+ textSprite->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+
+ shield = 0;
+ shieldOn = FALSE;
+ refreshRate = REFRESH_DELAY;
+
+ initialized = readSprites();
+
+ shieldTimer = new QTimer( this );
+ connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) );
+ mTimerId = -1;
+
+ shipPower = MAX_POWER_LEVEL;
+ vitalsChanged = TRUE;
+ can_destroy_powerups = FALSE;
+
+ mPaused = TRUE;
+
+ if ( !initialized ) {
+ textSprite->setHtml( tr("<font color=red>Error: Cannot read sprite images</font>") );
+ textSprite->setPos( (field.width()-textSprite->boundingRect().width()) / 2,
+ (field.height()-textSprite->boundingRect().height()) / 2 );
+ }
+}
+
+// - - -
+
+KAsteroidsView::~KAsteroidsView()
+{
+}
+
+// - - -
+
+void KAsteroidsView::reset()
+{
+ if ( !initialized )
+ return;
+ rocks.clear();
+ missiles.clear();
+ bits.clear();
+ powerups.clear();
+ exhaust.clear();
+
+ shotsFired = 0;
+ shotsHit = 0;
+
+ rockSpeed = 1.0;
+ powerupSpeed = 1.0;
+ mFrameNum = 0;
+ mPaused = FALSE;
+
+ ship->hide();
+ shield->hide();
+/*
+ if ( mTimerId >= 0 ) {
+ killTimer( mTimerId );
+ mTimerId = -1;
+ }
+*/
+}
+
+// - --
+
+void KAsteroidsView::newGame()
+{
+ if ( !initialized )
+ return;
+ if ( shieldOn )
+ {
+ shield->hide();
+ shieldOn = FALSE;
+ }
+ reset();
+ if ( mTimerId < 0 )
+ mTimerId = startTimer( REFRESH_DELAY );
+ emit updateVitals();
+}
+
+// - - -
+
+void KAsteroidsView::endGame()
+{
+}
+
+void KAsteroidsView::pause( bool p )
+{
+ if ( !initialized )
+ return;
+ if ( !mPaused && p ) {
+ if ( mTimerId >= 0 ) {
+ killTimer( mTimerId );
+ mTimerId = -1;
+ }
+ } else if ( mPaused && !p )
+ mTimerId = startTimer( REFRESH_DELAY );
+ mPaused = p;
+}
+
+// - - -
+
+void KAsteroidsView::newShip()
+{
+ if ( !initialized )
+ return;
+ ship->setPos( width()/2, height()/2 );
+ ship->setFrame( 0 );
+ shield->setPos( width()/2, height()/2 );
+ shield->setFrame( 0 );
+ ship->setVelocity( 0.0, 0.0 );
+ shipDx = 0;
+ shipDy = 0;
+ shipAngle = 0;
+ rotateL = FALSE;
+ rotateR = FALSE;
+ thrustShip = FALSE;
+ shootShip = FALSE;
+ brakeShip = FALSE;
+ teleportShip = FALSE;
+ shieldOn = TRUE;
+ shootDelay = 0;
+ shipPower = MAX_POWER_LEVEL;
+ rotateRate = ROTATE_RATE;
+ rotateSlow = 0;
+
+ mBrakeCount = 0;
+ mTeleportCount = 0;
+ mShootCount = 0;
+
+ ship->show();
+ shield->show();
+ mShieldCount = 1; // just in case the ship appears on a rock.
+ shieldTimer->start( 1000, TRUE );
+}
+
+void KAsteroidsView::setShield( bool s )
+{
+ if ( !initialized )
+ return;
+ if ( shieldTimer->isActive() && !s ) {
+ shieldTimer->stop();
+ hideShield();
+ } else {
+ shieldOn = s && mShieldCount;
+ }
+}
+
+void KAsteroidsView::brake( bool b )
+{
+ if ( !initialized )
+ return;
+ if ( mBrakeCount )
+ {
+ if ( brakeShip && !b )
+ {
+ rotateL = FALSE;
+ rotateR = FALSE;
+ thrustShip = FALSE;
+ rotateRate = ROTATE_RATE;
+ }
+
+ brakeShip = b;
+ }
+}
+
+// - - -
+
+bool KAsteroidsView::readSprites()
+{
+ QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/";
+
+ int i = 0;
+ while ( kas_animations[i].id )
+ {
+ QList<QPixmap> anim;
+ QString wildcard = sprites_prefix + kas_animations[i].path;
+ wildcard.replace("%1", "*");
+ QFileInfo fi(wildcard);
+ foreach (QString entry, QDir(fi.path(), fi.fileName()).entryList())
+ anim << QPixmap(fi.path() + "/" + entry);
+ animation.insert( kas_animations[i].id, anim );
+ i++;
+ }
+
+ ship = new AnimatedPixmapItem( animation[ID_SHIP], &field );
+ ship->hide();
+
+ shield = new KShield( animation[ID_SHIELD], &field );
+ shield->hide();
+
+ return (!ship->image(0).isNull() && !shield->image(0).isNull());
+}
+
+// - - -
+
+void KAsteroidsView::addRocks( int num )
+{
+ if ( !initialized )
+ return;
+ for ( int i = 0; i < num; i++ )
+ {
+ KRock *rock = new KRock( animation[ID_ROCK_LARGE], &field,
+ ID_ROCK_LARGE, randInt(2), randInt(2) ? -1 : 1 );
+ double dx = (2.0 - randDouble()*4.0) * rockSpeed;
+ double dy = (2.0 - randDouble()*4.0) * rockSpeed;
+ rock->setVelocity( dx, dy );
+ rock->setFrame( randInt( rock->frameCount() ) );
+ if ( dx > 0 )
+ {
+ if ( dy > 0 )
+ rock->setPos( 5, 5 );
+ else
+ rock->setPos( 5, field.height() - 25 );
+ rock->setFrame( 0 );
+ }
+ else
+ {
+ if ( dy > 0 )
+ rock->setPos( field.width() - 25, 5 );
+ else
+ rock->setPos( field.width() - 25, field.height() - 25 );
+ rock->setFrame( 0 );
+ }
+ rock->show();
+ rocks.append( rock );
+ }
+}
+
+// - - -
+
+void KAsteroidsView::showText( const QString &text, const QColor &color, bool scroll )
+{
+ if ( !initialized )
+ return;
+ textSprite->setHtml( QString("<font color=#%1%2%3>%4</font>")
+ .arg(color.red(), 2, 16, QLatin1Char('0'))
+ .arg(color.green(), 2, 16, QLatin1Char('0'))
+ .arg(color.blue(), 2, 16, QLatin1Char('0'))
+ .arg(text) );
+ Q_UNUSED(color);
+ // ### Porting: no such thing textSprite->setColor( color );
+
+ if ( scroll ) {
+ textSprite->setPos( (field.width()-textSprite->boundingRect().width()) / 2,
+ -textSprite->boundingRect().height() );
+ textDy = TEXT_SPEED;
+ } else {
+ textSprite->setPos( (field.width()-textSprite->boundingRect().width()) / 2,
+ (field.height()-textSprite->boundingRect().height()) / 2 );
+ textDy = 0;
+ }
+ textSprite->show();
+}
+
+// - - -
+
+void KAsteroidsView::hideText()
+{
+ textDy = -TEXT_SPEED;
+}
+
+// - - -
+
+void KAsteroidsView::resizeEvent(QResizeEvent* event)
+{
+ QWidget::resizeEvent(event);
+ field.setSceneRect(0, 0, width()-4, height()-4);
+ view.resize(width(),height());
+}
+
+// - - -
+
+void KAsteroidsView::timerEvent( QTimerEvent * )
+{
+ field.advance();
+
+ AnimatedPixmapItem *rock;
+
+ // move rocks forward
+ for ( rock = rocks.first(); rock; rock = rocks.next() ) {
+ ((KRock *)rock)->nextFrame();
+ wrapSprite( rock );
+ }
+
+ wrapSprite( ship );
+
+ // check for missile collision with rocks.
+ processMissiles();
+
+ // these are generated when a ship explodes
+ for ( KBit *bit = bits.first(); bit; bit = bits.next() )
+ {
+ if ( bit->expired() )
+ {
+ bits.removeRef( bit );
+ }
+ else
+ {
+ bit->growOlder();
+ bit->setFrame( ( bit->frame()+1 ) % bit->frameCount() );
+ }
+ }
+
+ for ( KExhaust *e = exhaust.first(); e; e = exhaust.next() )
+ exhaust.removeRef( e );
+
+ // move / rotate ship.
+ // check for collision with a rock.
+ processShip();
+
+ // move powerups and check for collision with player and missiles
+ processPowerups();
+
+ if ( textSprite->isVisible() )
+ {
+ if ( textDy < 0 &&
+ textSprite->boundingRect().y() <= -textSprite->boundingRect().height() ) {
+ textSprite->hide();
+ } else {
+ textSprite->moveBy( 0, textDy );
+ }
+
+ if ( textSprite->sceneBoundingRect().y() > (field.height()-textSprite->boundingRect().height())/2 )
+ textDy = 0;
+ }
+
+ if ( vitalsChanged && !(mFrameNum % 10) ) {
+ emit updateVitals();
+ vitalsChanged = FALSE;
+ }
+
+ mFrameNum++;
+}
+
+void KAsteroidsView::wrapSprite( QGraphicsItem *s )
+{
+ int x = int(s->x() + s->boundingRect().width() / 2);
+ int y = int(s->y() + s->boundingRect().height() / 2);
+
+ if ( x > field.width() )
+ s->setPos( s->x() - field.width(), s->y() );
+ else if ( x < 0 )
+ s->setPos( field.width() + s->x(), s->y() );
+
+ if ( y > field.height() )
+ s->setPos( s->x(), s->y() - field.height() );
+ else if ( y < 0 )
+ s->setPos( s->x(), field.height() + s->y() );
+}
+
+// - - -
+
+void KAsteroidsView::rockHit( AnimatedPixmapItem *hit )
+{
+ KPowerup *nPup = 0;
+ int rnd = int(randDouble()*30.0) % 30;
+ switch( rnd )
+ {
+ case 4:
+ case 5:
+ nPup = new KPowerup( animation[ID_ENERGY_POWERUP], &field,
+ ID_ENERGY_POWERUP );
+ break;
+ case 10:
+// nPup = new KPowerup( animation[ID_TELEPORT_POWERUP], &field,
+// ID_TELEPORT_POWERUP );
+ break;
+ case 15:
+ nPup = new KPowerup( animation[ID_BRAKE_POWERUP], &field,
+ ID_BRAKE_POWERUP );
+ break;
+ case 20:
+ nPup = new KPowerup( animation[ID_SHIELD_POWERUP], &field,
+ ID_SHIELD_POWERUP );
+ break;
+ case 24:
+ case 25:
+ nPup = new KPowerup( animation[ID_SHOOT_POWERUP], &field,
+ ID_SHOOT_POWERUP );
+ break;
+ }
+ if ( nPup )
+ {
+ double r = 0.5 - randDouble();
+ nPup->setPos( hit->x(), hit->y() );
+ nPup->setFrame( 0 );
+ nPup->setVelocity( hit->xVelocity() + r, hit->yVelocity() + r );
+ powerups.append( nPup );
+ }
+
+ if ( hit->type() == ID_ROCK_LARGE || hit->type() == ID_ROCK_MEDIUM )
+ {
+ // break into smaller rocks
+ double addx[4] = { 1.0, 1.0, -1.0, -1.0 };
+ double addy[4] = { -1.0, 1.0, -1.0, 1.0 };
+
+ double dx = hit->xVelocity();
+ double dy = hit->yVelocity();
+
+ double maxRockSpeed = MAX_ROCK_SPEED * rockSpeed;
+ if ( dx > maxRockSpeed )
+ dx = maxRockSpeed;
+ else if ( dx < -maxRockSpeed )
+ dx = -maxRockSpeed;
+ if ( dy > maxRockSpeed )
+ dy = maxRockSpeed;
+ else if ( dy < -maxRockSpeed )
+ dy = -maxRockSpeed;
+
+ AnimatedPixmapItem *nrock;
+
+ for ( int i = 0; i < 4; i++ )
+ {
+ double r = rockSpeed/2 - randDouble()*rockSpeed;
+ if ( hit->type() == ID_ROCK_LARGE )
+ {
+ nrock = new KRock( animation[ID_ROCK_MEDIUM], &field,
+ ID_ROCK_MEDIUM, randInt(2), randInt(2) ? -1 : 1 );
+ emit rockHit( 0 );
+ }
+ else
+ {
+ nrock = new KRock( animation[ID_ROCK_SMALL], &field,
+ ID_ROCK_SMALL, randInt(2), randInt(2) ? -1 : 1 );
+ emit rockHit( 1 );
+ }
+
+ nrock->setPos( hit->x(), hit->y() );
+ nrock->setFrame( 0 );
+ nrock->setVelocity( dx+addx[i]*rockSpeed+r, dy+addy[i]*rockSpeed+r );
+ nrock->setFrame( randInt( nrock->frameCount() ) );
+ rocks.append( nrock );
+ }
+ }
+ else if ( hit->type() == ID_ROCK_SMALL )
+ emit rockHit( 2 );
+ rocks.removeRef( hit );
+ if ( rocks.count() == 0 )
+ emit rocksRemoved();
+}
+
+void KAsteroidsView::reducePower( int val )
+{
+ shipPower -= val;
+ if ( shipPower <= 0 )
+ {
+ shipPower = 0;
+ thrustShip = FALSE;
+ if ( shieldOn )
+ {
+ shieldOn = FALSE;
+ shield->hide();
+ }
+ }
+ vitalsChanged = TRUE;
+}
+
+void KAsteroidsView::addExhaust( double x, double y, double dx,
+ double dy, int count )
+{
+ for ( int i = 0; i < count; i++ )
+ {
+ KExhaust *e = new KExhaust( animation[ID_EXHAUST], &field );
+ e->setPos( x + 2 - randDouble()*4, y + 2 - randDouble()*4 );
+ e->setVelocity( dx, dy );
+ exhaust.append( e );
+ }
+}
+
+void KAsteroidsView::processMissiles()
+{
+ KMissile *missile;
+
+ // if a missile has hit a rock, remove missile and break rock into smaller
+ // rocks or remove completely.
+ Q3PtrListIterator<KMissile> it(missiles);
+
+ for ( ; it.current(); ++it )
+ {
+ missile = it.current();
+ missile->growOlder();
+
+ if ( missile->expired() )
+ {
+ missiles.removeRef( missile );
+ continue;
+ }
+
+ wrapSprite( missile );
+
+ QList<QGraphicsItem *> hits = missile->collidingItems(Qt::IntersectsItemBoundingRect);
+ QList<QGraphicsItem *>::Iterator hit;
+ for ( hit = hits.begin(); hit != hits.end(); ++hit )
+ {
+ if ( (*hit)->type() >= ID_ROCK_LARGE &&
+ (*hit)->type() <= ID_ROCK_SMALL && (*hit)->collidesWithItem(missile) )
+ {
+ shotsHit++;
+ rockHit( static_cast<AnimatedPixmapItem *>(*hit) );
+ missiles.removeRef( missile );
+ break;
+ }
+ }
+ }
+}
+
+// - - -
+
+void KAsteroidsView::processShip()
+{
+ if ( ship->isVisible() )
+ {
+ if ( shieldOn )
+ {
+ shield->show();
+ reducePower( SHIELD_ON_COST );
+ static int sf = 0;
+ sf++;
+
+ if ( sf % 2 )
+ shield->setFrame( (shield->frame()+1) % shield->frameCount() );
+ shield->setPos( ship->x() - 9, ship->y() - 9 );
+
+ QList<QGraphicsItem *> hits = shield->collidingItems(Qt::IntersectsItemBoundingRect);
+ QList<QGraphicsItem *>::Iterator it;
+ for ( it = hits.begin(); it != hits.end(); ++it )
+ {
+ if ( (*it)->type() >= ID_ROCK_LARGE &&
+ (*it)->type() <= ID_ROCK_SMALL && (*it)->collidesWithItem(shield) )
+ {
+ int factor;
+ switch ( (*it)->type() )
+ {
+ case ID_ROCK_LARGE:
+ factor = 3;
+ break;
+
+ case ID_ROCK_MEDIUM:
+ factor = 2;
+ break;
+
+ default:
+ factor = 1;
+ }
+
+ if ( factor > mShieldCount )
+ {
+ // shield not strong enough
+ shieldOn = FALSE;
+ break;
+ }
+ rockHit( static_cast<AnimatedPixmapItem *>(*it) );
+ // the more shields we have the less costly
+ reducePower( factor * (SHIELD_HIT_COST - mShieldCount*2) );
+ }
+ }
+ }
+
+ if ( !shieldOn )
+ {
+ shield->hide();
+ QList<QGraphicsItem *> hits = ship->collidingItems(Qt::IntersectsItemBoundingRect);
+ QList<QGraphicsItem *>::Iterator it;
+ for ( it = hits.begin(); it != hits.end(); ++it )
+ {
+ if ( (*it)->type() >= ID_ROCK_LARGE &&
+ (*it)->type() <= ID_ROCK_SMALL && (*it)->collidesWithItem(ship))
+ {
+ KBit *bit;
+ for ( int i = 0; i < 12; i++ )
+ {
+ bit = new KBit( animation[ID_BIT], &field );
+ bit->setPos( ship->x() + 5 - randDouble() * 10,
+ ship->y() + 5 - randDouble() * 10 );
+ bit->setFrame( randInt(bit->frameCount()) );
+ bit->setVelocity( 1-randDouble()*2,
+ 1-randDouble()*2 );
+ bit->setDeath( 60 + randInt(60) );
+ bits.append( bit );
+ }
+ ship->hide();
+ shield->hide();
+ emit shipKilled();
+ break;
+ }
+ }
+ }
+
+
+ if ( rotateSlow )
+ rotateSlow--;
+
+ if ( rotateL )
+ {
+ shipAngle -= rotateSlow ? 1 : rotateRate;
+ if ( shipAngle < 0 )
+ shipAngle += SHIP_STEPS;
+ }
+
+ if ( rotateR )
+ {
+ shipAngle += rotateSlow ? 1 : rotateRate;
+ if ( shipAngle >= SHIP_STEPS )
+ shipAngle -= SHIP_STEPS;
+ }
+
+ double angle = shipAngle * PI_X_2 / SHIP_STEPS;
+ double cosangle = cos( angle );
+ double sinangle = sin( angle );
+
+ if ( brakeShip )
+ {
+ thrustShip = FALSE;
+ rotateL = FALSE;
+ rotateR = FALSE;
+ rotateRate = ROTATE_RATE;
+ if ( fabs(shipDx) < 2.5 && fabs(shipDy) < 2.5 )
+ {
+ shipDx = 0.0;
+ shipDy = 0.0;
+ ship->setVelocity( shipDx, shipDy );
+ brakeShip = FALSE;
+ }
+ else
+ {
+ double motionAngle = atan2( -shipDy, -shipDx );
+ if ( angle > M_PI )
+ angle -= PI_X_2;
+ double angleDiff = angle - motionAngle;
+ if ( angleDiff > M_PI )
+ angleDiff = PI_X_2 - angleDiff;
+ else if ( angleDiff < -M_PI )
+ angleDiff = PI_X_2 + angleDiff;
+ double fdiff = fabs( angleDiff );
+ if ( fdiff > 0.08 )
+ {
+ if ( angleDiff > 0 )
+ rotateL = TRUE;
+ else if ( angleDiff < 0 )
+ rotateR = TRUE;
+ if ( fdiff > 0.6 )
+ rotateRate = mBrakeCount + 1;
+ else if ( fdiff > 0.4 )
+ rotateRate = 2;
+ else
+ rotateRate = 1;
+
+ if ( rotateRate > 5 )
+ rotateRate = 5;
+ }
+ else if ( fabs(shipDx) > 1 || fabs(shipDy) > 1 )
+ {
+ thrustShip = TRUE;
+ // we'll make braking a bit faster
+ shipDx += cosangle/6 * (mBrakeCount - 1);
+ shipDy += sinangle/6 * (mBrakeCount - 1);
+ reducePower( BRAKE_ON_COST );
+ addExhaust( ship->x() + 20 - cosangle*22,
+ ship->y() + 20 - sinangle*22,
+ shipDx-cosangle, shipDy-sinangle,
+ mBrakeCount+1 );
+ }
+ }
+ }
+
+ if ( thrustShip )
+ {
+ // The ship has a terminal velocity, but trying to go faster
+ // still uses fuel (can go faster diagonally - don't care).
+ double thrustx = cosangle/4;
+ double thrusty = sinangle/4;
+ if ( fabs(shipDx + thrustx) < MAX_SHIP_SPEED )
+ shipDx += thrustx;
+ if ( fabs(shipDy + thrusty) < MAX_SHIP_SPEED )
+ shipDy += thrusty;
+ ship->setVelocity( shipDx, shipDy );
+ reducePower( 1 );
+ addExhaust( ship->x() + 20 - cosangle*20,
+ ship->y() + 20 - sinangle*20,
+ shipDx-cosangle, shipDy-sinangle, 3 );
+ }
+
+ ship->setFrame( shipAngle >> 1 );
+
+ if ( shootShip )
+ {
+ if ( !shootDelay && (int)missiles.count() < mShootCount + 2 )
+ {
+ KMissile *missile = new KMissile( animation[ID_MISSILE], &field );
+ missile->setPos( 21+ship->x()+cosangle*21,
+ 21+ship->y()+sinangle*21 );
+ missile->setFrame( 0 );
+ missile->setVelocity( shipDx + cosangle*MISSILE_SPEED,
+ shipDy + sinangle*MISSILE_SPEED );
+ missiles.append( missile );
+ shotsFired++;
+ reducePower( 1 );
+
+ shootDelay = 5;
+ }
+
+ if ( shootDelay )
+ shootDelay--;
+ }
+
+ if ( teleportShip )
+ {
+ int ra = qrand() % 10;
+ if( ra == 0 )
+ ra += qrand() % 20;
+ int xra = ra * 60 + ( (qrand() % 20) * (qrand() % 20) );
+ int yra = ra * 50 - ( (qrand() % 20) * (qrand() % 20) );
+ ship->setPos( xra, yra );
+ }
+
+ vitalsChanged = TRUE;
+ }
+}
+
+// - - -
+
+void KAsteroidsView::processPowerups()
+{
+ if ( !powerups.isEmpty() )
+ {
+ // if player gets the powerup remove it from the screen, if option
+ // "Can destroy powerups" is enabled and a missile hits the powerup
+ // destroy it
+
+ KPowerup *pup;
+ Q3PtrListIterator<KPowerup> it( powerups );
+
+ for( ; it.current(); ++it )
+ {
+ pup = it.current();
+ pup->growOlder();
+
+ if( pup->expired() )
+ {
+ powerups.removeRef( pup );
+ continue;
+ }
+
+ wrapSprite( pup );
+
+ QList<QGraphicsItem *> hits = pup->collidingItems();
+ QList<QGraphicsItem *>::Iterator it;
+ for ( it = hits.begin(); it != hits.end(); ++it )
+ {
+ if ( (*it) == ship )
+ {
+ switch( pup->type() )
+ {
+ case ID_ENERGY_POWERUP:
+ shipPower += 150;
+ if ( shipPower > MAX_POWER_LEVEL )
+ shipPower = MAX_POWER_LEVEL;
+ break;
+ case ID_TELEPORT_POWERUP:
+ mTeleportCount++;
+ break;
+ case ID_BRAKE_POWERUP:
+ if ( mBrakeCount < MAX_BRAKES )
+ mBrakeCount++;
+ break;
+ case ID_SHIELD_POWERUP:
+ if ( mShieldCount < MAX_SHIELDS )
+ mShieldCount++;
+ break;
+ case ID_SHOOT_POWERUP:
+ if ( mShootCount < MAX_FIREPOWER )
+ mShootCount++;
+ break;
+ }
+
+ powerups.removeRef( pup );
+ vitalsChanged = TRUE;
+ }
+ else if ( (*it) == shield )
+ {
+ powerups.removeRef( pup );
+ }
+ else if ( (*it)->type() == ID_MISSILE )
+ {
+ if ( can_destroy_powerups )
+ {
+ powerups.removeRef( pup );
+ }
+ }
+ }
+ }
+ } // -- if( powerups.isEmpty() )
+}
+
+// - - -
+
+void KAsteroidsView::hideShield()
+{
+ shield->hide();
+ mShieldCount = 0;
+ shieldOn = FALSE;
+}
+
+double KAsteroidsView::randDouble()
+{
+ int v = qrand();
+ return (double)v / (double)RAND_MAX;
+}
+
+int KAsteroidsView::randInt( int range )
+{
+ return qrand() % range;
+}
+
+void KAsteroidsView::showEvent( QShowEvent *e )
+{
+#if defined( QT_LICENSE_PROFESSIONAL )
+ static bool wasThere = FALSE;
+
+ if ( !wasThere ) {
+ wasThere = TRUE;
+ QMessageBox::information( this, tr("QGraphicsView demo"),
+ tr("This game has been implemented using the QGraphicsView class.\n"
+ "The QGraphicsView class is not part of the Light Platform Edition. Please \n"
+ "contact Qt Software if you want to upgrade to the Full Platform Edition.") );
+ }
+#endif
+
+ QWidget::showEvent( e );
+}
diff --git a/examples/graphicsview/portedasteroids/view.h b/examples/graphicsview/portedasteroids/view.h
new file mode 100644
index 0000000..d055f29
--- /dev/null
+++ b/examples/graphicsview/portedasteroids/view.h
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __AST_VIEW_H__
+#define __AST_VIEW_H__
+
+#include <qwidget.h>
+#include <q3ptrlist.h>
+#include <q3intdict.h>
+#include <qtimer.h>
+#include <QGraphicsScene>
+#include <QGraphicsView>
+//Added by qt3to4:
+#include <QTimerEvent>
+#include <QShowEvent>
+#include <QResizeEvent>
+#include "sprites.h"
+
+#define MAX_POWER_LEVEL 1000
+
+class KAsteroidsView : public QWidget
+{
+ Q_OBJECT
+public:
+ KAsteroidsView( QWidget *parent = 0, const char *name = 0 );
+ virtual ~KAsteroidsView();
+
+ int refreshRate;
+
+ void reset();
+ void setRockSpeed( double rs ) { rockSpeed = rs; }
+ void addRocks( int num );
+ void newGame();
+ void endGame();
+ void newShip();
+
+ void rotateLeft( bool r ) { rotateL = r; rotateSlow = 5; }
+ void rotateRight( bool r ) { rotateR = r; rotateSlow = 5; }
+ void thrust( bool t ) { thrustShip = t && shipPower > 0; }
+ void shoot( bool s ) { shootShip = s; shootDelay = 0; }
+ void setShield( bool s );
+ void teleport( bool te) { teleportShip = te && mTeleportCount; }
+ void brake( bool b );
+ void pause( bool p);
+
+ void showText( const QString &text, const QColor &color, bool scroll=TRUE );
+ void hideText();
+
+ int shots() const { return shotsFired; }
+ int hits() const { return shotsHit; }
+ int power() const { return shipPower; }
+
+ int teleportCount() const { return mTeleportCount; }
+ int brakeCount() const { return mBrakeCount; }
+ int shieldCount() const { return mShieldCount; }
+ int shootCount() const { return mShootCount; }
+
+signals:
+ void shipKilled();
+ void rockHit( int size );
+ void rocksRemoved();
+ void updateVitals();
+
+private slots:
+ void hideShield();
+
+protected:
+ bool readSprites();
+ void wrapSprite( QGraphicsItem * );
+ void rockHit( AnimatedPixmapItem * );
+ void reducePower( int val );
+ void addExhaust( double x, double y, double dx, double dy, int count );
+ void processMissiles();
+ void processShip();
+ void processPowerups();
+ void processShield();
+ double randDouble();
+ int randInt( int range );
+
+ virtual void resizeEvent( QResizeEvent *event );
+ virtual void timerEvent( QTimerEvent * );
+
+ void showEvent( QShowEvent * );
+
+private:
+ QGraphicsScene field;
+ QGraphicsView view;
+ QMap<int, QList<QPixmap> > animation;
+ Q3PtrList<AnimatedPixmapItem> rocks;
+ Q3PtrList<KMissile> missiles;
+ Q3PtrList<KBit> bits;
+ Q3PtrList<KExhaust> exhaust;
+ Q3PtrList<KPowerup> powerups;
+ KShield *shield;
+ AnimatedPixmapItem *ship;
+ QGraphicsTextItem *textSprite;
+
+ bool rotateL;
+ bool rotateR;
+ bool thrustShip;
+ bool shootShip;
+ bool teleportShip;
+ bool brakeShip;
+ bool pauseShip;
+ bool shieldOn;
+
+ bool vitalsChanged;
+
+ int shipAngle;
+ int rotateSlow;
+ int rotateRate;
+ int shipPower;
+
+ int shotsFired;
+ int shotsHit;
+ int shootDelay;
+
+ int mBrakeCount;
+ int mShieldCount;
+ int mTeleportCount;
+ int mShootCount;
+
+ double shipDx;
+ double shipDy;
+
+ int textDy;
+ int mFrameNum;
+ bool mPaused;
+ int mTimerId;
+
+ double rockSpeed;
+ double powerupSpeed;
+
+ bool can_destroy_powerups;
+
+ QTimer *shieldTimer;
+ bool initialized;
+};
+
+#endif
diff --git a/examples/graphicsview/portedcanvas/blendshadow.cpp b/examples/graphicsview/portedcanvas/blendshadow.cpp
new file mode 100644
index 0000000..42cd0e3
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/blendshadow.cpp
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qimage.h>
+#include <qcolor.h>
+
+static inline int blendComponent( int v, int av, int s, int as )
+{
+ return as*s + av*v -(av*as*s)/255;
+}
+
+static inline QRgb blendShade( QRgb v, QRgb s )
+{
+ //shadow image is already reduced and blurred
+ int as = qAlpha(s);
+ int av = qAlpha(v);
+ if ( as == 0 || av == 255 )
+ return v;
+
+ int a = as + av -(as*av)/255;
+
+ int r = blendComponent( qRed(v),av, qRed(s), as)/a;
+ int g = blendComponent( qGreen(v),av, qGreen(s), as)/a;
+ int b = blendComponent( qBlue(v),av, qBlue(s), as)/a;
+
+ return qRgba(r,g,b,a);
+}
+
+
+
+int main( int*, char**)
+{
+ QImage image( "out.png" );
+ image.convertDepth( 32 );
+ QImage shade( "outshade.png" );
+ shade.convertDepth( 32 );
+ int dx = 10;
+ int dy = 5;
+
+ int w = image.width();
+ int h = image.height();
+
+ QImage img( w+dx, h+dy, 32 );
+ img.setAlphaBuffer( TRUE );
+
+ for ( int y = 0; y < h+dy; y++ ) {
+ for ( int x = 0; x < w+dx; x++ ) {
+ QRgb sh = (x<dx||y<dy) ? 0 : shade.pixel( x-dx, y-dy );
+ QRgb pixel = (x<w&y<h) ? image.pixel( x, y ) : 0;
+ img.setPixel( x, y, blendShade( pixel, sh ) );
+ }
+ }
+ img.save("blend.png", "PNG" );
+}
+
+
diff --git a/examples/graphicsview/portedcanvas/butterfly.png b/examples/graphicsview/portedcanvas/butterfly.png
new file mode 100644
index 0000000..f3e050e
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/butterfly.png
Binary files differ
diff --git a/examples/graphicsview/portedcanvas/canvas.cpp b/examples/graphicsview/portedcanvas/canvas.cpp
new file mode 100644
index 0000000..c8718dc
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/canvas.cpp
@@ -0,0 +1,733 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qdatetime.h>
+#include <qmainwindow.h>
+#include <qstatusbar.h>
+#include <qmessagebox.h>
+#include <qmenubar.h>
+#include <qapplication.h>
+#include <qpainter.h>
+#include <qprinter.h>
+#include <qlabel.h>
+#include <qimage.h>
+#include <q3progressdialog.h>
+#include <Q3PointArray>
+#include <Q3PtrList>
+#include <QPixmap>
+#include <Q3PopupMenu>
+#include <QMouseEvent>
+#include <Q3MemArray>
+#include "canvas.h"
+#include <QStyleOptionGraphicsItem>
+#include <qdebug.h>
+#include <stdlib.h>
+
+// We use a global variable to save memory - all the brushes and pens in
+// the mesh are shared.
+static QBrush *tb = 0;
+static QPen *tp = 0;
+
+class EdgeItem;
+class NodeItem;
+
+class EdgeItem: public QGraphicsLineItem
+{
+public:
+ EdgeItem( NodeItem*, NodeItem* );
+ void setFromPoint( int x, int y ) ;
+ void setToPoint( int x, int y );
+ static int count() { return c; }
+private:
+ static int c;
+};
+
+static const int imageRTTI = 984376;
+
+
+class ImageItem: public QGraphicsRectItem
+{
+public:
+ ImageItem( QImage img );
+ int rtti () const { return imageRTTI; }
+protected:
+ void paint( QPainter *, const QStyleOptionGraphicsItem *option, QWidget *widget );
+private:
+ QImage image;
+ QPixmap pixmap;
+};
+
+
+ImageItem::ImageItem( QImage img )
+ : image(img)
+{
+ setRect(0, 0, image.width(), image.height());
+ setFlag(ItemIsMovable);
+#if !defined(Q_WS_QWS)
+ pixmap.convertFromImage(image, Qt::OrderedAlphaDither);
+#endif
+}
+
+void ImageItem::paint( QPainter *p, const QStyleOptionGraphicsItem *option, QWidget * )
+{
+// On Qt/Embedded, we can paint a QImage as fast as a QPixmap,
+// but on other platforms, we need to use a QPixmap.
+#if defined(Q_WS_QWS)
+ p->drawImage( option->exposedRect, image, option->exposedRect, Qt::OrderedAlphaDither );
+#else
+ p->drawPixmap( option->exposedRect, pixmap, option->exposedRect );
+#endif
+}
+
+class NodeItem: public QGraphicsEllipseItem
+{
+public:
+ NodeItem();
+ ~NodeItem() {}
+
+ void addInEdge( EdgeItem *edge ) { inList.append( edge ); }
+ void addOutEdge( EdgeItem *edge ) { outList.append( edge ); }
+
+protected:
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+
+
+ // QPoint center() { return boundingRect().center(); }
+private:
+ Q3PtrList<EdgeItem> inList;
+ Q3PtrList<EdgeItem> outList;
+};
+
+
+int EdgeItem::c = 0;
+
+EdgeItem::EdgeItem( NodeItem *from, NodeItem *to )
+ : QGraphicsLineItem( )
+{
+ c++;
+ setPen( *tp );
+ from->addOutEdge( this );
+ to->addInEdge( this );
+ setLine( QLineF(int(from->x()), int(from->y()), int(to->x()), int(to->y()) ));
+ setZValue( 127 );
+ setBoundingRegionGranularity(0.05);
+}
+
+void EdgeItem::setFromPoint( int x, int y )
+{
+ setLine(QLineF( x,y, line().p2().x(), line().p2().y() ));
+}
+
+void EdgeItem::setToPoint( int x, int y )
+{
+ setLine(QLineF( line().p1().x(), line().p1().y(), x, y ));
+}
+
+QVariant NodeItem::itemChange(GraphicsItemChange change, const QVariant &value)
+{
+ if (change == ItemPositionHasChanged) {
+ Q3PtrListIterator<EdgeItem> it1( inList );
+ EdgeItem *edge;
+ while (( edge = it1.current() )) {
+ ++it1;
+ edge->setToPoint( int(x()), int(y()) );
+ }
+ Q3PtrListIterator<EdgeItem> it2( outList );
+ while (( edge = it2.current() )) {
+ ++it2;
+ edge->setFromPoint( int(x()), int(y()) );
+ }
+ }
+
+ return QGraphicsEllipseItem::itemChange(change, value);
+}
+
+NodeItem::NodeItem( )
+ : QGraphicsEllipseItem( QRectF(-3, -3, 6, 6) )
+{
+ setPen( *tp );
+ setBrush( *tb );
+ setZValue( 128 );
+ setFlag(ItemIsMovable);
+}
+
+FigureEditor::FigureEditor(
+ QGraphicsScene& c, QWidget* parent,
+ const char* name, Qt::WindowFlags f) :
+ QGraphicsView(&c,parent)
+{
+ setObjectName(name);
+ setWindowFlags(f);
+ setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+}
+
+void FigureEditor::clear()
+{
+ scene()->clear();
+}
+
+BouncyLogo::BouncyLogo() :
+ xvel(0), yvel(0)
+{
+ setPixmap(QPixmap(":/trolltech/examples/graphicsview/portedcanvas/qt-trans.xpm"));
+}
+
+const int logo_rtti = 1234;
+
+int BouncyLogo::type() const
+{
+ return logo_rtti;
+}
+
+QPainterPath BouncyLogo::shape() const
+{
+ QPainterPath path;
+ path.addRect(boundingRect());
+ return path;
+}
+
+void BouncyLogo::initPos()
+{
+ initSpeed();
+ int trial=1000;
+ do {
+ setPos(qrand()%int(scene()->width()),qrand()%int(scene()->height()));
+ advance(0);
+ } while (trial-- && xvel==0.0 && yvel==0.0);
+}
+
+void BouncyLogo::initSpeed()
+{
+ const double speed = 4.0;
+ double d = (double)(qrand()%1024) / 1024.0;
+ xvel = d*speed*2-speed;
+ yvel = (1-d)*speed*2-speed;
+}
+
+void BouncyLogo::advance(int stage)
+{
+ switch ( stage ) {
+ case 0: {
+ double vx = xvel;
+ double vy = yvel;
+
+ if ( vx == 0.0 && vy == 0.0 ) {
+ // stopped last turn
+ initSpeed();
+ vx = xvel;
+ vy = yvel;
+ }
+
+ double nx = x() + vx;
+ double ny = y() + vy;
+
+ if ( nx < 0 || nx >= scene()->width() )
+ vx = -vx;
+ if ( ny < 0 || ny >= scene()->height() )
+ vy = -vy;
+
+ for (int bounce=0; bounce<4; bounce++) {
+ QList<QGraphicsItem *> l=scene()->collidingItems(this);
+ for (QList<QGraphicsItem *>::Iterator it=l.begin(); it!=l.end(); ++it) {
+ QGraphicsItem *hit = *it;
+ QPainterPath advancedShape = QMatrix().translate(xvel, yvel).map(shape());
+ if ( hit->type()==logo_rtti && hit->collidesWithPath(mapToItem(hit, advancedShape)) ) {
+ switch ( bounce ) {
+ case 0:
+ vx = -vx;
+ break;
+ case 1:
+ vy = -vy;
+ vx = -vx;
+ break;
+ case 2:
+ vx = -vx;
+ break;
+ case 3:
+ // Stop for this turn
+ vx = 0;
+ vy = 0;
+ break;
+ }
+ xvel = vx;
+ yvel = vy;
+ break;
+ }
+ }
+ }
+
+ if ( x()+vx < 0 || x()+vx >= scene()->width() )
+ vx = 0;
+ if ( y()+vy < 0 || y()+vy >= scene()->height() )
+ vy = 0;
+
+ xvel = vx;
+ yvel = vy;
+ } break;
+ case 1:
+ moveBy(xvel, yvel);
+ break;
+ }
+}
+
+static uint mainCount = 0;
+static QImage *butterflyimg;
+static QImage *logoimg;
+
+Main::Main(QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) :
+ Q3MainWindow(parent,name,f),
+ canvas(c)
+{
+ editor = new FigureEditor(canvas,this);
+ QMenuBar* menu = menuBar();
+
+ Q3PopupMenu* file = new Q3PopupMenu( menu );
+ file->insertItem("&Fill canvas", this, SLOT(init()), Qt::CTRL+Qt::Key_F);
+ file->insertItem("&Erase canvas", this, SLOT(clear()), Qt::CTRL+Qt::Key_E);
+ file->insertItem("&New view", this, SLOT(newView()), Qt::CTRL+Qt::Key_N);
+ file->insertSeparator();
+ file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
+ file->insertSeparator();
+ file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
+ menu->insertItem("&File", file);
+
+ Q3PopupMenu* edit = new Q3PopupMenu( menu );
+ edit->insertItem("Add &Circle", this, SLOT(addCircle()), Qt::ALT+Qt::Key_C);
+ edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), Qt::ALT+Qt::Key_H);
+ edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), Qt::ALT+Qt::Key_P);
+ edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), Qt::ALT+Qt::Key_I);
+ edit->insertItem("Add &Text", this, SLOT(addText()), Qt::ALT+Qt::Key_T);
+ edit->insertItem("Add &Line", this, SLOT(addLine()), Qt::ALT+Qt::Key_L);
+ edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), Qt::ALT+Qt::Key_R);
+ edit->insertItem("Add &Sprite", this, SLOT(addSprite()), Qt::ALT+Qt::Key_S);
+ edit->insertItem("Create &Mesh", this, SLOT(addMesh()), Qt::ALT+Qt::Key_M );
+ edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), Qt::ALT+Qt::Key_A);
+ menu->insertItem("&Edit", edit);
+
+ Q3PopupMenu* view = new Q3PopupMenu( menu );
+ view->insertItem("&Enlarge", this, SLOT(enlarge()), Qt::SHIFT+Qt::CTRL+Qt::Key_Plus);
+ view->insertItem("Shr&ink", this, SLOT(shrink()), Qt::SHIFT+Qt::CTRL+Qt::Key_Minus);
+ view->insertSeparator();
+ view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), Qt::CTRL+Qt::Key_PageDown);
+ view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), Qt::CTRL+Qt::Key_PageUp);
+ view->insertItem("&Zoom in", this, SLOT(zoomIn()), Qt::CTRL+Qt::Key_Plus);
+ view->insertItem("Zoom &out", this, SLOT(zoomOut()), Qt::CTRL+Qt::Key_Minus);
+ view->insertItem("Translate left", this, SLOT(moveL()), Qt::CTRL+Qt::Key_Left);
+ view->insertItem("Translate right", this, SLOT(moveR()), Qt::CTRL+Qt::Key_Right);
+ view->insertItem("Translate up", this, SLOT(moveU()), Qt::CTRL+Qt::Key_Up);
+ view->insertItem("Translate down", this, SLOT(moveD()), Qt::CTRL+Qt::Key_Down);
+ view->insertItem("&Mirror", this, SLOT(mirror()), Qt::CTRL+Qt::Key_Home);
+ menu->insertItem("&View", view);
+
+ menu->insertSeparator();
+
+ Q3PopupMenu* help = new Q3PopupMenu( menu );
+ help->insertItem("&About", this, SLOT(help()), Qt::Key_F1);
+ help->setItemChecked(dbf_id, TRUE);
+ menu->insertItem("&Help",help);
+
+ statusBar();
+
+ setCentralWidget(editor);
+
+ printer = 0;
+
+ init();
+}
+
+void Main::init()
+{
+ clear();
+
+ static int r=24;
+ qsrand(++r);
+
+ mainCount++;
+ butterflyimg = 0;
+ logoimg = 0;
+
+ int i;
+ for ( i=0; i < int(canvas.width()) / 56; i++) {
+ addButterfly();
+ }
+ for ( i=0; i < int(canvas.width()) / 85; i++) {
+ addHexagon();
+ }
+ for ( i=0; i < int(canvas.width()) / 128; i++) {
+ addLogo();
+ }
+}
+
+Main::~Main()
+{
+ delete printer;
+ if ( !--mainCount ) {
+ delete[] butterflyimg;
+ butterflyimg = 0;
+ delete[] logoimg;
+ logoimg = 0;
+ }
+}
+
+void Main::newView()
+{
+ // Open a new view... have it delete when closed.
+ Main *m = new Main(canvas, 0, 0, Qt::WDestructiveClose);
+ m->show();
+}
+
+void Main::clear()
+{
+ editor->clear();
+}
+
+void Main::help()
+{
+ static QMessageBox* about = new QMessageBox( "Qt Canvas Example",
+ "<h3>The QCanvas classes example</h3>"
+ "<ul>"
+ "<li> Press ALT-S for some sprites."
+ "<li> Press ALT-C for some circles."
+ "<li> Press ALT-L for some lines."
+ "<li> Drag the objects around."
+ "<li> Read the code!"
+ "</ul>", QMessageBox::Information, 1, 0, 0, this, 0, FALSE );
+ about->setButtonText( 1, "Dismiss" );
+ about->show();
+}
+
+void Main::aboutQt()
+{
+ QMessageBox::aboutQt( this, "Qt Canvas Example" );
+}
+
+void Main::enlarge()
+{
+ canvas.setSceneRect(0, 0, canvas.width()*4/3, canvas.height()*4/3);
+}
+
+void Main::shrink()
+{
+ canvas.setSceneRect(0, 0, qMax(canvas.width()*3/4, qreal(1.0)), qMax(canvas.height()*3/4, qreal(1.0)));
+}
+
+void Main::rotateClockwise()
+{
+ editor->rotate( 22.5 );
+}
+
+void Main::rotateCounterClockwise()
+{
+ editor->rotate( -22.5 );
+}
+
+void Main::zoomIn()
+{
+ editor->scale( 2.0, 2.0 );
+}
+
+void Main::zoomOut()
+{
+ editor->scale( 0.5, 0.5 );
+}
+
+void Main::mirror()
+{
+ editor->scale( -1, 1 );
+}
+
+void Main::moveL()
+{
+ editor->translate( -16, 0 );
+}
+
+void Main::moveR()
+{
+ editor->translate( +16, 0 );
+}
+
+void Main::moveU()
+{
+ editor->translate( 0, -16 );
+}
+
+void Main::moveD()
+{
+ editor->translate( 0, +16 );
+}
+
+void Main::print()
+{
+ if ( !printer ) printer = new QPrinter;
+ if ( printer->setup(this) ) {
+ QPainter pp(printer);
+ canvas.render(&pp);
+ }
+}
+
+
+void Main::addSprite()
+{
+ BouncyLogo* i = new BouncyLogo;
+ canvas.addItem(i);
+ i->initPos();
+ i->setZValue(qrand()%256);
+}
+
+QString butterfly_fn;
+QString logo_fn;
+
+
+void Main::addButterfly()
+{
+ if ( butterfly_fn.isEmpty() )
+ return;
+ if ( !butterflyimg ) {
+ butterflyimg = new QImage[4];
+ butterflyimg[0].load( butterfly_fn );
+ butterflyimg[1] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.75),
+ int(butterflyimg[0].height()*0.75) );
+ butterflyimg[2] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.5),
+ int(butterflyimg[0].height()*0.5) );
+ butterflyimg[3] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.25),
+ int(butterflyimg[0].height()*0.25) );
+ }
+ QAbstractGraphicsShapeItem* i = new ImageItem(butterflyimg[qrand()%4]);
+ canvas.addItem(i);
+ i->setPos(qrand()%int(canvas.width()-butterflyimg->width()),
+ qrand()%int(canvas.height()-butterflyimg->height()));
+ i->setZValue(qrand()%256+250);
+}
+
+void Main::addLogo()
+{
+ if ( logo_fn.isEmpty() )
+ return;
+ if ( !logoimg ) {
+ logoimg = new QImage[4];
+ logoimg[0].load( logo_fn );
+ logoimg[1] = logoimg[0].smoothScale( int(logoimg[0].width()*0.75),
+ int(logoimg[0].height()*0.75) );
+ logoimg[2] = logoimg[0].smoothScale( int(logoimg[0].width()*0.5),
+ int(logoimg[0].height()*0.5) );
+ logoimg[3] = logoimg[0].smoothScale( int(logoimg[0].width()*0.25),
+ int(logoimg[0].height()*0.25) );
+ }
+ QAbstractGraphicsShapeItem* i = new ImageItem(logoimg[qrand()%4]);
+ canvas.addItem(i);
+ i->setPos(qrand()%int(canvas.width()-logoimg->width()),
+ qrand()%int(canvas.height()-logoimg->width()));
+ i->setZValue(qrand()%256+256);
+}
+
+
+
+void Main::addCircle()
+{
+ QAbstractGraphicsShapeItem* i = canvas.addEllipse(QRectF(0,0,50,50));
+ i->setFlag(QGraphicsItem::ItemIsMovable);
+ i->setPen(Qt::NoPen);
+ i->setBrush( QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8) );
+ i->setPos(qrand()%int(canvas.width()),qrand()%int(canvas.height()));
+ i->setZValue(qrand()%256);
+}
+
+void Main::addHexagon()
+{
+ const int size = int(canvas.width() / 25);
+ Q3PointArray pa(6);
+ pa[0] = QPoint(2*size,0);
+ pa[1] = QPoint(size,-size*173/100);
+ pa[2] = QPoint(-size,-size*173/100);
+ pa[3] = QPoint(-2*size,0);
+ pa[4] = QPoint(-size,size*173/100);
+ pa[5] = QPoint(size,size*173/100);
+ QGraphicsPolygonItem* i = canvas.addPolygon(pa);
+ i->setFlag(QGraphicsItem::ItemIsMovable);
+ i->setPen(Qt::NoPen);
+ i->setBrush( QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8) );
+ i->setPos(qrand()%int(canvas.width()),qrand()%int(canvas.height()));
+ i->setZValue(qrand()%256);
+}
+
+void Main::addPolygon()
+{
+ const int size = int(canvas.width()/2);
+ Q3PointArray pa(6);
+ pa[0] = QPoint(0,0);
+ pa[1] = QPoint(size,size/5);
+ pa[2] = QPoint(size*4/5,size);
+ pa[3] = QPoint(size/6,size*5/4);
+ pa[4] = QPoint(size*3/4,size*3/4);
+ pa[5] = QPoint(size*3/4,size/4);
+ QGraphicsPolygonItem* i = canvas.addPolygon(pa);
+ i->setFlag(QGraphicsItem::ItemIsMovable);
+ i->setPen(Qt::NoPen);
+ i->setBrush( QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8) );
+ i->setPos(qrand()%int(canvas.width()),qrand()%int(canvas.height()));
+ i->setZValue(qrand()%256);
+}
+
+void Main::addSpline()
+{
+ const int size = int(canvas.width()/6);
+
+ Q3PointArray pa(12);
+ pa[0] = QPoint(0,0);
+ pa[1] = QPoint(size/2,0);
+ pa[2] = QPoint(size,size/2);
+ pa[3] = QPoint(size,size);
+ pa[4] = QPoint(size,size*3/2);
+ pa[5] = QPoint(size/2,size*2);
+ pa[6] = QPoint(0,size*2);
+ pa[7] = QPoint(-size/2,size*2);
+ pa[8] = QPoint(size/4,size*3/2);
+ pa[9] = QPoint(0,size);
+ pa[10]= QPoint(-size/4,size/2);
+ pa[11]= QPoint(-size/2,0);
+
+ QPainterPath path;
+ path.moveTo(pa[0]);
+ for (int i = 1; i < pa.size(); i += 3)
+ path.cubicTo(pa[i], pa[(i + 1) % pa.size()], pa[(i + 2) % pa.size()]);
+
+ QGraphicsPathItem* item = canvas.addPath(path);
+ item->setFlag(QGraphicsItem::ItemIsMovable);
+ item->setPen(Qt::NoPen);
+ item->setBrush( QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8) );
+ item->setPos(qrand()%int(canvas.width()),qrand()%int(canvas.height()));
+ item->setZValue(qrand()%256);
+}
+
+void Main::addText()
+{
+ QGraphicsTextItem* i = canvas.addText("QCanvasText");
+ i->setFlag(QGraphicsItem::ItemIsMovable);
+ i->setPos(qrand()%int(canvas.width()),qrand()%int(canvas.height()));
+ i->setZValue(qrand()%256);
+}
+
+void Main::addLine()
+{
+ QGraphicsLineItem* i = canvas.addLine(QLineF( qrand()%int(canvas.width()), qrand()%int(canvas.height()),
+ qrand()%int(canvas.width()), qrand()%int(canvas.height()) ));
+ i->setFlag(QGraphicsItem::ItemIsMovable);
+ i->setPen( QPen(QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8), 6) );
+ i->setZValue(qrand()%256);
+}
+
+void Main::addMesh()
+{
+ int x0 = 0;
+ int y0 = 0;
+
+ if ( !tb ) tb = new QBrush( Qt::red );
+ if ( !tp ) tp = new QPen( Qt::black );
+
+ int nodecount = 0;
+
+ int w = int(canvas.width());
+ int h = int(canvas.height());
+
+ const int dist = 30;
+ int rows = h / dist;
+ int cols = w / dist;
+
+#ifndef QT_NO_PROGRESSDIALOG
+ Q3ProgressDialog progress( "Creating mesh...", "Abort", rows,
+ this, "progress", TRUE );
+#endif
+
+ canvas.update();
+
+ Q3MemArray<NodeItem*> lastRow(cols);
+ for ( int j = 0; j < rows; j++ ) {
+ int n = j%2 ? cols-1 : cols;
+ NodeItem *prev = 0;
+ for ( int i = 0; i < n; i++ ) {
+ NodeItem *el = new NodeItem;
+ canvas.addItem(el);
+ nodecount++;
+ int r = qrand();
+ int xrand = r %20;
+ int yrand = (r/20) %20;
+ el->setPos( xrand + x0 + i*dist + (j%2 ? dist/2 : 0 ),
+ yrand + y0 + j*dist );
+
+ if ( j > 0 ) {
+ if ( i < cols-1 )
+ canvas.addItem(new EdgeItem( lastRow[i], el));
+ if ( j%2 )
+ canvas.addItem(new EdgeItem( lastRow[i+1], el));
+ else if ( i > 0 )
+ canvas.addItem(new EdgeItem( lastRow[i-1], el));
+ }
+ if ( prev ) {
+ canvas.addItem(new EdgeItem( prev, el));
+ }
+ if ( i > 0 ) lastRow[i-1] = prev;
+ prev = el;
+ }
+ lastRow[n-1]=prev;
+#ifndef QT_NO_PROGRESSDIALOG
+ progress.setProgress( j );
+ if ( progress.wasCancelled() )
+ break;
+#endif
+ }
+#ifndef QT_NO_PROGRESSDIALOG
+ progress.setProgress( rows );
+#endif
+ // qDebug( "%d nodes, %d edges", nodecount, EdgeItem::count() );
+}
+
+void Main::addRectangle()
+{
+ QAbstractGraphicsShapeItem *i = canvas.addRect( QRectF(qrand()%int(canvas.width()),
+ qrand()%int(canvas.height()),
+ canvas.width()/5,
+ canvas.width()/5) );
+ i->setFlag(QGraphicsItem::ItemIsMovable);
+ int z = qrand()%256;
+ i->setBrush( QColor(z,z,z) );
+ i->setPen( QPen(QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8), 6) );
+ i->setZValue(z);
+}
diff --git a/examples/graphicsview/portedcanvas/canvas.doc b/examples/graphicsview/portedcanvas/canvas.doc
new file mode 100644
index 0000000..f6d77ad
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/canvas.doc
@@ -0,0 +1,29 @@
+/*! \page canvas-example.html
+
+ \ingroup examples
+ \title Canvas Example
+
+ This example shows a QCanvas and some \l{QCanvasItem}s in action.
+ You can do a lot more with QCanvas than we show here, but the
+ example provides a taste of what can be done.
+
+ <hr>
+
+ Header file:
+
+ \include canvas/canvas.h
+
+ <hr>
+
+ Implementation:
+
+ \include canvas/canvas.cpp
+
+ <hr>
+
+ Main:
+
+ \include canvas/main.cpp
+*/
+
+
diff --git a/examples/graphicsview/portedcanvas/canvas.h b/examples/graphicsview/portedcanvas/canvas.h
new file mode 100644
index 0000000..769edbf
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/canvas.h
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EXAMPLE_H
+#define EXAMPLE_H
+
+#include <q3popupmenu.h>
+#include <q3mainwindow.h>
+#include <q3intdict.h>
+#include <QMouseEvent>
+#include <QGraphicsView>
+#include <QGraphicsScene>
+#include <QGraphicsItem>
+
+class BouncyLogo : public QGraphicsPixmapItem {
+ void initSpeed();
+public:
+ BouncyLogo();
+ void advance(int);
+ int type() const;
+
+ QPainterPath shape() const;
+
+ void initPos();
+private:
+ qreal xvel;
+ qreal yvel;
+};
+
+
+class FigureEditor : public QGraphicsView {
+ Q_OBJECT
+
+public:
+ FigureEditor(QGraphicsScene&, QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0);
+ void clear();
+
+signals:
+ void status(const QString&);
+};
+
+class Main : public Q3MainWindow {
+ Q_OBJECT
+
+public:
+ Main(QGraphicsScene&, QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0);
+ ~Main();
+
+public slots:
+ void help();
+
+private slots:
+ void aboutQt();
+ void newView();
+ void clear();
+ void init();
+
+ void addSprite();
+ void addCircle();
+ void addHexagon();
+ void addPolygon();
+ void addSpline();
+ void addText();
+ void addLine();
+ void addRectangle();
+ void addMesh();
+ void addLogo();
+ void addButterfly();
+
+ void enlarge();
+ void shrink();
+ void rotateClockwise();
+ void rotateCounterClockwise();
+ void zoomIn();
+ void zoomOut();
+ void mirror();
+ void moveL();
+ void moveR();
+ void moveU();
+ void moveD();
+
+ void print();
+
+private:
+ QGraphicsScene& canvas;
+ FigureEditor *editor;
+
+ Q3PopupMenu* options;
+ QPrinter* printer;
+ int dbf_id;
+};
+
+#endif
diff --git a/examples/graphicsview/portedcanvas/main.cpp b/examples/graphicsview/portedcanvas/main.cpp
new file mode 100644
index 0000000..b68c4cb
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/main.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qstatusbar.h>
+#include <qmessagebox.h>
+#include <qmenubar.h>
+#include <qapplication.h>
+#include <qdesktopwidget.h>
+#include <qimage.h>
+#include <qtimer.h>
+
+#include "canvas.h"
+
+#include <stdlib.h>
+
+extern QString butterfly_fn;
+extern QString logo_fn;
+
+int main(int argc, char** argv)
+{
+ Q_INIT_RESOURCE(portedcanvas);
+
+ QApplication app(argc,argv);
+
+ if ( argc > 1 )
+ butterfly_fn = argv[1];
+ else
+ butterfly_fn = ":/trolltech/examples/graphicsview/portedcanvas/butterfly.png";
+
+ if ( argc > 2 )
+ logo_fn = argv[2];
+ else
+ logo_fn = ":/trolltech/examples/graphicsview/portedcanvas/qtlogo.png";
+
+ QGraphicsScene canvas;
+ canvas.setSceneRect(0, 0, 800, 600);
+ Main m(canvas);
+ m.resize(m.sizeHint());
+ m.setCaption("Ported Canvas Example");
+ if ( QApplication::desktop()->width() > m.width() + 10
+ && QApplication::desktop()->height() > m.height() +30 )
+ m.show();
+ else
+ m.showMaximized();
+
+ QTimer timer;
+ QObject::connect(&timer, SIGNAL(timeout()), &canvas, SLOT(advance()));
+ timer.start(30);
+
+ QObject::connect( qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()) );
+
+ return app.exec();
+}
+
diff --git a/examples/graphicsview/portedcanvas/makeimg.cpp b/examples/graphicsview/portedcanvas/makeimg.cpp
new file mode 100644
index 0000000..93a8efe
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/makeimg.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qimage.h>
+#include <qcolor.h>
+
+static inline int blendComponent( int v, int av, int s, int as )
+{
+ //shadow gets a color inversely proportional to the
+ //alpha value
+ s = (s*(255-as))/255;
+ //then do standard blending
+ return as*s + av*v -(av*as*s)/255;
+}
+
+static inline QRgb blendShade( QRgb v, QRgb s )
+{
+ //pick a number: shadow is 1/3 of object
+ int as = qAlpha(s)/3;
+ int av = qAlpha(v);
+ if ( as == 0 || av == 255 )
+ return v;
+
+ int a = as + av -(as*av)/255;
+
+
+ int r = blendComponent( qRed(v),av, qRed(s), as)/a;
+ int g = blendComponent( qGreen(v),av, qGreen(s), as)/a;
+ int b = blendComponent( qBlue(v),av, qBlue(s), as)/a;
+
+ return qRgba(r,g,b,a);
+}
+
+int main( int*, char**)
+{
+ QImage *img;
+
+ img = new QImage( "in.png" );
+ int w,h;
+ int y;
+ img->setAlphaBuffer( TRUE );
+ *img = img->convertDepth( 32 );
+ w = img->width();
+ h = img->height();
+#if 0
+ for ( y = 0; y < h; y ++ ) {
+ uint *line = (uint*)img->scanLine( y );
+ for ( int x = 0; x < w; x++ ) {
+ uint pixel = line[x];
+ int r = qRed(pixel);
+ int g = qGreen(pixel);
+ int b = qBlue(pixel);
+ int min = QMIN( r, QMIN( g, b ) );
+ int max = QMAX( r, QMAX( g, b ) );
+ r -= min;
+ g -= min;
+ b -= min;
+ if ( max !=min ) {
+ r = (r*255)/(max-min);
+ g = (g*255)/(max-min);
+ b = (b*255)/(max-min);
+ }
+ int a = 255-min;
+ a -= (max-min)/3; //hack more transparency for colors.
+ line[x] = qRgba( r, g, b, a );
+ }
+ }
+#endif
+ *img = img->smoothScale( w/2, h/2 );
+
+ qDebug( "saving out.png");
+ img->save( "out.png", "PNG" );
+
+ w = img->width();
+ h = img->height();
+
+ QImage *img2 = new QImage( w, h, 32 );
+ img2->setAlphaBuffer( TRUE );
+ for ( y = 0; y < h; y++ ) {
+ for ( int x = 0; x < w; x++ ) {
+ QRgb shader = img->pixel( x, y );
+
+ int as = qAlpha(shader)/3;
+
+ int r = (qRed(shader)*(255-as))/255;
+ int g = (qGreen(shader)*(255-as))/255;
+ int b = (qBlue(shader)*(255-as))/255;
+
+ img2->setPixel( x, y, qRgba(r,g,b,as) );
+ }
+ }
+
+ img2->save( "outshade.png", "PNG" );
+
+}
diff --git a/examples/graphicsview/portedcanvas/portedcanvas.pro b/examples/graphicsview/portedcanvas/portedcanvas.pro
new file mode 100644
index 0000000..71e3d84
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/portedcanvas.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+TARGET = portedcanvas
+
+CONFIG += qt warn_on
+
+HEADERS = canvas.h
+SOURCES = canvas.cpp main.cpp
+QT += qt3support
+
+RESOURCES += portedcanvas.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/portedcanvas
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS portedcanvas.pro *.png *.xpm *.doc
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/portedcanvas
+INSTALLS += target sources
diff --git a/examples/graphicsview/portedcanvas/portedcanvas.qrc b/examples/graphicsview/portedcanvas/portedcanvas.qrc
new file mode 100644
index 0000000..cf2e024
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/portedcanvas.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/trolltech/examples/graphicsview/portedcanvas">
+<file>qt-trans.xpm</file>
+<file>butterfly.png</file>
+<file>qtlogo.png</file>
+</qresource>
+</RCC>
diff --git a/examples/graphicsview/portedcanvas/qt-trans.xpm b/examples/graphicsview/portedcanvas/qt-trans.xpm
new file mode 100644
index 0000000..225f684
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/qt-trans.xpm
@@ -0,0 +1,54 @@
+/* XPM */
+static char *qtlogo_xpm[] = {
+/* width height ncolors chars_per_pixel */
+"54 34 13 1",
+/* colors */
+" c #000000",
+". c #999999",
+"X c #333366",
+"o c #6666CC",
+"O c #333333",
+"@ c #666699",
+"# c #000066",
+"$ c #666666",
+"% c #3333CC",
+"& c #000033",
+"* c #9999CC",
+"= c #333399",
+"+ c None",
+/* pixels */
+"+++++++++++++++++++.$OOO$.++++++++++++++++++++++++++++",
+"+++++++++++++++++$ O.+++++++++++++++++++++++++",
+"+++++++++++++++.O $++++++++++++++++++++++++",
+"++++++++++++++. $.++.$ O+++++++++++++++++++++++",
+"+++++++++++++. O.+++++++$ O++++++++++++++++++++++",
+"+++++++++++++O ++++++++++$ $+++++++++++++++++++++",
+"++++++++++++$ .+++++++++++O .++++++++++++++++++++",
+"+++++++++++. O+++++++++++++ O++++++.+++++++++++++",
+"+++++++++++$ .+++++++++++++$ .+++.O +++++++++++++",
+"+++++++++++ +++++++++++++++ O+++. +++++++++++++",
+"++++++++++. &Xoooo*++++++++++$ +++. +++++++++++++",
+"++++++++++@=%%%%%%%%%%*+++++++. .++. +++++++++++++",
+"+++++++**oooooo**++*o%%%%o+++++ $++O +++++++++++++",
+"+++++*****$OOX@oooo*++*%%%%%*++O $+. OOO$++++++++*",
+"++..+.++....$O$+*ooooo*+*o%%%%%O O+$ $$O.++++++**+",
+"***+*+++++$$....+++*oooo**+*o%%# O++O ++++++***o*++",
+"*+++++++++O $.....++**oooo**+*X &o*O ++++*ooo*++++",
+"++++++++++$ O++.....++**oooo*X &%%& ..*o%%*++++++",
+"++++++++++$ ++++.....+++**ooO $*o& @oo*+++++++++",
+"++++++++++. .++++++.....+++*O Xo*O .++++++++++++",
+"+++++++++++ O+++++++++...... .++O +++++++++++++",
+"+++++++++++O +++.$$$.++++++. O+++O +++++++++++++",
+"+++++++++++. $$OO O.++++O .+++O +++++++++++++",
+"++++++++++++O .+++.O $++. O++++O +++++++++++++",
+"++++++++++++. O+++++O $+O +++++O +++++++++++++",
+"+++++++++++++. O+++++O O .+++++O .++++++++++++",
+"++++++++++++++$ .++++O .++++.+$ O+.$.++++++++",
+"+++++++++++++++. O$$O .+++++... +++++++++",
+"+++++++++++++++++$ O+++++$$+.O O$.+++++++++",
+"+++++++++++++++++++$OO O$.O O.++. .++++++++++++++++",
+"+++++++++++++++++++++++++++. OO .++++++++++++++++",
+"++++++++++++++++++++++++++++. O+++++++++++++++++",
+"+++++++++++++++++++++++++++++. .+++++++++++++++++",
+"++++++++++++++++++++++++++++++.O O.++++++++++++++++++"
+};
diff --git a/examples/graphicsview/portedcanvas/qtlogo.png b/examples/graphicsview/portedcanvas/qtlogo.png
new file mode 100644
index 0000000..5aac08a
--- /dev/null
+++ b/examples/graphicsview/portedcanvas/qtlogo.png
Binary files differ
diff --git a/examples/help/README b/examples/help/README
new file mode 100644
index 0000000..85f5a43
--- /dev/null
+++ b/examples/help/README
@@ -0,0 +1,38 @@
+Support for interactive help is provided by the Qt Assistant application.
+Developers can take advantages of the facilities it offers to display
+specially-prepared documentation to users of their applications.
+
+
+The example launcher provided with Qt can be used to explore each of the
+examples in this directory.
+
+Documentation for these examples can be found via the Tutorial and Examples
+link in the main Qt documentation.
+
+
+Finding the Qt Examples and Demos launcher
+==========================================
+
+On Windows:
+
+The launcher can be accessed via the Windows Start menu. Select the menu
+entry entitled "Qt Examples and Demos" entry in the submenu containing
+the Qt tools.
+
+On Mac OS X:
+
+For the binary distribution, the qtdemo executable is installed in the
+/Developer/Applications/Qt directory. For the source distribution, it is
+installed alongside the other Qt tools on the path specified when Qt is
+configured.
+
+On Unix/Linux:
+
+The qtdemo executable is installed alongside the other Qt tools on the path
+specified when Qt is configured.
+
+On all platforms:
+
+The source code for the launcher can be found in the demos/qtdemo directory
+in the Qt package. This example is built at the same time as the Qt libraries,
+tools, examples, and demonstrations.
diff --git a/examples/help/contextsensitivehelp/contextsensitivehelp.pro b/examples/help/contextsensitivehelp/contextsensitivehelp.pro
new file mode 100644
index 0000000..5a8c0b1
--- /dev/null
+++ b/examples/help/contextsensitivehelp/contextsensitivehelp.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+
+CONFIG += help
+
+SOURCES += main.cpp \
+ wateringconfigdialog.cpp \
+ helpbrowser.cpp
+
+HEADERS += wateringconfigdialog.h \
+ helpbrowser.h
+
+FORMS += wateringconfigdialog.ui
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/help/contextsensitivehelp
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png *.doc doc
+sources.path = $$[QT_INSTALL_EXAMPLES]/help/contextsensitivehelp
+INSTALLS += target sources
diff --git a/examples/help/contextsensitivehelp/doc/amount.html b/examples/help/contextsensitivehelp/doc/amount.html
new file mode 100644
index 0000000..7a02a6f
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/amount.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Water amount</title>
+ </head>
+ <body>
+ Depending on the plant, temperature and rain fall the amount needs to be larger
+ or smaller. On a really hot day without rain, the suggested <a href="plants.html">amount</a>
+ can be increased by about 10%.
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/filter.html b/examples/help/contextsensitivehelp/doc/filter.html
new file mode 100644
index 0000000..6486112
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/filter.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Filter</title>
+</head>
+<body>
+Depending on the source of water, it needs to be filtered or not. Filtering
+is strongly recommened for the river and lake.
+
+
+</body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/plants.html b/examples/help/contextsensitivehelp/doc/plants.html
new file mode 100644
index 0000000..2d2bb67
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/plants.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Plants</title>
+ </head>
+ <body>
+ Different kind of plants need different amounts of water. Here's a short
+ overview over the most common grown plants and their avarage need of water:
+ <br>
+ <table border=1>
+ <tr>
+ <td>Kind</td>
+ <td>Amount</td>
+ </tr>
+ <tr>
+ <td>Squash</td>
+ <td>2000</td>
+ </tr>
+ <tr>
+ <td>Bean</td>
+ <td>1500</td>
+ </tr>
+ <tr>
+ <td>Carrot</td>
+ <td>1200</td>
+ </tr>
+ <tr>
+ <td>Strawberry</td>
+ <td>1300</td>
+ </tr>
+ <tr>
+ <td>Raspberry</td>
+ <td>1000</td>
+ </tr>
+ <tr>
+ <td>Blueberry</td>
+ <td>1100</td>
+ </tr>
+ </table>
+ <br><br>
+ <font color="#ff0000">Warning:</font> Watering them too much or too little will
+ cause irreversible damage!
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/rain.html b/examples/help/contextsensitivehelp/doc/rain.html
new file mode 100644
index 0000000..1ffe452
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/rain.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Rain</title>
+ </head>
+ <body>
+ Depending on the rain fall, the automated watering system should not be
+ switched on at all. Also, the <a href="./temperature.html">temperature</a> should be
+ considered.
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/source.html b/examples/help/contextsensitivehelp/doc/source.html
new file mode 100644
index 0000000..2140765
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/source.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Water Source</title>
+ </head>
+ <body>
+ The current pipe system connects to four different sources. Be aware that only
+ a limited amount of water can be taken from some sources.
+ <br>
+ <table border=1>
+ <tr>
+ <td>Source</td>
+ <td>Amount</td>
+ </tr>
+ <tr>
+ <td>Foundain</td>
+ <td>4000</td>
+ </tr>
+ <tr>
+ <td>River</td>
+ <td>6000</td>
+ </tr>
+ <tr>
+ <td>Lake</td>
+ <td>10000</td>
+ </tr>
+ <tr>
+ <td>Public Water System</td>
+ <td>unlimited</td>
+ </tr>
+ </table>
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/temperature.html b/examples/help/contextsensitivehelp/doc/temperature.html
new file mode 100644
index 0000000..4145ed7
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/temperature.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title>Temperature</title>
+ </head>
+ <body>
+ Depending on the temperature, the plants need more or less water. The higher
+ the temperature the higher the need for water. If the temperature does not
+ reach a certain level, maybe no automatic watering should be done at all.<br>
+ Before setting this parameter for good, you should also take the amount of <a href="./rain.html">
+ rain</a> into account.
+ </body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/time.html b/examples/help/contextsensitivehelp/doc/time.html
new file mode 100644
index 0000000..0cc81f4
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/time.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Starting time</title>
+</head>
+<body>
+Starting the watering too early may be ineffective since most water
+will evaporate.
+
+</body>
+</html>
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qch b/examples/help/contextsensitivehelp/doc/wateringmachine.qch
new file mode 100644
index 0000000..e74f9b8
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qch
Binary files differ
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
new file mode 100644
index 0000000..3227c3a2
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc
Binary files differ
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp
new file mode 100644
index 0000000..eebf652
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<QHelpCollectionProject version="1.0">
+ <docFiles>
+ <generate>
+ <file>
+ <input>wateringmachine.qhp</input>
+ <output>wateringmachine.qch</output>
+ </file>
+ </generate>
+ <register>
+ <file>wateringmachine.qch</file>
+ </register>
+ </docFiles>
+</QHelpCollectionProject> \ No newline at end of file
diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
new file mode 100644
index 0000000..745d881
--- /dev/null
+++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<QtHelpProject version="1.0">
+ <virtualFolder>wateringmachine</virtualFolder>
+ <namespace>wateringcompany.com.1_0_0.premium</namespace>
+ <filterSection>
+ <keywords>
+ <keyword name="plants" id="plants" ref="plants.html"/>
+ <keyword name="temperature" id="temperature" ref="temperature.html"/>
+ <keyword name="rain" id="rain" ref="rain.html"/>
+ <keyword name="time" id="time" ref="time.html"/>
+ <keyword name="amount" id="amount" ref="amount.html"/>
+ <keyword name="source" id="source" ref="source.html"/>
+ <keyword name="filtering" id="filtering" ref="filter.html"/>
+ </keywords>
+ <files>
+ <file>plants.html</file>
+ <file>temperature.html</file>
+ <file>rain.html</file>
+ <file>time.html</file>
+ <file>amount.html</file>
+ <file>source.html</file>
+ <file>filter.html</file>
+ </files>
+ </filterSection>
+</QtHelpProject>
diff --git a/examples/help/contextsensitivehelp/helpbrowser.cpp b/examples/help/contextsensitivehelp/helpbrowser.cpp
new file mode 100644
index 0000000..100b940
--- /dev/null
+++ b/examples/help/contextsensitivehelp/helpbrowser.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QLibraryInfo>
+#include <QtGui/QApplication>
+#include <QtHelp/QHelpEngineCore>
+
+#include "helpbrowser.h"
+
+HelpBrowser::HelpBrowser(QWidget *parent)
+ : QTextBrowser(parent)
+{
+ QString collectionFile = QLibraryInfo::location(QLibraryInfo::ExamplesPath)
+ + QLatin1String("/help/contextsensitivehelp/doc/wateringmachine.qhc");
+
+ m_helpEngine = new QHelpEngineCore(collectionFile, this);
+ if (!m_helpEngine->setupData()) {
+ delete m_helpEngine;
+ m_helpEngine = 0;
+ }
+}
+
+void HelpBrowser::showHelpForKeyword(const QString &id)
+{
+ if (m_helpEngine) {
+ QMap<QString, QUrl> links = m_helpEngine->linksForIdentifier(id);
+ if (links.count())
+ setSource(links.constBegin().value());
+ }
+}
+
+QVariant HelpBrowser::loadResource(int type, const QUrl &name)
+{
+ QByteArray ba;
+ if (type < 4 && m_helpEngine) {
+ QUrl url(name);
+ if (name.isRelative())
+ url = source().resolved(url);
+ ba = m_helpEngine->fileData(url);
+ }
+ return ba;
+}
+
diff --git a/examples/help/contextsensitivehelp/helpbrowser.h b/examples/help/contextsensitivehelp/helpbrowser.h
new file mode 100644
index 0000000..1335524
--- /dev/null
+++ b/examples/help/contextsensitivehelp/helpbrowser.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HELPBROWSER_H
+#define HELPBROWSER_H
+
+#include <QtGui/QTextBrowser>
+
+QT_BEGIN_NAMESPACE
+class QHelpEngineCore;
+QT_END_NAMESPACE;
+
+class HelpBrowser : public QTextBrowser
+{
+ Q_OBJECT
+
+public:
+ HelpBrowser(QWidget *parent);
+ void showHelpForKeyword(const QString &id);
+
+private:
+ QVariant loadResource(int type, const QUrl &name);
+
+ QHelpEngineCore *m_helpEngine;
+};
+
+#endif
diff --git a/examples/help/contextsensitivehelp/main.cpp b/examples/help/contextsensitivehelp/main.cpp
new file mode 100644
index 0000000..b05cf3e
--- /dev/null
+++ b/examples/help/contextsensitivehelp/main.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+
+#include "wateringconfigdialog.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ WateringConfigDialog dia;
+ return dia.exec();
+}
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.cpp b/examples/help/contextsensitivehelp/wateringconfigdialog.cpp
new file mode 100644
index 0000000..285123a
--- /dev/null
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "wateringconfigdialog.h"
+
+WateringConfigDialog::WateringConfigDialog()
+{
+ m_ui.setupUi(this);
+ m_widgetInfo.insert(m_ui.plantComboBox, tr("plants"));
+ m_widgetInfo.insert(m_ui.temperatureCheckBox, tr("temperature"));
+ m_widgetInfo.insert(m_ui.temperatureSpinBox, tr("temperature"));
+ m_widgetInfo.insert(m_ui.rainCheckBox, tr("rain"));
+ m_widgetInfo.insert(m_ui.rainSpinBox, tr("rain"));
+ m_widgetInfo.insert(m_ui.startTimeEdit, tr("starting time"));
+ m_widgetInfo.insert(m_ui.amountSpinBox, tr("water amount"));
+ m_widgetInfo.insert(m_ui.sourceComboBox, tr("water source"));
+ m_widgetInfo.insert(m_ui.filterCheckBox, tr("water filtering"));
+
+ connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)),
+ this, SLOT(focusChanged(QWidget*, QWidget*)));
+}
+
+void WateringConfigDialog::focusChanged(QWidget *, QWidget *now)
+{
+ if (m_widgetInfo.contains(now)) {
+ m_ui.helpLabel->setText(tr("Information about %1:").arg(m_widgetInfo.value(now)));
+ QStringList lst = m_widgetInfo.value(now).split(QLatin1Char(' '));
+ m_ui.helpBrowser->showHelpForKeyword(lst.last());
+ }
+}
+
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.h b/examples/help/contextsensitivehelp/wateringconfigdialog.h
new file mode 100644
index 0000000..7fc3c51
--- /dev/null
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef WATERINGCONFIGDIALOG_H
+#define WATERINGCONFIGDIALOG_H
+
+#include <QtGui/QDialog>
+#include "ui_wateringconfigdialog.h"
+
+class WateringConfigDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ WateringConfigDialog();
+
+private slots:
+ void focusChanged(QWidget *old, QWidget *now);
+
+private:
+ Ui::WateringConfigDialog m_ui;
+ QMap<QWidget*, QString> m_widgetInfo;
+};
+
+#endif
diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.ui b/examples/help/contextsensitivehelp/wateringconfigdialog.ui
new file mode 100644
index 0000000..a7f5349
--- /dev/null
+++ b/examples/help/contextsensitivehelp/wateringconfigdialog.ui
@@ -0,0 +1,446 @@
+<ui version="4.0" >
+ <class>WateringConfigDialog</class>
+ <widget class="QDialog" name="WateringConfigDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>334</width>
+ <height>550</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Watering Configuration</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Plant:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="3" >
+ <widget class="QComboBox" name="plantComboBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <item>
+ <property name="text" >
+ <string>Squash</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Bean</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Carrot</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Strawberry</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Raspberry</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Blueberry</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>67</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Water when:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="3" >
+ <widget class="QCheckBox" name="temperatureCheckBox" >
+ <property name="text" >
+ <string>Temperature is higher than:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="2" >
+ <widget class="QSpinBox" name="temperatureSpinBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="specialValueText" >
+ <string/>
+ </property>
+ <property name="suffix" >
+ <string>C</string>
+ </property>
+ <property name="minimum" >
+ <number>10</number>
+ </property>
+ <property name="maximum" >
+ <number>60</number>
+ </property>
+ <property name="value" >
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="5" column="1" colspan="3" >
+ <widget class="QCheckBox" name="rainCheckBox" >
+ <property name="text" >
+ <string>Rain less than:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="2" >
+ <widget class="QSpinBox" name="rainSpinBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="specialValueText" >
+ <string/>
+ </property>
+ <property name="suffix" >
+ <string>mm</string>
+ </property>
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="7" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Starting Time:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1" colspan="3" >
+ <widget class="QTimeEdit" name="startTimeEdit" />
+ </item>
+ <item row="9" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="text" >
+ <string>Amount:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="1" colspan="3" >
+ <widget class="QSpinBox" name="amountSpinBox" >
+ <property name="suffix" >
+ <string>l</string>
+ </property>
+ <property name="minimum" >
+ <number>100</number>
+ </property>
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ <property name="singleStep" >
+ <number>100</number>
+ </property>
+ <property name="value" >
+ <number>1000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>Source:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="1" colspan="3" >
+ <widget class="QComboBox" name="sourceComboBox" >
+ <item>
+ <property name="text" >
+ <string>Foundain</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>River</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Lake</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>Public Water System</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="11" column="0" >
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>Filter:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="1" colspan="2" >
+ <widget class="QCheckBox" name="filterCheckBox" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="12" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="4" column="4" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QGridLayout" >
+ <item row="0" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="HelpBrowser" name="helpBrowser" />
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="helpLabel" >
+ <property name="text" >
+ <string>&lt;a href="test">Show Details&lt;/a></string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>HelpBrowser</class>
+ <extends>QTextBrowser</extends>
+ <header>helpbrowser.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>WateringConfigDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>227</x>
+ <y>372</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>WateringConfigDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>286</x>
+ <y>378</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>temperatureCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>temperatureSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>132</x>
+ <y>101</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>132</x>
+ <y>125</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>rainCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>rainSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>110</x>
+ <y>154</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>113</x>
+ <y>169</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/help/help.pro b/examples/help/help.pro
new file mode 100644
index 0000000..1ce6322
--- /dev/null
+++ b/examples/help/help.pro
@@ -0,0 +1,11 @@
+TEMPLATE = subdirs
+CONFIG += ordered
+
+SUBDIRS += contextsensitivehelp \
+ remotecontrol \
+ simpletextviewer
+
+# install
+sources.files = README *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/help
+INSTALLS += sources
diff --git a/examples/help/remotecontrol/enter.png b/examples/help/remotecontrol/enter.png
new file mode 100644
index 0000000..f397f4b
--- /dev/null
+++ b/examples/help/remotecontrol/enter.png
Binary files differ
diff --git a/examples/help/remotecontrol/main.cpp b/examples/help/remotecontrol/main.cpp
new file mode 100644
index 0000000..746dec4
--- /dev/null
+++ b/examples/help/remotecontrol/main.cpp
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QApplication>
+#include "remotecontrol.h"
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(remotecontrol);
+
+ QApplication a(argc, argv);
+ RemoteControl w;
+ w.show();
+ a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
+ return a.exec();
+}
diff --git a/examples/help/remotecontrol/remotecontrol.cpp b/examples/help/remotecontrol/remotecontrol.cpp
new file mode 100644
index 0000000..8701afb
--- /dev/null
+++ b/examples/help/remotecontrol/remotecontrol.cpp
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QDir>
+#include <QtCore/QProcess>
+#include <QtCore/QTextStream>
+#include <QtCore/QLibraryInfo>
+
+#include <QtGui/QMessageBox>
+
+#include "remotecontrol.h"
+
+RemoteControl::RemoteControl(QWidget *parent, Qt::WFlags flags)
+ : QMainWindow(parent, flags)
+{
+ ui.setupUi(this);
+ connect(ui.indexLineEdit, SIGNAL(returnPressed()),
+ this, SLOT(on_indexButton_clicked()));
+ connect(ui.identifierLineEdit, SIGNAL(returnPressed()),
+ this, SLOT(on_identifierButton_clicked()));
+ connect(ui.urlLineEdit, SIGNAL(returnPressed()),
+ this, SLOT(on_urlButton_clicked()));
+
+ QString rc;
+ QTextStream(&rc) << QLatin1String("qthelp://com.trolltech.qt.")
+ << (QT_VERSION >> 16) << ((QT_VERSION >> 8) & 0xFF)
+ << (QT_VERSION & 0xFF)
+ << QLatin1String("/qdoc/index.html");
+
+ ui.startUrlLineEdit->setText(rc);
+
+ process = new QProcess(this);
+ connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(helpViewerClosed()));
+}
+
+RemoteControl::~RemoteControl()
+{
+ if (process->state() == QProcess::Running) {
+ process->terminate();
+ process->waitForFinished(3000);
+ }
+}
+
+void RemoteControl::on_actionQuit_triggered()
+{
+ close();
+}
+
+void RemoteControl::on_launchButton_clicked()
+{
+ if (process->state() == QProcess::Running)
+ return;
+
+ QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
+#if !defined(Q_OS_MAC)
+ app += QLatin1String("assistant");
+#else
+ app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
+#endif
+
+ ui.contentsCheckBox->setChecked(true);
+ ui.indexCheckBox->setChecked(true);
+ ui.bookmarksCheckBox->setChecked(true);
+
+ QStringList args;
+ args << QLatin1String("-enableRemoteControl");
+ process->start(app, args);
+ if (!process->waitForStarted()) {
+ QMessageBox::critical(this, tr("Remote Control"),
+ tr("Could not start Qt Assistant from %1.").arg(app));
+ return;
+ }
+
+ if (!ui.startUrlLineEdit->text().isEmpty())
+ sendCommand(QLatin1String("SetSource ")
+ + ui.startUrlLineEdit->text());
+
+ ui.launchButton->setEnabled(false);
+ ui.startUrlLineEdit->setEnabled(false);
+ ui.actionGroupBox->setEnabled(true);
+}
+
+void RemoteControl::sendCommand(const QString &cmd)
+{
+ if (process->state() != QProcess::Running)
+ return;
+ process->write(cmd.toLocal8Bit() + '\0');
+}
+
+void RemoteControl::on_indexButton_clicked()
+{
+ sendCommand(QLatin1String("ActivateKeyword ")
+ + ui.indexLineEdit->text());
+}
+
+void RemoteControl::on_identifierButton_clicked()
+{
+ sendCommand(QLatin1String("ActivateIdentifier ")
+ + ui.identifierLineEdit->text());
+}
+
+void RemoteControl::on_urlButton_clicked()
+{
+ sendCommand(QLatin1String("SetSource ")
+ + ui.urlLineEdit->text());
+}
+
+void RemoteControl::on_syncContentsButton_clicked()
+{
+ sendCommand(QLatin1String("SyncContents"));
+}
+
+void RemoteControl::on_contentsCheckBox_toggled(bool checked)
+{
+ sendCommand(checked ?
+ QLatin1String("Show Contents") : QLatin1String("Hide Contents"));
+}
+
+void RemoteControl::on_indexCheckBox_toggled(bool checked)
+{
+ sendCommand(checked ?
+ QLatin1String("Show Index") : QLatin1String("Hide Index"));
+}
+
+void RemoteControl::on_bookmarksCheckBox_toggled(bool checked)
+{
+ sendCommand(checked ?
+ QLatin1String("Show Bookmarks") : QLatin1String("Hide Bookmarks"));
+}
+
+void RemoteControl::helpViewerClosed()
+{
+ ui.launchButton->setEnabled(true);
+ ui.startUrlLineEdit->setEnabled(true);
+ ui.actionGroupBox->setEnabled(false);
+}
diff --git a/examples/help/remotecontrol/remotecontrol.h b/examples/help/remotecontrol/remotecontrol.h
new file mode 100644
index 0000000..cc1c1c8
--- /dev/null
+++ b/examples/help/remotecontrol/remotecontrol.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef REMOTECONTROL_H
+#define REMOTECONTROL_H
+
+#include <QtGui/QMainWindow>
+#include "ui_remotecontrol.h"
+
+QT_BEGIN_NAMESPACE
+class QProcess;
+QT_END_NAMESPACE;
+
+class RemoteControl : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ RemoteControl(QWidget *parent = 0, Qt::WFlags flags = 0);
+ ~RemoteControl();
+
+private:
+ Ui::RemoteControlClass ui;
+ QProcess *process;
+
+private slots:
+ void on_launchButton_clicked();
+ void on_actionQuit_triggered();
+ void on_indexButton_clicked();
+ void on_identifierButton_clicked();
+ void on_urlButton_clicked();
+ void on_syncContentsButton_clicked();
+ void on_contentsCheckBox_toggled(bool checked);
+ void on_indexCheckBox_toggled(bool checked);
+ void on_bookmarksCheckBox_toggled(bool checked);
+ void helpViewerClosed();
+
+ void sendCommand(const QString &cmd);
+};
+
+#endif // REMOTECONTROL_H
diff --git a/examples/help/remotecontrol/remotecontrol.pro b/examples/help/remotecontrol/remotecontrol.pro
new file mode 100644
index 0000000..05fc14c
--- /dev/null
+++ b/examples/help/remotecontrol/remotecontrol.pro
@@ -0,0 +1,13 @@
+TEMPLATE = app
+
+HEADERS += remotecontrol.h
+SOURCES += main.cpp \
+ remotecontrol.cpp
+FORMS += remotecontrol.ui
+RESOURCES += remotecontrol.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/help/remotecontrol
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png *.doc doc
+sources.path = $$[QT_INSTALL_EXAMPLES]/help/remotecontrol
+INSTALLS += target sources
diff --git a/examples/help/remotecontrol/remotecontrol.qrc b/examples/help/remotecontrol/remotecontrol.qrc
new file mode 100644
index 0000000..9b4299d
--- /dev/null
+++ b/examples/help/remotecontrol/remotecontrol.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/remotecontrol" >
+ <file>enter.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/help/remotecontrol/remotecontrol.ui b/examples/help/remotecontrol/remotecontrol.ui
new file mode 100644